mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into release-1.5
Conflicts: bin/tsc.js bin/typescript.js bin/typescriptServices.js src/compiler/program.ts
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ Your pull request should:
|
||||
* Tests should include reasonable permutations of the target fix/change
|
||||
* Include baseline changes with your change
|
||||
* All changed code must have 100% code coverage
|
||||
* Follow the code conventions descriped in [Coding guidlines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidlines)
|
||||
* Follow the code conventions descriped in [Coding guidelines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines)
|
||||
* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
|
||||
|
||||
## Running the Tests
|
||||
|
||||
@@ -105,24 +105,6 @@ var serverSources = [
|
||||
return path.join(serverDirectory, f);
|
||||
});
|
||||
|
||||
var definitionsRoots = [
|
||||
"compiler/types.d.ts",
|
||||
"compiler/scanner.d.ts",
|
||||
"compiler/parser.d.ts",
|
||||
"compiler/checker.d.ts",
|
||||
"compiler/program.d.ts",
|
||||
"compiler/commandLineParser.d.ts",
|
||||
"services/services.d.ts",
|
||||
];
|
||||
|
||||
var internalDefinitionsRoots = [
|
||||
"compiler/core.d.ts",
|
||||
"compiler/sys.d.ts",
|
||||
"compiler/utilities.d.ts",
|
||||
"compiler/commandLineParser.d.ts",
|
||||
"services/utilities.d.ts",
|
||||
];
|
||||
|
||||
var harnessSources = [
|
||||
"harness.ts",
|
||||
"sourceMapRecorder.ts",
|
||||
@@ -354,60 +336,32 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
|
||||
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
|
||||
|
||||
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
|
||||
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
|
||||
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
|
||||
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
|
||||
|
||||
compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
|
||||
/*prefixes*/ [copyright],
|
||||
/*useBuiltCompiler*/ true,
|
||||
/*noOutFile*/ false,
|
||||
/*generateDeclarations*/ false,
|
||||
/*generateDeclarations*/ true,
|
||||
/*outDir*/ undefined,
|
||||
/*preserveConstEnums*/ true,
|
||||
/*keepComments*/ false,
|
||||
/*keepComments*/ true,
|
||||
/*noResolve*/ false,
|
||||
/*stripInternal*/ false,
|
||||
/*stripInternal*/ true,
|
||||
/*callback*/ function () {
|
||||
jake.cpR(servicesFile, nodePackageFile, {silent: true});
|
||||
|
||||
prependFile(copyright, standaloneDefinitionsFile);
|
||||
|
||||
// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
|
||||
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
|
||||
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
|
||||
definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"');
|
||||
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
|
||||
});
|
||||
|
||||
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
|
||||
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
|
||||
var internalNodeDefinitionsFile = path.join(builtLocalDirectory, "typescript_internal.d.ts");
|
||||
var internalStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices_internal.d.ts");
|
||||
var tempDirPath = path.join(builtLocalDirectory, "temptempdir");
|
||||
compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
|
||||
/*prefixes*/ undefined,
|
||||
/*useBuiltCompiler*/ true,
|
||||
/*noOutFile*/ true,
|
||||
/*generateDeclarations*/ true,
|
||||
/*outDir*/ tempDirPath,
|
||||
/*preserveConstEnums*/ true,
|
||||
/*keepComments*/ true,
|
||||
/*noResolve*/ true,
|
||||
/*stripInternal*/ true,
|
||||
/*callback*/ function () {
|
||||
function makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile) {
|
||||
// Create the standalone definition file
|
||||
concatenateFiles(standaloneDefinitionsFile, definitionsRoots.map(function (f) {
|
||||
return path.join(tempDirPath, f);
|
||||
}));
|
||||
prependFile(copyright, standaloneDefinitionsFile);
|
||||
|
||||
// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
|
||||
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
|
||||
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
|
||||
definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"');
|
||||
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
|
||||
}
|
||||
|
||||
// Create the public definition files
|
||||
makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile);
|
||||
|
||||
// Create the internal definition files
|
||||
makeDefinitionFiles(internalDefinitionsRoots, internalStandaloneDefinitionsFile, internalNodeDefinitionsFile);
|
||||
|
||||
// Delete the temp dir
|
||||
jake.rmRf(tempDirPath, {silent: true});
|
||||
});
|
||||
|
||||
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
|
||||
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
|
||||
@@ -469,7 +423,7 @@ task("generate-spec", [specMd])
|
||||
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
|
||||
desc("Makes a new LKG out of the built js files");
|
||||
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
|
||||
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets);
|
||||
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile].concat(libraryTargets);
|
||||
var missingFiles = expectedFiles.filter(function (f) {
|
||||
return !fs.existsSync(f);
|
||||
});
|
||||
|
||||
Vendored
+2
-2
@@ -838,7 +838,7 @@ interface RegExp {
|
||||
*/
|
||||
test(string: string): boolean;
|
||||
|
||||
/** Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal. */
|
||||
/** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */
|
||||
source: string;
|
||||
|
||||
/** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */
|
||||
@@ -1183,4 +1183,4 @@ interface TypedPropertyDescriptor<T> {
|
||||
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
|
||||
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
|
||||
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
||||
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
|
||||
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
||||
|
||||
Vendored
+39
-32
@@ -838,7 +838,7 @@ interface RegExp {
|
||||
*/
|
||||
test(string: string): boolean;
|
||||
|
||||
/** Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal. */
|
||||
/** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */
|
||||
source: string;
|
||||
|
||||
/** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */
|
||||
@@ -1183,7 +1183,7 @@ interface TypedPropertyDescriptor<T> {
|
||||
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
|
||||
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
|
||||
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
||||
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
|
||||
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
||||
declare type PropertyKey = string | number | symbol;
|
||||
|
||||
interface Symbol {
|
||||
@@ -1236,26 +1236,21 @@ interface SymbolConstructor {
|
||||
*/
|
||||
isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A Boolean value that if true indicates that an object may be used as a regular expression.
|
||||
*/
|
||||
isRegExp: symbol;
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object.Called by the semantics of the
|
||||
* for-of statement.
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
* abstract operation.
|
||||
*/
|
||||
toPrimitive: symbol;
|
||||
|
||||
/**
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built- in method Object.prototype.toString.
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built-in method Object.prototype.toString.
|
||||
*/
|
||||
toStringTag: symbol;
|
||||
|
||||
@@ -1297,7 +1292,7 @@ interface ObjectConstructor {
|
||||
getOwnPropertySymbols(o: any): symbol[];
|
||||
|
||||
/**
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* @param value1 The first value.
|
||||
* @param value2 The second value.
|
||||
*/
|
||||
@@ -1784,8 +1779,6 @@ interface Math {
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
[Symbol.isRegExp]: boolean;
|
||||
|
||||
/**
|
||||
* Matches a string with a regular expression, and returns an array containing the results of
|
||||
* that search.
|
||||
@@ -1817,6 +1810,20 @@ interface RegExp {
|
||||
*/
|
||||
split(string: string, limit?: number): string[];
|
||||
|
||||
/**
|
||||
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
|
||||
* The characters in this string are sequenced and concatenated in the following order:
|
||||
*
|
||||
* - "g" for global
|
||||
* - "i" for ignoreCase
|
||||
* - "m" for multiline
|
||||
* - "u" for unicode
|
||||
* - "y" for sticky
|
||||
*
|
||||
* If no flags are set, the value is the empty string.
|
||||
*/
|
||||
flags: string;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value indicating the state of the sticky flag (y) used with a regular
|
||||
* expression. Default is false. Read-only.
|
||||
@@ -4699,27 +4706,27 @@ interface ProxyHandler<T> {
|
||||
|
||||
interface ProxyConstructor {
|
||||
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
|
||||
new <T>(target: T, handeler: ProxyHandler<T>): T
|
||||
new <T>(target: T, handler: ProxyHandler<T>): T
|
||||
}
|
||||
declare var Proxy: ProxyConstructor;
|
||||
|
||||
declare var Reflect: {
|
||||
apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
|
||||
construct(target: Function, argumentsList: ArrayLike<any>): any;
|
||||
defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
deleteProperty(target: any, propertyKey: PropertyKey): boolean;
|
||||
enumerate(target: any): IterableIterator<any>;
|
||||
get(target: any, propertyKey: PropertyKey, receiver?: any): any;
|
||||
getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
|
||||
getPrototypeOf(target: any): any;
|
||||
has(target: any, propertyKey: string): boolean;
|
||||
has(target: any, propertyKey: symbol): boolean;
|
||||
isExtensible(target: any): boolean;
|
||||
ownKeys(target: any): Array<PropertyKey>;
|
||||
preventExtensions(target: any): boolean;
|
||||
set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
|
||||
setPrototypeOf(target: any, proto: any): boolean;
|
||||
};
|
||||
declare module Reflect {
|
||||
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
|
||||
function construct(target: Function, argumentsList: ArrayLike<any>): any;
|
||||
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
|
||||
function enumerate(target: any): IterableIterator<any>;
|
||||
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
|
||||
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
|
||||
function getPrototypeOf(target: any): any;
|
||||
function has(target: any, propertyKey: string): boolean;
|
||||
function has(target: any, propertyKey: symbol): boolean;
|
||||
function isExtensible(target: any): boolean;
|
||||
function ownKeys(target: any): Array<PropertyKey>;
|
||||
function preventExtensions(target: any): boolean;
|
||||
function set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
|
||||
Vendored
+13755
-11375
File diff suppressed because it is too large
Load Diff
Vendored
+13643
-11368
File diff suppressed because it is too large
Load Diff
Vendored
+11984
-11108
File diff suppressed because it is too large
Load Diff
Vendored
+110
-4
@@ -37,13 +37,16 @@ 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.
|
||||
* 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;
|
||||
}
|
||||
@@ -53,10 +56,12 @@ 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.
|
||||
*/
|
||||
@@ -65,37 +70,43 @@ interface TextStreamWriter extends TextStreamBase {
|
||||
|
||||
interface TextStreamReader extends TextStreamBase {
|
||||
/**
|
||||
* Returns a specified number of characters from an input stream, beginning at the current pointer position.
|
||||
* Returns a specified number of characters from an input stream, starting 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.
|
||||
*/
|
||||
@@ -104,85 +115,180 @@ interface TextStreamReader extends TextStreamBase {
|
||||
|
||||
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).
|
||||
* Outputs text to either a message box (under WScript.exe) or the command console window followed by
|
||||
* a newline (under CScript.exe).
|
||||
*/
|
||||
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 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;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allows enumerating over a COM collection, which may not have indexed item access.
|
||||
*/
|
||||
interface Enumerator<T> {
|
||||
/**
|
||||
* Returns true if the current item is the last one in the collection, or the collection is empty,
|
||||
* or the current item is undefined.
|
||||
*/
|
||||
atEnd(): boolean;
|
||||
|
||||
/**
|
||||
* Returns the current item in the collection
|
||||
*/
|
||||
item(): T;
|
||||
|
||||
/**
|
||||
* Resets the current item in the collection to the first item. If there are no items in the collection,
|
||||
* the current item is set to undefined.
|
||||
*/
|
||||
moveFirst(): void;
|
||||
|
||||
/**
|
||||
* Moves the current item to the next item in the collection. If the enumerator is at the end of
|
||||
* the collection or the collection is empty, the current item is set to undefined.
|
||||
*/
|
||||
moveNext(): void;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new <T>(collection: any): Enumerator<T>;
|
||||
new (collection: any): Enumerator<any>;
|
||||
}
|
||||
|
||||
declare var Enumerator: EnumeratorConstructor;
|
||||
|
||||
/**
|
||||
* Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.
|
||||
*/
|
||||
interface VBArray<T> {
|
||||
/**
|
||||
* Returns the number of dimensions (1-based).
|
||||
*/
|
||||
dimensions(): number;
|
||||
|
||||
/**
|
||||
* Takes an index for each dimension in the array, and returns the item at the corresponding location.
|
||||
*/
|
||||
getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;
|
||||
|
||||
/**
|
||||
* Returns the smallest available index for a given dimension.
|
||||
* @param dimension 1-based dimension (defaults to 1)
|
||||
*/
|
||||
lbound(dimension?: number): number;
|
||||
|
||||
/**
|
||||
* Returns the largest available index for a given dimension.
|
||||
* @param dimension 1-based dimension (defaults to 1)
|
||||
*/
|
||||
ubound(dimension?: number): number;
|
||||
|
||||
/**
|
||||
* Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,
|
||||
* each successive dimension is appended to the end of the array.
|
||||
* Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]
|
||||
*/
|
||||
toArray(): T[];
|
||||
}
|
||||
|
||||
interface VBArrayConstructor {
|
||||
new <T>(safeArray: any): VBArray<T>;
|
||||
new (safeArray: any): VBArray<any>;
|
||||
}
|
||||
|
||||
declare var VBArray: VBArrayConstructor;
|
||||
|
||||
Vendored
+2573
-1004
File diff suppressed because it is too large
Load Diff
+2071
-1318
File diff suppressed because it is too large
Load Diff
+3296
-2260
File diff suppressed because it is too large
Load Diff
Vendored
+151
-374
@@ -124,16 +124,16 @@ declare module "typescript" {
|
||||
VoidKeyword = 99,
|
||||
WhileKeyword = 100,
|
||||
WithKeyword = 101,
|
||||
AsKeyword = 102,
|
||||
ImplementsKeyword = 103,
|
||||
InterfaceKeyword = 104,
|
||||
LetKeyword = 105,
|
||||
PackageKeyword = 106,
|
||||
PrivateKeyword = 107,
|
||||
ProtectedKeyword = 108,
|
||||
PublicKeyword = 109,
|
||||
StaticKeyword = 110,
|
||||
YieldKeyword = 111,
|
||||
ImplementsKeyword = 102,
|
||||
InterfaceKeyword = 103,
|
||||
LetKeyword = 104,
|
||||
PackageKeyword = 105,
|
||||
PrivateKeyword = 106,
|
||||
ProtectedKeyword = 107,
|
||||
PublicKeyword = 108,
|
||||
StaticKeyword = 109,
|
||||
YieldKeyword = 110,
|
||||
AsKeyword = 111,
|
||||
AnyKeyword = 112,
|
||||
BooleanKeyword = 113,
|
||||
ConstructorKeyword = 114,
|
||||
@@ -258,8 +258,8 @@ declare module "typescript" {
|
||||
LastReservedWord = 101,
|
||||
FirstKeyword = 66,
|
||||
LastKeyword = 125,
|
||||
FirstFutureReservedWord = 103,
|
||||
LastFutureReservedWord = 111,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 141,
|
||||
LastTypeNode = 149,
|
||||
FirstPunctuation = 14,
|
||||
@@ -295,34 +295,12 @@ declare module "typescript" {
|
||||
AccessibilityModifier = 112,
|
||||
BlockScoped = 12288,
|
||||
}
|
||||
const enum ParserContextFlags {
|
||||
StrictMode = 1,
|
||||
DisallowIn = 2,
|
||||
Yield = 4,
|
||||
GeneratorParameter = 8,
|
||||
Decorator = 16,
|
||||
ThisNodeHasError = 32,
|
||||
ParserGeneratedFlags = 63,
|
||||
ThisNodeOrAnySubNodesHasError = 64,
|
||||
HasAggregatedChildData = 128,
|
||||
}
|
||||
const enum RelationComparisonResult {
|
||||
Succeeded = 1,
|
||||
Failed = 2,
|
||||
FailedAndReported = 3,
|
||||
}
|
||||
interface Node extends TextRange {
|
||||
kind: SyntaxKind;
|
||||
flags: NodeFlags;
|
||||
parserContextFlags?: ParserContextFlags;
|
||||
decorators?: NodeArray<Decorator>;
|
||||
modifiers?: ModifiersArray;
|
||||
id?: number;
|
||||
parent?: Node;
|
||||
symbol?: Symbol;
|
||||
locals?: SymbolTable;
|
||||
nextContainer?: Node;
|
||||
localSymbol?: Symbol;
|
||||
}
|
||||
interface NodeArray<T> extends Array<T>, TextRange {
|
||||
hasTrailingComma?: boolean;
|
||||
@@ -332,6 +310,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface Identifier extends PrimaryExpression {
|
||||
text: string;
|
||||
originalKeywordKind?: SyntaxKind;
|
||||
}
|
||||
interface QualifiedName extends Node {
|
||||
left: EntityName;
|
||||
@@ -473,7 +452,8 @@ declare module "typescript" {
|
||||
interface ParenthesizedTypeNode extends TypeNode {
|
||||
type: TypeNode;
|
||||
}
|
||||
interface StringLiteralTypeNode extends LiteralExpression, TypeNode {
|
||||
interface StringLiteral extends LiteralExpression, TypeNode {
|
||||
_stringLiteralBrand: any;
|
||||
}
|
||||
interface Expression extends Node {
|
||||
_expressionBrand: any;
|
||||
@@ -539,9 +519,6 @@ declare module "typescript" {
|
||||
isUnterminated?: boolean;
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
}
|
||||
interface StringLiteralExpression extends LiteralExpression {
|
||||
_stringLiteralExpressionBrand: any;
|
||||
}
|
||||
interface TemplateExpression extends PrimaryExpression {
|
||||
head: LiteralExpression;
|
||||
templateSpans: NodeArray<TemplateSpan>;
|
||||
@@ -576,7 +553,7 @@ declare module "typescript" {
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
interface HeritageClauseElement extends Node {
|
||||
interface HeritageClauseElement extends TypeNode {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
@@ -723,7 +700,7 @@ declare module "typescript" {
|
||||
interface ExternalModuleReference extends Node {
|
||||
expression?: Expression;
|
||||
}
|
||||
interface ImportDeclaration extends Statement, ModuleElement {
|
||||
interface ImportDeclaration extends ModuleElement {
|
||||
importClause?: ImportClause;
|
||||
moduleSpecifier: Expression;
|
||||
}
|
||||
@@ -751,14 +728,14 @@ declare module "typescript" {
|
||||
type ExportSpecifier = ImportOrExportSpecifier;
|
||||
interface ExportAssignment extends Declaration, ModuleElement {
|
||||
isExportEquals?: boolean;
|
||||
expression?: Expression;
|
||||
type?: TypeNode;
|
||||
expression: Expression;
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
fileName: string;
|
||||
}
|
||||
interface CommentRange extends TextRange {
|
||||
hasTrailingNewLine?: boolean;
|
||||
kind: SyntaxKind;
|
||||
}
|
||||
interface SourceFile extends Declaration {
|
||||
statements: NodeArray<ModuleElement>;
|
||||
@@ -772,9 +749,7 @@ declare module "typescript" {
|
||||
amdModuleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
hasNoDefaultLib: boolean;
|
||||
externalModuleIndicator: Node;
|
||||
languageVersion: ScriptTarget;
|
||||
identifiers: Map<string>;
|
||||
}
|
||||
interface ScriptReferenceHost {
|
||||
getCompilerOptions(): CompilerOptions;
|
||||
@@ -785,6 +760,9 @@ declare module "typescript" {
|
||||
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
|
||||
}
|
||||
interface Program extends ScriptReferenceHost {
|
||||
/**
|
||||
* Get a list of files in the program
|
||||
*/
|
||||
getSourceFiles(): SourceFile[];
|
||||
/**
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
@@ -801,15 +779,23 @@ declare module "typescript" {
|
||||
getGlobalDiagnostics(): Diagnostic[];
|
||||
getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
/**
|
||||
* Gets a type checker that can be used to semantically analyze source fils in the program.
|
||||
*/
|
||||
getTypeChecker(): TypeChecker;
|
||||
getCommonSourceDirectory(): string;
|
||||
}
|
||||
interface SourceMapSpan {
|
||||
/** Line number in the .js file. */
|
||||
emittedLine: number;
|
||||
/** Column number in the .js file. */
|
||||
emittedColumn: number;
|
||||
/** Line number in the .ts file. */
|
||||
sourceLine: number;
|
||||
/** Column number in the .ts file. */
|
||||
sourceColumn: number;
|
||||
/** Optional name (index into names array) associated with this span. */
|
||||
nameIndex?: number;
|
||||
/** .ts file (index into sources array) associated with this span */
|
||||
sourceIndex: number;
|
||||
}
|
||||
interface SourceMapData {
|
||||
@@ -823,6 +809,7 @@ declare module "typescript" {
|
||||
sourceMapMappings: string;
|
||||
sourceMapDecodedMappings: SourceMapSpan[];
|
||||
}
|
||||
/** Return code used by getEmitOutput function to indicate status of the function */
|
||||
enum ExitStatus {
|
||||
Success = 0,
|
||||
DiagnosticsPresent_OutputsSkipped = 1,
|
||||
@@ -831,7 +818,6 @@ declare module "typescript" {
|
||||
interface EmitResult {
|
||||
emitSkipped: boolean;
|
||||
diagnostics: Diagnostic[];
|
||||
sourceMaps: SourceMapData[];
|
||||
}
|
||||
interface TypeCheckerHost {
|
||||
getCompilerOptions(): CompilerOptions;
|
||||
@@ -865,7 +851,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;
|
||||
@@ -908,40 +894,6 @@ declare module "typescript" {
|
||||
WriteTypeParametersOrArguments = 1,
|
||||
UseOnlyExternalAliasing = 2,
|
||||
}
|
||||
const enum SymbolAccessibility {
|
||||
Accessible = 0,
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
interface SymbolAccessiblityResult extends SymbolVisibilityResult {
|
||||
errorModuleName?: string;
|
||||
}
|
||||
interface EmitResolver {
|
||||
hasGlobalName(name: string): boolean;
|
||||
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
FunctionScopedVariable = 1,
|
||||
BlockScopedVariable = 2,
|
||||
@@ -1011,57 +963,14 @@ declare module "typescript" {
|
||||
interface Symbol {
|
||||
flags: SymbolFlags;
|
||||
name: string;
|
||||
id?: number;
|
||||
mergeId?: number;
|
||||
declarations?: Declaration[];
|
||||
parent?: Symbol;
|
||||
members?: SymbolTable;
|
||||
exports?: SymbolTable;
|
||||
exportSymbol?: Symbol;
|
||||
valueDeclaration?: Declaration;
|
||||
constEnumOnlyModule?: boolean;
|
||||
}
|
||||
interface SymbolLinks {
|
||||
target?: Symbol;
|
||||
type?: Type;
|
||||
declaredType?: Type;
|
||||
mapper?: TypeMapper;
|
||||
referenced?: boolean;
|
||||
unionType?: UnionType;
|
||||
resolvedExports?: SymbolTable;
|
||||
exportsChecked?: boolean;
|
||||
}
|
||||
interface TransientSymbol extends Symbol, SymbolLinks {
|
||||
}
|
||||
interface SymbolTable {
|
||||
[index: string]: Symbol;
|
||||
}
|
||||
const enum NodeCheckFlags {
|
||||
TypeChecked = 1,
|
||||
LexicalThis = 2,
|
||||
CaptureThis = 4,
|
||||
EmitExtends = 8,
|
||||
SuperInstance = 16,
|
||||
SuperStatic = 32,
|
||||
ContextChecked = 64,
|
||||
EnumValuesComputed = 128,
|
||||
BlockScopedBindingInLoop = 256,
|
||||
EmitDecorate = 512,
|
||||
}
|
||||
interface NodeLinks {
|
||||
resolvedType?: Type;
|
||||
resolvedSignature?: Signature;
|
||||
resolvedSymbol?: Symbol;
|
||||
flags?: NodeCheckFlags;
|
||||
enumMemberValue?: number;
|
||||
isIllegalTypeReferenceInConstraint?: boolean;
|
||||
isVisible?: boolean;
|
||||
generatedName?: string;
|
||||
generatedNames?: Map<string>;
|
||||
assignmentChecks?: Map<boolean>;
|
||||
hasReportedStatementInAmbientContext?: boolean;
|
||||
importOnRightSide?: Symbol;
|
||||
}
|
||||
const enum TypeFlags {
|
||||
Any = 1,
|
||||
String = 2,
|
||||
@@ -1079,26 +988,16 @@ declare module "typescript" {
|
||||
Tuple = 8192,
|
||||
Union = 16384,
|
||||
Anonymous = 32768,
|
||||
FromSignature = 65536,
|
||||
ObjectLiteral = 131072,
|
||||
ContainsUndefinedOrNull = 262144,
|
||||
ContainsObjectLiteral = 524288,
|
||||
ESSymbol = 1048576,
|
||||
Intrinsic = 1048703,
|
||||
Primitive = 1049086,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 48128,
|
||||
RequiresWidening = 786432,
|
||||
}
|
||||
interface Type {
|
||||
flags: TypeFlags;
|
||||
id: number;
|
||||
symbol?: Symbol;
|
||||
}
|
||||
interface IntrinsicType extends Type {
|
||||
intrinsicName: string;
|
||||
}
|
||||
interface StringLiteralType extends Type {
|
||||
text: string;
|
||||
}
|
||||
@@ -1106,19 +1005,20 @@ declare module "typescript" {
|
||||
}
|
||||
interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[];
|
||||
baseTypes: ObjectType[];
|
||||
declaredProperties: Symbol[];
|
||||
declaredCallSignatures: Signature[];
|
||||
declaredConstructSignatures: Signature[];
|
||||
declaredStringIndexType: Type;
|
||||
declaredNumberIndexType: Type;
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
interface TypeReference extends ObjectType {
|
||||
target: GenericType;
|
||||
typeArguments: Type[];
|
||||
}
|
||||
interface GenericType extends InterfaceType, TypeReference {
|
||||
instantiations: Map<TypeReference>;
|
||||
}
|
||||
interface TupleType extends ObjectType {
|
||||
elementTypes: Type[];
|
||||
@@ -1126,20 +1026,9 @@ declare module "typescript" {
|
||||
}
|
||||
interface UnionType extends Type {
|
||||
types: Type[];
|
||||
resolvedProperties: SymbolTable;
|
||||
}
|
||||
interface ResolvedType extends ObjectType, UnionType {
|
||||
members: SymbolTable;
|
||||
properties: Symbol[];
|
||||
callSignatures: Signature[];
|
||||
constructSignatures: Signature[];
|
||||
stringIndexType: Type;
|
||||
numberIndexType: Type;
|
||||
}
|
||||
interface TypeParameter extends Type {
|
||||
constraint: Type;
|
||||
target?: TypeParameter;
|
||||
mapper?: TypeMapper;
|
||||
}
|
||||
const enum SignatureKind {
|
||||
Call = 0,
|
||||
@@ -1149,28 +1038,22 @@ declare module "typescript" {
|
||||
declaration: SignatureDeclaration;
|
||||
typeParameters: TypeParameter[];
|
||||
parameters: Symbol[];
|
||||
resolvedReturnType: Type;
|
||||
minArgumentCount: number;
|
||||
hasRestParameter: boolean;
|
||||
hasStringLiterals: boolean;
|
||||
target?: Signature;
|
||||
mapper?: TypeMapper;
|
||||
unionSignatures?: Signature[];
|
||||
erasedSignatureCache?: Signature;
|
||||
isolatedSignatureType?: ObjectType;
|
||||
}
|
||||
const enum IndexKind {
|
||||
String = 0,
|
||||
Number = 1,
|
||||
}
|
||||
interface TypeMapper {
|
||||
(t: Type): Type;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
code: number;
|
||||
}
|
||||
/**
|
||||
* A linked list of formatted diagnostic messages to be used as part of a multiline message.
|
||||
* It is built from the bottom up, leaving the head to be the "main" diagnostic.
|
||||
* While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage,
|
||||
* the difference is that messages are all preformatted in DMC.
|
||||
*/
|
||||
interface DiagnosticMessageChain {
|
||||
messageText: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1219,6 +1102,7 @@ declare module "typescript" {
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
separateCompilation?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
const enum ModuleKind {
|
||||
@@ -1241,142 +1125,6 @@ declare module "typescript" {
|
||||
fileNames: string[];
|
||||
errors: Diagnostic[];
|
||||
}
|
||||
interface CommandLineOption {
|
||||
name: string;
|
||||
type: string | Map<number>;
|
||||
isFilePath?: boolean;
|
||||
shortName?: string;
|
||||
description?: DiagnosticMessage;
|
||||
paramType?: DiagnosticMessage;
|
||||
error?: DiagnosticMessage;
|
||||
experimental?: boolean;
|
||||
}
|
||||
const enum CharacterCodes {
|
||||
nullCharacter = 0,
|
||||
maxAsciiCharacter = 127,
|
||||
lineFeed = 10,
|
||||
carriageReturn = 13,
|
||||
lineSeparator = 8232,
|
||||
paragraphSeparator = 8233,
|
||||
nextLine = 133,
|
||||
space = 32,
|
||||
nonBreakingSpace = 160,
|
||||
enQuad = 8192,
|
||||
emQuad = 8193,
|
||||
enSpace = 8194,
|
||||
emSpace = 8195,
|
||||
threePerEmSpace = 8196,
|
||||
fourPerEmSpace = 8197,
|
||||
sixPerEmSpace = 8198,
|
||||
figureSpace = 8199,
|
||||
punctuationSpace = 8200,
|
||||
thinSpace = 8201,
|
||||
hairSpace = 8202,
|
||||
zeroWidthSpace = 8203,
|
||||
narrowNoBreakSpace = 8239,
|
||||
ideographicSpace = 12288,
|
||||
mathematicalSpace = 8287,
|
||||
ogham = 5760,
|
||||
_ = 95,
|
||||
$ = 36,
|
||||
_0 = 48,
|
||||
_1 = 49,
|
||||
_2 = 50,
|
||||
_3 = 51,
|
||||
_4 = 52,
|
||||
_5 = 53,
|
||||
_6 = 54,
|
||||
_7 = 55,
|
||||
_8 = 56,
|
||||
_9 = 57,
|
||||
a = 97,
|
||||
b = 98,
|
||||
c = 99,
|
||||
d = 100,
|
||||
e = 101,
|
||||
f = 102,
|
||||
g = 103,
|
||||
h = 104,
|
||||
i = 105,
|
||||
j = 106,
|
||||
k = 107,
|
||||
l = 108,
|
||||
m = 109,
|
||||
n = 110,
|
||||
o = 111,
|
||||
p = 112,
|
||||
q = 113,
|
||||
r = 114,
|
||||
s = 115,
|
||||
t = 116,
|
||||
u = 117,
|
||||
v = 118,
|
||||
w = 119,
|
||||
x = 120,
|
||||
y = 121,
|
||||
z = 122,
|
||||
A = 65,
|
||||
B = 66,
|
||||
C = 67,
|
||||
D = 68,
|
||||
E = 69,
|
||||
F = 70,
|
||||
G = 71,
|
||||
H = 72,
|
||||
I = 73,
|
||||
J = 74,
|
||||
K = 75,
|
||||
L = 76,
|
||||
M = 77,
|
||||
N = 78,
|
||||
O = 79,
|
||||
P = 80,
|
||||
Q = 81,
|
||||
R = 82,
|
||||
S = 83,
|
||||
T = 84,
|
||||
U = 85,
|
||||
V = 86,
|
||||
W = 87,
|
||||
X = 88,
|
||||
Y = 89,
|
||||
Z = 90,
|
||||
ampersand = 38,
|
||||
asterisk = 42,
|
||||
at = 64,
|
||||
backslash = 92,
|
||||
backtick = 96,
|
||||
bar = 124,
|
||||
caret = 94,
|
||||
closeBrace = 125,
|
||||
closeBracket = 93,
|
||||
closeParen = 41,
|
||||
colon = 58,
|
||||
comma = 44,
|
||||
dot = 46,
|
||||
doubleQuote = 34,
|
||||
equals = 61,
|
||||
exclamation = 33,
|
||||
greaterThan = 62,
|
||||
hash = 35,
|
||||
lessThan = 60,
|
||||
minus = 45,
|
||||
openBrace = 123,
|
||||
openBracket = 91,
|
||||
openParen = 40,
|
||||
percent = 37,
|
||||
plus = 43,
|
||||
question = 63,
|
||||
semicolon = 59,
|
||||
singleQuote = 39,
|
||||
slash = 47,
|
||||
tilde = 126,
|
||||
backspace = 8,
|
||||
formFeed = 12,
|
||||
byteOrderMark = 65279,
|
||||
tab = 9,
|
||||
verticalTab = 11,
|
||||
}
|
||||
interface CancellationToken {
|
||||
isCancellationRequested(): boolean;
|
||||
}
|
||||
@@ -1400,67 +1148,78 @@ declare module "typescript" {
|
||||
}
|
||||
}
|
||||
declare module "typescript" {
|
||||
interface ErrorCallback {
|
||||
(message: DiagnosticMessage, length: number): void;
|
||||
interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
useCaseSensitiveFileNames: boolean;
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string) => void): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
createDirectory(path: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
readDirectory(path: string, extension?: string): string[];
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
interface Scanner {
|
||||
getStartPos(): number;
|
||||
getToken(): SyntaxKind;
|
||||
getTextPos(): number;
|
||||
getTokenPos(): number;
|
||||
getTokenText(): string;
|
||||
getTokenValue(): string;
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
isIdentifier(): boolean;
|
||||
isReservedWord(): boolean;
|
||||
isUnterminated(): boolean;
|
||||
reScanGreaterToken(): SyntaxKind;
|
||||
reScanSlashToken(): SyntaxKind;
|
||||
reScanTemplateToken(): SyntaxKind;
|
||||
scan(): SyntaxKind;
|
||||
setText(text: string): void;
|
||||
setTextPos(textPos: number): void;
|
||||
lookAhead<T>(callback: () => T): T;
|
||||
tryScan<T>(callback: () => T): T;
|
||||
interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
var sys: System;
|
||||
}
|
||||
declare module "typescript" {
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
function computeLineStarts(text: string): number[];
|
||||
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
|
||||
function getLineStarts(sourceFile: SourceFile): number[];
|
||||
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
|
||||
line: number;
|
||||
character: number;
|
||||
};
|
||||
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
function isWhiteSpace(ch: number): boolean;
|
||||
function isLineBreak(ch: number): boolean;
|
||||
function isOctalDigit(ch: number): boolean;
|
||||
function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number;
|
||||
function getLeadingCommentRanges(text: string, pos: number): CommentRange[];
|
||||
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
|
||||
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner;
|
||||
}
|
||||
declare module "typescript" {
|
||||
function getDefaultLibFileName(options: CompilerOptions): string;
|
||||
function textSpanEnd(span: TextSpan): number;
|
||||
function textSpanIsEmpty(span: TextSpan): boolean;
|
||||
function textSpanContainsPosition(span: TextSpan, position: number): boolean;
|
||||
function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
|
||||
function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
|
||||
function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
|
||||
function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
|
||||
function createTextSpan(start: number, length: number): TextSpan;
|
||||
function createTextSpanFromBounds(start: number, end: number): TextSpan;
|
||||
function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
|
||||
function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
|
||||
function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
|
||||
let unchangedTextChangeRange: TextChangeRange;
|
||||
/**
|
||||
* Called to merge all the changes that occurred across several versions of a script snapshot
|
||||
* into a single change. i.e. if a user keeps making successive edits to a script we will
|
||||
* have a text change from V1 to V2, V2 to V3, ..., Vn.
|
||||
*
|
||||
* This function will then merge those changes into a single change range valid between V1 and
|
||||
* Vn.
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
}
|
||||
declare module "typescript" {
|
||||
function getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
function createNode(kind: SyntaxKind): Node;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
|
||||
function modifierToFlag(token: SyntaxKind): NodeFlags;
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function isEvalOrArgumentsIdentifier(node: Node): boolean;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
|
||||
function isLeftHandSideExpression(expr: Expression): boolean;
|
||||
function isAssignmentOperator(token: SyntaxKind): boolean;
|
||||
}
|
||||
declare module "typescript" {
|
||||
function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker;
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the TypeScript compiler release */
|
||||
let version: string;
|
||||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
@@ -1468,6 +1227,7 @@ declare module "typescript" {
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
}
|
||||
declare module "typescript" {
|
||||
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
@@ -1525,7 +1285,6 @@ declare module "typescript" {
|
||||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
}
|
||||
interface SourceFile {
|
||||
getNamedDeclarations(): Declaration[];
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineStarts(): number[];
|
||||
getPositionOfLineAndCharacter(line: number, character: number): number;
|
||||
@@ -1589,8 +1348,10 @@ declare module "typescript" {
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
findReferences(fileName: string, position: number): ReferencedSymbol[];
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
|
||||
/** @deprecated */
|
||||
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
|
||||
getNavigationBarItems(fileName: string): NavigationBarItem[];
|
||||
getOutliningSpans(fileName: string): OutliningSpan[];
|
||||
@@ -1641,6 +1402,20 @@ declare module "typescript" {
|
||||
fileName: string;
|
||||
isWriteAccess: boolean;
|
||||
}
|
||||
interface DocumentHighlights {
|
||||
fileName: string;
|
||||
highlightSpans: HighlightSpan[];
|
||||
}
|
||||
module HighlightSpanKind {
|
||||
const none: string;
|
||||
const definition: string;
|
||||
const reference: string;
|
||||
const writtenReference: string;
|
||||
}
|
||||
interface HighlightSpan {
|
||||
textSpan: TextSpan;
|
||||
kind: string;
|
||||
}
|
||||
interface NavigateToItem {
|
||||
name: string;
|
||||
kind: string;
|
||||
@@ -1765,6 +1540,7 @@ declare module "typescript" {
|
||||
name: string;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
sortText: string;
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
name: string;
|
||||
@@ -1905,43 +1681,44 @@ declare module "typescript" {
|
||||
*/
|
||||
releaseDocument(fileName: string, compilationSettings: CompilerOptions): void;
|
||||
}
|
||||
class ScriptElementKind {
|
||||
static unknown: string;
|
||||
static keyword: string;
|
||||
static scriptElement: string;
|
||||
static moduleElement: string;
|
||||
static classElement: string;
|
||||
static interfaceElement: string;
|
||||
static typeElement: string;
|
||||
static enumElement: string;
|
||||
static variableElement: string;
|
||||
static localVariableElement: string;
|
||||
static functionElement: string;
|
||||
static localFunctionElement: string;
|
||||
static memberFunctionElement: string;
|
||||
static memberGetAccessorElement: string;
|
||||
static memberSetAccessorElement: string;
|
||||
static memberVariableElement: string;
|
||||
static constructorImplementationElement: string;
|
||||
static callSignatureElement: string;
|
||||
static indexSignatureElement: string;
|
||||
static constructSignatureElement: string;
|
||||
static parameterElement: string;
|
||||
static typeParameterElement: string;
|
||||
static primitiveType: string;
|
||||
static label: string;
|
||||
static alias: string;
|
||||
static constElement: string;
|
||||
static letElement: string;
|
||||
module ScriptElementKind {
|
||||
const unknown: string;
|
||||
const warning: string;
|
||||
const keyword: string;
|
||||
const scriptElement: string;
|
||||
const moduleElement: string;
|
||||
const classElement: string;
|
||||
const interfaceElement: string;
|
||||
const typeElement: string;
|
||||
const enumElement: string;
|
||||
const variableElement: string;
|
||||
const localVariableElement: string;
|
||||
const functionElement: string;
|
||||
const localFunctionElement: string;
|
||||
const memberFunctionElement: string;
|
||||
const memberGetAccessorElement: string;
|
||||
const memberSetAccessorElement: string;
|
||||
const memberVariableElement: string;
|
||||
const constructorImplementationElement: string;
|
||||
const callSignatureElement: string;
|
||||
const indexSignatureElement: string;
|
||||
const constructSignatureElement: string;
|
||||
const parameterElement: string;
|
||||
const typeParameterElement: string;
|
||||
const primitiveType: string;
|
||||
const label: string;
|
||||
const alias: string;
|
||||
const constElement: string;
|
||||
const letElement: string;
|
||||
}
|
||||
class ScriptElementKindModifier {
|
||||
static none: string;
|
||||
static publicMemberModifier: string;
|
||||
static privateMemberModifier: string;
|
||||
static protectedMemberModifier: string;
|
||||
static exportedModifier: string;
|
||||
static ambientModifier: string;
|
||||
static staticModifier: string;
|
||||
module ScriptElementKindModifier {
|
||||
const none: string;
|
||||
const publicMemberModifier: string;
|
||||
const privateMemberModifier: string;
|
||||
const protectedMemberModifier: string;
|
||||
const exportedModifier: string;
|
||||
const ambientModifier: string;
|
||||
const staticModifier: string;
|
||||
}
|
||||
class ClassificationTypeNames {
|
||||
static comment: string;
|
||||
|
||||
+14234
-7737
File diff suppressed because one or more lines are too long
Vendored
+151
-374
@@ -124,16 +124,16 @@ declare module ts {
|
||||
VoidKeyword = 99,
|
||||
WhileKeyword = 100,
|
||||
WithKeyword = 101,
|
||||
AsKeyword = 102,
|
||||
ImplementsKeyword = 103,
|
||||
InterfaceKeyword = 104,
|
||||
LetKeyword = 105,
|
||||
PackageKeyword = 106,
|
||||
PrivateKeyword = 107,
|
||||
ProtectedKeyword = 108,
|
||||
PublicKeyword = 109,
|
||||
StaticKeyword = 110,
|
||||
YieldKeyword = 111,
|
||||
ImplementsKeyword = 102,
|
||||
InterfaceKeyword = 103,
|
||||
LetKeyword = 104,
|
||||
PackageKeyword = 105,
|
||||
PrivateKeyword = 106,
|
||||
ProtectedKeyword = 107,
|
||||
PublicKeyword = 108,
|
||||
StaticKeyword = 109,
|
||||
YieldKeyword = 110,
|
||||
AsKeyword = 111,
|
||||
AnyKeyword = 112,
|
||||
BooleanKeyword = 113,
|
||||
ConstructorKeyword = 114,
|
||||
@@ -258,8 +258,8 @@ declare module ts {
|
||||
LastReservedWord = 101,
|
||||
FirstKeyword = 66,
|
||||
LastKeyword = 125,
|
||||
FirstFutureReservedWord = 103,
|
||||
LastFutureReservedWord = 111,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 141,
|
||||
LastTypeNode = 149,
|
||||
FirstPunctuation = 14,
|
||||
@@ -295,34 +295,12 @@ declare module ts {
|
||||
AccessibilityModifier = 112,
|
||||
BlockScoped = 12288,
|
||||
}
|
||||
const enum ParserContextFlags {
|
||||
StrictMode = 1,
|
||||
DisallowIn = 2,
|
||||
Yield = 4,
|
||||
GeneratorParameter = 8,
|
||||
Decorator = 16,
|
||||
ThisNodeHasError = 32,
|
||||
ParserGeneratedFlags = 63,
|
||||
ThisNodeOrAnySubNodesHasError = 64,
|
||||
HasAggregatedChildData = 128,
|
||||
}
|
||||
const enum RelationComparisonResult {
|
||||
Succeeded = 1,
|
||||
Failed = 2,
|
||||
FailedAndReported = 3,
|
||||
}
|
||||
interface Node extends TextRange {
|
||||
kind: SyntaxKind;
|
||||
flags: NodeFlags;
|
||||
parserContextFlags?: ParserContextFlags;
|
||||
decorators?: NodeArray<Decorator>;
|
||||
modifiers?: ModifiersArray;
|
||||
id?: number;
|
||||
parent?: Node;
|
||||
symbol?: Symbol;
|
||||
locals?: SymbolTable;
|
||||
nextContainer?: Node;
|
||||
localSymbol?: Symbol;
|
||||
}
|
||||
interface NodeArray<T> extends Array<T>, TextRange {
|
||||
hasTrailingComma?: boolean;
|
||||
@@ -332,6 +310,7 @@ declare module ts {
|
||||
}
|
||||
interface Identifier extends PrimaryExpression {
|
||||
text: string;
|
||||
originalKeywordKind?: SyntaxKind;
|
||||
}
|
||||
interface QualifiedName extends Node {
|
||||
left: EntityName;
|
||||
@@ -473,7 +452,8 @@ declare module ts {
|
||||
interface ParenthesizedTypeNode extends TypeNode {
|
||||
type: TypeNode;
|
||||
}
|
||||
interface StringLiteralTypeNode extends LiteralExpression, TypeNode {
|
||||
interface StringLiteral extends LiteralExpression, TypeNode {
|
||||
_stringLiteralBrand: any;
|
||||
}
|
||||
interface Expression extends Node {
|
||||
_expressionBrand: any;
|
||||
@@ -539,9 +519,6 @@ declare module ts {
|
||||
isUnterminated?: boolean;
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
}
|
||||
interface StringLiteralExpression extends LiteralExpression {
|
||||
_stringLiteralExpressionBrand: any;
|
||||
}
|
||||
interface TemplateExpression extends PrimaryExpression {
|
||||
head: LiteralExpression;
|
||||
templateSpans: NodeArray<TemplateSpan>;
|
||||
@@ -576,7 +553,7 @@ declare module ts {
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
interface HeritageClauseElement extends Node {
|
||||
interface HeritageClauseElement extends TypeNode {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
@@ -723,7 +700,7 @@ declare module ts {
|
||||
interface ExternalModuleReference extends Node {
|
||||
expression?: Expression;
|
||||
}
|
||||
interface ImportDeclaration extends Statement, ModuleElement {
|
||||
interface ImportDeclaration extends ModuleElement {
|
||||
importClause?: ImportClause;
|
||||
moduleSpecifier: Expression;
|
||||
}
|
||||
@@ -751,14 +728,14 @@ declare module ts {
|
||||
type ExportSpecifier = ImportOrExportSpecifier;
|
||||
interface ExportAssignment extends Declaration, ModuleElement {
|
||||
isExportEquals?: boolean;
|
||||
expression?: Expression;
|
||||
type?: TypeNode;
|
||||
expression: Expression;
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
fileName: string;
|
||||
}
|
||||
interface CommentRange extends TextRange {
|
||||
hasTrailingNewLine?: boolean;
|
||||
kind: SyntaxKind;
|
||||
}
|
||||
interface SourceFile extends Declaration {
|
||||
statements: NodeArray<ModuleElement>;
|
||||
@@ -772,9 +749,7 @@ declare module ts {
|
||||
amdModuleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
hasNoDefaultLib: boolean;
|
||||
externalModuleIndicator: Node;
|
||||
languageVersion: ScriptTarget;
|
||||
identifiers: Map<string>;
|
||||
}
|
||||
interface ScriptReferenceHost {
|
||||
getCompilerOptions(): CompilerOptions;
|
||||
@@ -785,6 +760,9 @@ declare module ts {
|
||||
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
|
||||
}
|
||||
interface Program extends ScriptReferenceHost {
|
||||
/**
|
||||
* Get a list of files in the program
|
||||
*/
|
||||
getSourceFiles(): SourceFile[];
|
||||
/**
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
@@ -801,15 +779,23 @@ declare module ts {
|
||||
getGlobalDiagnostics(): Diagnostic[];
|
||||
getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
/**
|
||||
* Gets a type checker that can be used to semantically analyze source fils in the program.
|
||||
*/
|
||||
getTypeChecker(): TypeChecker;
|
||||
getCommonSourceDirectory(): string;
|
||||
}
|
||||
interface SourceMapSpan {
|
||||
/** Line number in the .js file. */
|
||||
emittedLine: number;
|
||||
/** Column number in the .js file. */
|
||||
emittedColumn: number;
|
||||
/** Line number in the .ts file. */
|
||||
sourceLine: number;
|
||||
/** Column number in the .ts file. */
|
||||
sourceColumn: number;
|
||||
/** Optional name (index into names array) associated with this span. */
|
||||
nameIndex?: number;
|
||||
/** .ts file (index into sources array) associated with this span */
|
||||
sourceIndex: number;
|
||||
}
|
||||
interface SourceMapData {
|
||||
@@ -823,6 +809,7 @@ declare module ts {
|
||||
sourceMapMappings: string;
|
||||
sourceMapDecodedMappings: SourceMapSpan[];
|
||||
}
|
||||
/** Return code used by getEmitOutput function to indicate status of the function */
|
||||
enum ExitStatus {
|
||||
Success = 0,
|
||||
DiagnosticsPresent_OutputsSkipped = 1,
|
||||
@@ -831,7 +818,6 @@ declare module ts {
|
||||
interface EmitResult {
|
||||
emitSkipped: boolean;
|
||||
diagnostics: Diagnostic[];
|
||||
sourceMaps: SourceMapData[];
|
||||
}
|
||||
interface TypeCheckerHost {
|
||||
getCompilerOptions(): CompilerOptions;
|
||||
@@ -865,7 +851,7 @@ declare 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[];
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
@@ -908,40 +894,6 @@ declare module ts {
|
||||
WriteTypeParametersOrArguments = 1,
|
||||
UseOnlyExternalAliasing = 2,
|
||||
}
|
||||
const enum SymbolAccessibility {
|
||||
Accessible = 0,
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
interface SymbolAccessiblityResult extends SymbolVisibilityResult {
|
||||
errorModuleName?: string;
|
||||
}
|
||||
interface EmitResolver {
|
||||
hasGlobalName(name: string): boolean;
|
||||
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
FunctionScopedVariable = 1,
|
||||
BlockScopedVariable = 2,
|
||||
@@ -1011,57 +963,14 @@ declare module ts {
|
||||
interface Symbol {
|
||||
flags: SymbolFlags;
|
||||
name: string;
|
||||
id?: number;
|
||||
mergeId?: number;
|
||||
declarations?: Declaration[];
|
||||
parent?: Symbol;
|
||||
members?: SymbolTable;
|
||||
exports?: SymbolTable;
|
||||
exportSymbol?: Symbol;
|
||||
valueDeclaration?: Declaration;
|
||||
constEnumOnlyModule?: boolean;
|
||||
}
|
||||
interface SymbolLinks {
|
||||
target?: Symbol;
|
||||
type?: Type;
|
||||
declaredType?: Type;
|
||||
mapper?: TypeMapper;
|
||||
referenced?: boolean;
|
||||
unionType?: UnionType;
|
||||
resolvedExports?: SymbolTable;
|
||||
exportsChecked?: boolean;
|
||||
}
|
||||
interface TransientSymbol extends Symbol, SymbolLinks {
|
||||
}
|
||||
interface SymbolTable {
|
||||
[index: string]: Symbol;
|
||||
}
|
||||
const enum NodeCheckFlags {
|
||||
TypeChecked = 1,
|
||||
LexicalThis = 2,
|
||||
CaptureThis = 4,
|
||||
EmitExtends = 8,
|
||||
SuperInstance = 16,
|
||||
SuperStatic = 32,
|
||||
ContextChecked = 64,
|
||||
EnumValuesComputed = 128,
|
||||
BlockScopedBindingInLoop = 256,
|
||||
EmitDecorate = 512,
|
||||
}
|
||||
interface NodeLinks {
|
||||
resolvedType?: Type;
|
||||
resolvedSignature?: Signature;
|
||||
resolvedSymbol?: Symbol;
|
||||
flags?: NodeCheckFlags;
|
||||
enumMemberValue?: number;
|
||||
isIllegalTypeReferenceInConstraint?: boolean;
|
||||
isVisible?: boolean;
|
||||
generatedName?: string;
|
||||
generatedNames?: Map<string>;
|
||||
assignmentChecks?: Map<boolean>;
|
||||
hasReportedStatementInAmbientContext?: boolean;
|
||||
importOnRightSide?: Symbol;
|
||||
}
|
||||
const enum TypeFlags {
|
||||
Any = 1,
|
||||
String = 2,
|
||||
@@ -1079,26 +988,16 @@ declare module ts {
|
||||
Tuple = 8192,
|
||||
Union = 16384,
|
||||
Anonymous = 32768,
|
||||
FromSignature = 65536,
|
||||
ObjectLiteral = 131072,
|
||||
ContainsUndefinedOrNull = 262144,
|
||||
ContainsObjectLiteral = 524288,
|
||||
ESSymbol = 1048576,
|
||||
Intrinsic = 1048703,
|
||||
Primitive = 1049086,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 48128,
|
||||
RequiresWidening = 786432,
|
||||
}
|
||||
interface Type {
|
||||
flags: TypeFlags;
|
||||
id: number;
|
||||
symbol?: Symbol;
|
||||
}
|
||||
interface IntrinsicType extends Type {
|
||||
intrinsicName: string;
|
||||
}
|
||||
interface StringLiteralType extends Type {
|
||||
text: string;
|
||||
}
|
||||
@@ -1106,19 +1005,20 @@ declare module ts {
|
||||
}
|
||||
interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[];
|
||||
baseTypes: ObjectType[];
|
||||
declaredProperties: Symbol[];
|
||||
declaredCallSignatures: Signature[];
|
||||
declaredConstructSignatures: Signature[];
|
||||
declaredStringIndexType: Type;
|
||||
declaredNumberIndexType: Type;
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
interface TypeReference extends ObjectType {
|
||||
target: GenericType;
|
||||
typeArguments: Type[];
|
||||
}
|
||||
interface GenericType extends InterfaceType, TypeReference {
|
||||
instantiations: Map<TypeReference>;
|
||||
}
|
||||
interface TupleType extends ObjectType {
|
||||
elementTypes: Type[];
|
||||
@@ -1126,20 +1026,9 @@ declare module ts {
|
||||
}
|
||||
interface UnionType extends Type {
|
||||
types: Type[];
|
||||
resolvedProperties: SymbolTable;
|
||||
}
|
||||
interface ResolvedType extends ObjectType, UnionType {
|
||||
members: SymbolTable;
|
||||
properties: Symbol[];
|
||||
callSignatures: Signature[];
|
||||
constructSignatures: Signature[];
|
||||
stringIndexType: Type;
|
||||
numberIndexType: Type;
|
||||
}
|
||||
interface TypeParameter extends Type {
|
||||
constraint: Type;
|
||||
target?: TypeParameter;
|
||||
mapper?: TypeMapper;
|
||||
}
|
||||
const enum SignatureKind {
|
||||
Call = 0,
|
||||
@@ -1149,28 +1038,22 @@ declare module ts {
|
||||
declaration: SignatureDeclaration;
|
||||
typeParameters: TypeParameter[];
|
||||
parameters: Symbol[];
|
||||
resolvedReturnType: Type;
|
||||
minArgumentCount: number;
|
||||
hasRestParameter: boolean;
|
||||
hasStringLiterals: boolean;
|
||||
target?: Signature;
|
||||
mapper?: TypeMapper;
|
||||
unionSignatures?: Signature[];
|
||||
erasedSignatureCache?: Signature;
|
||||
isolatedSignatureType?: ObjectType;
|
||||
}
|
||||
const enum IndexKind {
|
||||
String = 0,
|
||||
Number = 1,
|
||||
}
|
||||
interface TypeMapper {
|
||||
(t: Type): Type;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
code: number;
|
||||
}
|
||||
/**
|
||||
* A linked list of formatted diagnostic messages to be used as part of a multiline message.
|
||||
* It is built from the bottom up, leaving the head to be the "main" diagnostic.
|
||||
* While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage,
|
||||
* the difference is that messages are all preformatted in DMC.
|
||||
*/
|
||||
interface DiagnosticMessageChain {
|
||||
messageText: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1219,6 +1102,7 @@ declare module ts {
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
separateCompilation?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
const enum ModuleKind {
|
||||
@@ -1241,142 +1125,6 @@ declare module ts {
|
||||
fileNames: string[];
|
||||
errors: Diagnostic[];
|
||||
}
|
||||
interface CommandLineOption {
|
||||
name: string;
|
||||
type: string | Map<number>;
|
||||
isFilePath?: boolean;
|
||||
shortName?: string;
|
||||
description?: DiagnosticMessage;
|
||||
paramType?: DiagnosticMessage;
|
||||
error?: DiagnosticMessage;
|
||||
experimental?: boolean;
|
||||
}
|
||||
const enum CharacterCodes {
|
||||
nullCharacter = 0,
|
||||
maxAsciiCharacter = 127,
|
||||
lineFeed = 10,
|
||||
carriageReturn = 13,
|
||||
lineSeparator = 8232,
|
||||
paragraphSeparator = 8233,
|
||||
nextLine = 133,
|
||||
space = 32,
|
||||
nonBreakingSpace = 160,
|
||||
enQuad = 8192,
|
||||
emQuad = 8193,
|
||||
enSpace = 8194,
|
||||
emSpace = 8195,
|
||||
threePerEmSpace = 8196,
|
||||
fourPerEmSpace = 8197,
|
||||
sixPerEmSpace = 8198,
|
||||
figureSpace = 8199,
|
||||
punctuationSpace = 8200,
|
||||
thinSpace = 8201,
|
||||
hairSpace = 8202,
|
||||
zeroWidthSpace = 8203,
|
||||
narrowNoBreakSpace = 8239,
|
||||
ideographicSpace = 12288,
|
||||
mathematicalSpace = 8287,
|
||||
ogham = 5760,
|
||||
_ = 95,
|
||||
$ = 36,
|
||||
_0 = 48,
|
||||
_1 = 49,
|
||||
_2 = 50,
|
||||
_3 = 51,
|
||||
_4 = 52,
|
||||
_5 = 53,
|
||||
_6 = 54,
|
||||
_7 = 55,
|
||||
_8 = 56,
|
||||
_9 = 57,
|
||||
a = 97,
|
||||
b = 98,
|
||||
c = 99,
|
||||
d = 100,
|
||||
e = 101,
|
||||
f = 102,
|
||||
g = 103,
|
||||
h = 104,
|
||||
i = 105,
|
||||
j = 106,
|
||||
k = 107,
|
||||
l = 108,
|
||||
m = 109,
|
||||
n = 110,
|
||||
o = 111,
|
||||
p = 112,
|
||||
q = 113,
|
||||
r = 114,
|
||||
s = 115,
|
||||
t = 116,
|
||||
u = 117,
|
||||
v = 118,
|
||||
w = 119,
|
||||
x = 120,
|
||||
y = 121,
|
||||
z = 122,
|
||||
A = 65,
|
||||
B = 66,
|
||||
C = 67,
|
||||
D = 68,
|
||||
E = 69,
|
||||
F = 70,
|
||||
G = 71,
|
||||
H = 72,
|
||||
I = 73,
|
||||
J = 74,
|
||||
K = 75,
|
||||
L = 76,
|
||||
M = 77,
|
||||
N = 78,
|
||||
O = 79,
|
||||
P = 80,
|
||||
Q = 81,
|
||||
R = 82,
|
||||
S = 83,
|
||||
T = 84,
|
||||
U = 85,
|
||||
V = 86,
|
||||
W = 87,
|
||||
X = 88,
|
||||
Y = 89,
|
||||
Z = 90,
|
||||
ampersand = 38,
|
||||
asterisk = 42,
|
||||
at = 64,
|
||||
backslash = 92,
|
||||
backtick = 96,
|
||||
bar = 124,
|
||||
caret = 94,
|
||||
closeBrace = 125,
|
||||
closeBracket = 93,
|
||||
closeParen = 41,
|
||||
colon = 58,
|
||||
comma = 44,
|
||||
dot = 46,
|
||||
doubleQuote = 34,
|
||||
equals = 61,
|
||||
exclamation = 33,
|
||||
greaterThan = 62,
|
||||
hash = 35,
|
||||
lessThan = 60,
|
||||
minus = 45,
|
||||
openBrace = 123,
|
||||
openBracket = 91,
|
||||
openParen = 40,
|
||||
percent = 37,
|
||||
plus = 43,
|
||||
question = 63,
|
||||
semicolon = 59,
|
||||
singleQuote = 39,
|
||||
slash = 47,
|
||||
tilde = 126,
|
||||
backspace = 8,
|
||||
formFeed = 12,
|
||||
byteOrderMark = 65279,
|
||||
tab = 9,
|
||||
verticalTab = 11,
|
||||
}
|
||||
interface CancellationToken {
|
||||
isCancellationRequested(): boolean;
|
||||
}
|
||||
@@ -1400,67 +1148,78 @@ declare module ts {
|
||||
}
|
||||
}
|
||||
declare module ts {
|
||||
interface ErrorCallback {
|
||||
(message: DiagnosticMessage, length: number): void;
|
||||
interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
useCaseSensitiveFileNames: boolean;
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string) => void): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
createDirectory(path: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
readDirectory(path: string, extension?: string): string[];
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
interface Scanner {
|
||||
getStartPos(): number;
|
||||
getToken(): SyntaxKind;
|
||||
getTextPos(): number;
|
||||
getTokenPos(): number;
|
||||
getTokenText(): string;
|
||||
getTokenValue(): string;
|
||||
hasExtendedUnicodeEscape(): boolean;
|
||||
hasPrecedingLineBreak(): boolean;
|
||||
isIdentifier(): boolean;
|
||||
isReservedWord(): boolean;
|
||||
isUnterminated(): boolean;
|
||||
reScanGreaterToken(): SyntaxKind;
|
||||
reScanSlashToken(): SyntaxKind;
|
||||
reScanTemplateToken(): SyntaxKind;
|
||||
scan(): SyntaxKind;
|
||||
setText(text: string): void;
|
||||
setTextPos(textPos: number): void;
|
||||
lookAhead<T>(callback: () => T): T;
|
||||
tryScan<T>(callback: () => T): T;
|
||||
interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
var sys: System;
|
||||
}
|
||||
declare module ts {
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
function computeLineStarts(text: string): number[];
|
||||
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number;
|
||||
function getLineStarts(sourceFile: SourceFile): number[];
|
||||
function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): {
|
||||
line: number;
|
||||
character: number;
|
||||
};
|
||||
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
function isWhiteSpace(ch: number): boolean;
|
||||
function isLineBreak(ch: number): boolean;
|
||||
function isOctalDigit(ch: number): boolean;
|
||||
function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number;
|
||||
function getLeadingCommentRanges(text: string, pos: number): CommentRange[];
|
||||
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
|
||||
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
|
||||
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner;
|
||||
}
|
||||
declare module ts {
|
||||
function getDefaultLibFileName(options: CompilerOptions): string;
|
||||
function textSpanEnd(span: TextSpan): number;
|
||||
function textSpanIsEmpty(span: TextSpan): boolean;
|
||||
function textSpanContainsPosition(span: TextSpan, position: number): boolean;
|
||||
function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
|
||||
function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
|
||||
function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
|
||||
function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
|
||||
function createTextSpan(start: number, length: number): TextSpan;
|
||||
function createTextSpanFromBounds(start: number, end: number): TextSpan;
|
||||
function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
|
||||
function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
|
||||
function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
|
||||
let unchangedTextChangeRange: TextChangeRange;
|
||||
/**
|
||||
* Called to merge all the changes that occurred across several versions of a script snapshot
|
||||
* into a single change. i.e. if a user keeps making successive edits to a script we will
|
||||
* have a text change from V1 to V2, V2 to V3, ..., Vn.
|
||||
*
|
||||
* This function will then merge those changes into a single change range valid between V1 and
|
||||
* Vn.
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
}
|
||||
declare module ts {
|
||||
function getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
function createNode(kind: SyntaxKind): Node;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
|
||||
function modifierToFlag(token: SyntaxKind): NodeFlags;
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function isEvalOrArgumentsIdentifier(node: Node): boolean;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
|
||||
function isLeftHandSideExpression(expr: Expression): boolean;
|
||||
function isAssignmentOperator(token: SyntaxKind): boolean;
|
||||
}
|
||||
declare module ts {
|
||||
function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker;
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
}
|
||||
declare module ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
let version: string;
|
||||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
@@ -1468,6 +1227,7 @@ declare module ts {
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
}
|
||||
declare module ts {
|
||||
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
@@ -1525,7 +1285,6 @@ declare module ts {
|
||||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
}
|
||||
interface SourceFile {
|
||||
getNamedDeclarations(): Declaration[];
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
getLineStarts(): number[];
|
||||
getPositionOfLineAndCharacter(line: number, character: number): number;
|
||||
@@ -1589,8 +1348,10 @@ declare module ts {
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
findReferences(fileName: string, position: number): ReferencedSymbol[];
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
|
||||
/** @deprecated */
|
||||
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
|
||||
getNavigationBarItems(fileName: string): NavigationBarItem[];
|
||||
getOutliningSpans(fileName: string): OutliningSpan[];
|
||||
@@ -1641,6 +1402,20 @@ declare module ts {
|
||||
fileName: string;
|
||||
isWriteAccess: boolean;
|
||||
}
|
||||
interface DocumentHighlights {
|
||||
fileName: string;
|
||||
highlightSpans: HighlightSpan[];
|
||||
}
|
||||
module HighlightSpanKind {
|
||||
const none: string;
|
||||
const definition: string;
|
||||
const reference: string;
|
||||
const writtenReference: string;
|
||||
}
|
||||
interface HighlightSpan {
|
||||
textSpan: TextSpan;
|
||||
kind: string;
|
||||
}
|
||||
interface NavigateToItem {
|
||||
name: string;
|
||||
kind: string;
|
||||
@@ -1765,6 +1540,7 @@ declare module ts {
|
||||
name: string;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
sortText: string;
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
name: string;
|
||||
@@ -1905,43 +1681,44 @@ declare module ts {
|
||||
*/
|
||||
releaseDocument(fileName: string, compilationSettings: CompilerOptions): void;
|
||||
}
|
||||
class ScriptElementKind {
|
||||
static unknown: string;
|
||||
static keyword: string;
|
||||
static scriptElement: string;
|
||||
static moduleElement: string;
|
||||
static classElement: string;
|
||||
static interfaceElement: string;
|
||||
static typeElement: string;
|
||||
static enumElement: string;
|
||||
static variableElement: string;
|
||||
static localVariableElement: string;
|
||||
static functionElement: string;
|
||||
static localFunctionElement: string;
|
||||
static memberFunctionElement: string;
|
||||
static memberGetAccessorElement: string;
|
||||
static memberSetAccessorElement: string;
|
||||
static memberVariableElement: string;
|
||||
static constructorImplementationElement: string;
|
||||
static callSignatureElement: string;
|
||||
static indexSignatureElement: string;
|
||||
static constructSignatureElement: string;
|
||||
static parameterElement: string;
|
||||
static typeParameterElement: string;
|
||||
static primitiveType: string;
|
||||
static label: string;
|
||||
static alias: string;
|
||||
static constElement: string;
|
||||
static letElement: string;
|
||||
module ScriptElementKind {
|
||||
const unknown: string;
|
||||
const warning: string;
|
||||
const keyword: string;
|
||||
const scriptElement: string;
|
||||
const moduleElement: string;
|
||||
const classElement: string;
|
||||
const interfaceElement: string;
|
||||
const typeElement: string;
|
||||
const enumElement: string;
|
||||
const variableElement: string;
|
||||
const localVariableElement: string;
|
||||
const functionElement: string;
|
||||
const localFunctionElement: string;
|
||||
const memberFunctionElement: string;
|
||||
const memberGetAccessorElement: string;
|
||||
const memberSetAccessorElement: string;
|
||||
const memberVariableElement: string;
|
||||
const constructorImplementationElement: string;
|
||||
const callSignatureElement: string;
|
||||
const indexSignatureElement: string;
|
||||
const constructSignatureElement: string;
|
||||
const parameterElement: string;
|
||||
const typeParameterElement: string;
|
||||
const primitiveType: string;
|
||||
const label: string;
|
||||
const alias: string;
|
||||
const constElement: string;
|
||||
const letElement: string;
|
||||
}
|
||||
class ScriptElementKindModifier {
|
||||
static none: string;
|
||||
static publicMemberModifier: string;
|
||||
static privateMemberModifier: string;
|
||||
static protectedMemberModifier: string;
|
||||
static exportedModifier: string;
|
||||
static ambientModifier: string;
|
||||
static staticModifier: string;
|
||||
module ScriptElementKindModifier {
|
||||
const none: string;
|
||||
const publicMemberModifier: string;
|
||||
const privateMemberModifier: string;
|
||||
const protectedMemberModifier: string;
|
||||
const exportedModifier: string;
|
||||
const ambientModifier: string;
|
||||
const staticModifier: string;
|
||||
}
|
||||
class ClassificationTypeNames {
|
||||
static comment: string;
|
||||
|
||||
+14234
-7737
File diff suppressed because one or more lines are too long
Vendored
-399
@@ -1,399 +0,0 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
declare module ts {
|
||||
const enum Ternary {
|
||||
False = 0,
|
||||
Maybe = 1,
|
||||
True = -1,
|
||||
}
|
||||
const enum Comparison {
|
||||
LessThan = -1,
|
||||
EqualTo = 0,
|
||||
GreaterThan = 1,
|
||||
}
|
||||
interface StringSet extends Map<any> {
|
||||
}
|
||||
function forEach<T, U>(array: T[], callback: (element: T, index: number) => U): U;
|
||||
function contains<T>(array: T[], value: T): boolean;
|
||||
function indexOf<T>(array: T[], value: T): number;
|
||||
function countWhere<T>(array: T[], predicate: (x: T) => boolean): number;
|
||||
function filter<T>(array: T[], f: (x: T) => boolean): T[];
|
||||
function map<T, U>(array: T[], f: (x: T) => U): U[];
|
||||
function concatenate<T>(array1: T[], array2: T[]): T[];
|
||||
function deduplicate<T>(array: T[]): T[];
|
||||
function sum(array: any[], prop: string): number;
|
||||
function addRange<T>(to: T[], from: T[]): void;
|
||||
/**
|
||||
* Returns the last element of an array if non-empty, undefined otherwise.
|
||||
*/
|
||||
function lastOrUndefined<T>(array: T[]): T;
|
||||
function binarySearch(array: number[], value: number): number;
|
||||
function reduceLeft<T>(array: T[], f: (a: T, x: T) => T): T;
|
||||
function reduceLeft<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
|
||||
function reduceRight<T>(array: T[], f: (a: T, x: T) => T): T;
|
||||
function reduceRight<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
|
||||
function hasProperty<T>(map: Map<T>, key: string): boolean;
|
||||
function getProperty<T>(map: Map<T>, key: string): T;
|
||||
function isEmpty<T>(map: Map<T>): boolean;
|
||||
function clone<T>(object: T): T;
|
||||
function extend<T>(first: Map<T>, second: Map<T>): Map<T>;
|
||||
function forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
|
||||
function forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
|
||||
function lookUp<T>(map: Map<T>, key: string): T;
|
||||
function copyMap<T>(source: Map<T>, target: Map<T>): void;
|
||||
/**
|
||||
* Creates a map from the elements of an array.
|
||||
*
|
||||
* @param array the array of input elements.
|
||||
* @param makeKey a function that produces a key for a given element.
|
||||
*
|
||||
* This function makes no effort to avoid collisions; if any two elements produce
|
||||
* the same key with the given 'makeKey' function, then the element with the higher
|
||||
* index in the array will be the one associated with the produced key.
|
||||
*/
|
||||
function arrayToMap<T>(array: T[], makeKey: (value: T) => string): Map<T>;
|
||||
let localizedDiagnosticMessages: Map<string>;
|
||||
function getLocaleSpecificMessage(message: string): string;
|
||||
function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic;
|
||||
function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic;
|
||||
function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain;
|
||||
function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain;
|
||||
function compareValues<T>(a: T, b: T): Comparison;
|
||||
function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): Comparison;
|
||||
function sortAndDeduplicateDiagnostics(diagnostics: Diagnostic[]): Diagnostic[];
|
||||
function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[];
|
||||
function normalizeSlashes(path: string): string;
|
||||
function getRootLength(path: string): number;
|
||||
let directorySeparator: string;
|
||||
function normalizePath(path: string): string;
|
||||
function getDirectoryPath(path: string): string;
|
||||
function isUrl(path: string): boolean;
|
||||
function isRootedDiskPath(path: string): boolean;
|
||||
function getNormalizedPathComponents(path: string, currentDirectory: string): string[];
|
||||
function getNormalizedAbsolutePath(fileName: string, currentDirectory: string): string;
|
||||
function getNormalizedPathFromPathComponents(pathComponents: string[]): string;
|
||||
function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean): string;
|
||||
function getBaseFileName(path: string): string;
|
||||
function combinePaths(path1: string, path2: string): string;
|
||||
function fileExtensionIs(path: string, extension: string): boolean;
|
||||
function removeFileExtension(path: string): string;
|
||||
function getDefaultLibFileName(options: CompilerOptions): string;
|
||||
interface ObjectAllocator {
|
||||
getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
|
||||
getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type;
|
||||
getSignatureConstructor(): new (checker: TypeChecker) => Signature;
|
||||
}
|
||||
let objectAllocator: ObjectAllocator;
|
||||
const enum AssertionLevel {
|
||||
None = 0,
|
||||
Normal = 1,
|
||||
Aggressive = 2,
|
||||
VeryAggressive = 3,
|
||||
}
|
||||
module Debug {
|
||||
function shouldAssert(level: AssertionLevel): boolean;
|
||||
function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void;
|
||||
function fail(message?: string): void;
|
||||
}
|
||||
}
|
||||
declare module ts {
|
||||
interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
useCaseSensitiveFileNames: boolean;
|
||||
write(s: string): void;
|
||||
readFile(fileName: string, encoding?: string): string;
|
||||
writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(fileName: string, callback: (fileName: string) => void): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
createDirectory(directoryName: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
readDirectory(path: string, extension?: string): string[];
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
var sys: System;
|
||||
}
|
||||
declare module ts {
|
||||
interface ReferencePathMatchResult {
|
||||
fileReference?: FileReference;
|
||||
diagnosticMessage?: DiagnosticMessage;
|
||||
isNoDefaultLib?: boolean;
|
||||
}
|
||||
interface SynthesizedNode extends Node {
|
||||
leadingCommentRanges?: CommentRange[];
|
||||
trailingCommentRanges?: CommentRange[];
|
||||
startsOnNewLine: boolean;
|
||||
}
|
||||
function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration;
|
||||
interface StringSymbolWriter extends SymbolWriter {
|
||||
string(): string;
|
||||
}
|
||||
interface EmitHost extends ScriptReferenceHost {
|
||||
getSourceFiles(): SourceFile[];
|
||||
getCommonSourceDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
getNewLine(): string;
|
||||
writeFile: WriteFileCallback;
|
||||
}
|
||||
function getSingleLineStringWriter(): StringSymbolWriter;
|
||||
function releaseStringWriter(writer: StringSymbolWriter): void;
|
||||
function getFullWidth(node: Node): number;
|
||||
function containsParseError(node: Node): boolean;
|
||||
function getSourceFileOfNode(node: Node): SourceFile;
|
||||
function getStartPositionOfLine(line: number, sourceFile: SourceFile): number;
|
||||
function nodePosToString(node: Node): string;
|
||||
function getStartPosOfNode(node: Node): number;
|
||||
function nodeIsMissing(node: Node): boolean;
|
||||
function nodeIsPresent(node: Node): boolean;
|
||||
function getTokenPosOfNode(node: Node, sourceFile?: SourceFile): number;
|
||||
function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node): string;
|
||||
function getTextOfNodeFromSourceText(sourceText: string, node: Node): string;
|
||||
function getTextOfNode(node: Node): string;
|
||||
function escapeIdentifier(identifier: string): string;
|
||||
function unescapeIdentifier(identifier: string): string;
|
||||
function makeIdentifierFromModuleName(moduleName: string): string;
|
||||
function isBlockOrCatchScoped(declaration: Declaration): boolean;
|
||||
function getEnclosingBlockScopeContainer(node: Node): Node;
|
||||
function isCatchClauseVariableDeclaration(declaration: Declaration): boolean;
|
||||
function declarationNameToString(name: DeclarationName): string;
|
||||
function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic;
|
||||
function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): Diagnostic;
|
||||
function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan;
|
||||
function isExternalModule(file: SourceFile): boolean;
|
||||
function isDeclarationFile(file: SourceFile): boolean;
|
||||
function isConstEnumDeclaration(node: Node): boolean;
|
||||
function getCombinedNodeFlags(node: Node): NodeFlags;
|
||||
function isConst(node: Node): boolean;
|
||||
function isLet(node: Node): boolean;
|
||||
function isPrologueDirective(node: Node): boolean;
|
||||
function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
|
||||
function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
|
||||
let fullTripleSlashReferencePathRegEx: RegExp;
|
||||
function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T;
|
||||
function isFunctionLike(node: Node): boolean;
|
||||
function isFunctionBlock(node: Node): boolean;
|
||||
function isObjectLiteralMethod(node: Node): boolean;
|
||||
function getContainingFunction(node: Node): FunctionLikeDeclaration;
|
||||
function getThisContainer(node: Node, includeArrowFunctions: boolean): Node;
|
||||
function getSuperContainer(node: Node, includeFunctions: boolean): Node;
|
||||
function getInvokedExpression(node: CallLikeExpression): Expression;
|
||||
function nodeCanBeDecorated(node: Node): boolean;
|
||||
function nodeIsDecorated(node: Node): boolean;
|
||||
function childIsDecorated(node: Node): boolean;
|
||||
function nodeOrChildIsDecorated(node: Node): boolean;
|
||||
function isExpression(node: Node): boolean;
|
||||
function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean;
|
||||
function isExternalModuleImportEqualsDeclaration(node: Node): boolean;
|
||||
function getExternalModuleImportEqualsDeclarationExpression(node: Node): Expression;
|
||||
function isInternalModuleImportEqualsDeclaration(node: Node): boolean;
|
||||
function getExternalModuleName(node: Node): Expression;
|
||||
function hasDotDotDotToken(node: Node): boolean;
|
||||
function hasQuestionToken(node: Node): boolean;
|
||||
function hasRestParameters(s: SignatureDeclaration): boolean;
|
||||
function isLiteralKind(kind: SyntaxKind): boolean;
|
||||
function isTextualLiteralKind(kind: SyntaxKind): boolean;
|
||||
function isTemplateLiteralKind(kind: SyntaxKind): boolean;
|
||||
function isBindingPattern(node: Node): boolean;
|
||||
function isInAmbientContext(node: Node): boolean;
|
||||
function isDeclaration(node: Node): boolean;
|
||||
function isStatement(n: Node): boolean;
|
||||
function isClassElement(n: Node): boolean;
|
||||
function isDeclarationName(name: Node): boolean;
|
||||
function isAliasSymbolDeclaration(node: Node): boolean;
|
||||
function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration): HeritageClauseElement;
|
||||
function getClassImplementsHeritageClauseElements(node: ClassDeclaration): NodeArray<HeritageClauseElement>;
|
||||
function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray<HeritageClauseElement>;
|
||||
function getHeritageClause(clauses: NodeArray<HeritageClause>, kind: SyntaxKind): HeritageClause;
|
||||
function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile;
|
||||
function getAncestor(node: Node, kind: SyntaxKind): Node;
|
||||
function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult;
|
||||
function isKeyword(token: SyntaxKind): boolean;
|
||||
function isTrivia(token: SyntaxKind): boolean;
|
||||
/**
|
||||
* A declaration has a dynamic name if both of the following are true:
|
||||
* 1. The declaration has a computed property name
|
||||
* 2. The computed name is *not* expressed as Symbol.<name>, where name
|
||||
* is a property of the Symbol constructor that denotes a built in
|
||||
* Symbol.
|
||||
*/
|
||||
function hasDynamicName(declaration: Declaration): boolean;
|
||||
/**
|
||||
* Checks if the expression is of the form:
|
||||
* Symbol.name
|
||||
* where Symbol is literally the word "Symbol", and name is any identifierName
|
||||
*/
|
||||
function isWellKnownSymbolSyntactically(node: Expression): boolean;
|
||||
function getPropertyNameForPropertyNameNode(name: DeclarationName): string;
|
||||
function getPropertyNameForKnownSymbolName(symbolName: string): string;
|
||||
/**
|
||||
* Includes the word "Symbol" with unicode escapes
|
||||
*/
|
||||
function isESSymbolIdentifier(node: Node): boolean;
|
||||
function isModifier(token: SyntaxKind): boolean;
|
||||
function textSpanEnd(span: TextSpan): number;
|
||||
function textSpanIsEmpty(span: TextSpan): boolean;
|
||||
function textSpanContainsPosition(span: TextSpan, position: number): boolean;
|
||||
function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
|
||||
function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
|
||||
function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
|
||||
function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
|
||||
function createTextSpan(start: number, length: number): TextSpan;
|
||||
function createTextSpanFromBounds(start: number, end: number): TextSpan;
|
||||
function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
|
||||
function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
|
||||
function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
|
||||
let unchangedTextChangeRange: TextChangeRange;
|
||||
/**
|
||||
* Called to merge all the changes that occurred across several versions of a script snapshot
|
||||
* into a single change. i.e. if a user keeps making successive edits to a script we will
|
||||
* have a text change from V1 to V2, V2 to V3, ..., Vn.
|
||||
*
|
||||
* This function will then merge those changes into a single change range valid between V1 and
|
||||
* Vn.
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function nodeStartsNewLexicalEnvironment(n: Node): boolean;
|
||||
function nodeIsSynthesized(node: Node): boolean;
|
||||
function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node;
|
||||
/**
|
||||
* Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2),
|
||||
* but augmented for a few select characters (e.g. lineSeparator, paragraphSeparator, nextLine)
|
||||
* Note that this doesn't actually wrap the input in double quotes.
|
||||
*/
|
||||
function escapeString(s: string): string;
|
||||
function escapeNonAsciiCharacters(s: string): string;
|
||||
interface EmitTextWriter {
|
||||
write(s: string): void;
|
||||
writeTextOfNode(sourceFile: SourceFile, node: Node): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
decreaseIndent(): void;
|
||||
getText(): string;
|
||||
rawWrite(s: string): void;
|
||||
writeLiteral(s: string): void;
|
||||
getTextPos(): number;
|
||||
getLine(): number;
|
||||
getColumn(): number;
|
||||
getIndent(): number;
|
||||
}
|
||||
function getIndentString(level: number): string;
|
||||
function getIndentSize(): number;
|
||||
function createTextWriter(newLine: String): EmitTextWriter;
|
||||
function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string): string;
|
||||
function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string;
|
||||
function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean): void;
|
||||
function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number;
|
||||
function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration;
|
||||
function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean;
|
||||
function getAllAccessorDeclarations(declarations: NodeArray<Declaration>, accessor: AccessorDeclaration): {
|
||||
firstAccessor: AccessorDeclaration;
|
||||
secondAccessor: AccessorDeclaration;
|
||||
getAccessor: AccessorDeclaration;
|
||||
setAccessor: AccessorDeclaration;
|
||||
};
|
||||
function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void;
|
||||
function emitComments(currentSourceFile: SourceFile, writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void): void;
|
||||
function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string): void;
|
||||
function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean;
|
||||
function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean;
|
||||
function getLocalSymbolForExportDefault(symbol: Symbol): Symbol;
|
||||
}
|
||||
declare module ts {
|
||||
/**
|
||||
* 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 {
|
||||
interface ListItemInfo {
|
||||
listItemIndex: number;
|
||||
list: Node;
|
||||
}
|
||||
function getEndLinePosition(line: number, sourceFile: SourceFile): number;
|
||||
function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number;
|
||||
function rangeContainsRange(r1: TextRange, r2: TextRange): boolean;
|
||||
function startEndContainsRange(start: number, end: number, range: TextRange): boolean;
|
||||
function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean;
|
||||
function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean;
|
||||
function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean;
|
||||
function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean;
|
||||
function isCompletedNode(n: Node, sourceFile: SourceFile): boolean;
|
||||
function findListItemInfo(node: Node): ListItemInfo;
|
||||
function hasChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): boolean;
|
||||
function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node;
|
||||
function findContainingList(node: Node): Node;
|
||||
function getTouchingWord(sourceFile: SourceFile, position: number): Node;
|
||||
function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node;
|
||||
/** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */
|
||||
function getTouchingToken(sourceFile: SourceFile, position: number, includeItemAtEndPosition?: (n: Node) => boolean): Node;
|
||||
/** Returns a token if position is in [start-of-leading-trivia, end) */
|
||||
function getTokenAtPosition(sourceFile: SourceFile, position: number): Node;
|
||||
/**
|
||||
* The token on the left of the position is the token that strictly includes the position
|
||||
* or sits to the left of the cursor if it is on a boundary. For example
|
||||
*
|
||||
* fo|o -> will return foo
|
||||
* foo <comment> |bar -> will return foo
|
||||
*
|
||||
*/
|
||||
function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node;
|
||||
function findNextToken(previousToken: Node, parent: Node): Node;
|
||||
function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node): Node;
|
||||
function getNodeModifiers(node: Node): string;
|
||||
function getTypeArgumentOrTypeParameterList(node: Node): NodeArray<Node>;
|
||||
function isToken(n: Node): boolean;
|
||||
function isWord(kind: SyntaxKind): boolean;
|
||||
function isComment(kind: SyntaxKind): boolean;
|
||||
function isPunctuation(kind: SyntaxKind): boolean;
|
||||
function isInsideTemplateLiteral(node: LiteralExpression, position: number): boolean;
|
||||
function isAccessibilityModifier(kind: SyntaxKind): boolean;
|
||||
function compareDataObjects(dst: any, src: any): boolean;
|
||||
}
|
||||
declare module ts {
|
||||
function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean;
|
||||
function symbolPart(text: string, symbol: Symbol): SymbolDisplayPart;
|
||||
function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart;
|
||||
function spacePart(): SymbolDisplayPart;
|
||||
function keywordPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function punctuationPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function operatorPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function textOrKeywordPart(text: string): SymbolDisplayPart;
|
||||
function textPart(text: string): SymbolDisplayPart;
|
||||
function lineBreakPart(): SymbolDisplayPart;
|
||||
function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[];
|
||||
function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[];
|
||||
function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[];
|
||||
function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[];
|
||||
}
|
||||
Vendored
-399
@@ -1,399 +0,0 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
declare module "typescript" {
|
||||
const enum Ternary {
|
||||
False = 0,
|
||||
Maybe = 1,
|
||||
True = -1,
|
||||
}
|
||||
const enum Comparison {
|
||||
LessThan = -1,
|
||||
EqualTo = 0,
|
||||
GreaterThan = 1,
|
||||
}
|
||||
interface StringSet extends Map<any> {
|
||||
}
|
||||
function forEach<T, U>(array: T[], callback: (element: T, index: number) => U): U;
|
||||
function contains<T>(array: T[], value: T): boolean;
|
||||
function indexOf<T>(array: T[], value: T): number;
|
||||
function countWhere<T>(array: T[], predicate: (x: T) => boolean): number;
|
||||
function filter<T>(array: T[], f: (x: T) => boolean): T[];
|
||||
function map<T, U>(array: T[], f: (x: T) => U): U[];
|
||||
function concatenate<T>(array1: T[], array2: T[]): T[];
|
||||
function deduplicate<T>(array: T[]): T[];
|
||||
function sum(array: any[], prop: string): number;
|
||||
function addRange<T>(to: T[], from: T[]): void;
|
||||
/**
|
||||
* Returns the last element of an array if non-empty, undefined otherwise.
|
||||
*/
|
||||
function lastOrUndefined<T>(array: T[]): T;
|
||||
function binarySearch(array: number[], value: number): number;
|
||||
function reduceLeft<T>(array: T[], f: (a: T, x: T) => T): T;
|
||||
function reduceLeft<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
|
||||
function reduceRight<T>(array: T[], f: (a: T, x: T) => T): T;
|
||||
function reduceRight<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
|
||||
function hasProperty<T>(map: Map<T>, key: string): boolean;
|
||||
function getProperty<T>(map: Map<T>, key: string): T;
|
||||
function isEmpty<T>(map: Map<T>): boolean;
|
||||
function clone<T>(object: T): T;
|
||||
function extend<T>(first: Map<T>, second: Map<T>): Map<T>;
|
||||
function forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
|
||||
function forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
|
||||
function lookUp<T>(map: Map<T>, key: string): T;
|
||||
function copyMap<T>(source: Map<T>, target: Map<T>): void;
|
||||
/**
|
||||
* Creates a map from the elements of an array.
|
||||
*
|
||||
* @param array the array of input elements.
|
||||
* @param makeKey a function that produces a key for a given element.
|
||||
*
|
||||
* This function makes no effort to avoid collisions; if any two elements produce
|
||||
* the same key with the given 'makeKey' function, then the element with the higher
|
||||
* index in the array will be the one associated with the produced key.
|
||||
*/
|
||||
function arrayToMap<T>(array: T[], makeKey: (value: T) => string): Map<T>;
|
||||
let localizedDiagnosticMessages: Map<string>;
|
||||
function getLocaleSpecificMessage(message: string): string;
|
||||
function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic;
|
||||
function createCompilerDiagnostic(message: DiagnosticMessage, ...args: any[]): Diagnostic;
|
||||
function chainDiagnosticMessages(details: DiagnosticMessageChain, message: DiagnosticMessage, ...args: any[]): DiagnosticMessageChain;
|
||||
function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain;
|
||||
function compareValues<T>(a: T, b: T): Comparison;
|
||||
function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): Comparison;
|
||||
function sortAndDeduplicateDiagnostics(diagnostics: Diagnostic[]): Diagnostic[];
|
||||
function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[];
|
||||
function normalizeSlashes(path: string): string;
|
||||
function getRootLength(path: string): number;
|
||||
let directorySeparator: string;
|
||||
function normalizePath(path: string): string;
|
||||
function getDirectoryPath(path: string): string;
|
||||
function isUrl(path: string): boolean;
|
||||
function isRootedDiskPath(path: string): boolean;
|
||||
function getNormalizedPathComponents(path: string, currentDirectory: string): string[];
|
||||
function getNormalizedAbsolutePath(fileName: string, currentDirectory: string): string;
|
||||
function getNormalizedPathFromPathComponents(pathComponents: string[]): string;
|
||||
function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean): string;
|
||||
function getBaseFileName(path: string): string;
|
||||
function combinePaths(path1: string, path2: string): string;
|
||||
function fileExtensionIs(path: string, extension: string): boolean;
|
||||
function removeFileExtension(path: string): string;
|
||||
function getDefaultLibFileName(options: CompilerOptions): string;
|
||||
interface ObjectAllocator {
|
||||
getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
|
||||
getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type;
|
||||
getSignatureConstructor(): new (checker: TypeChecker) => Signature;
|
||||
}
|
||||
let objectAllocator: ObjectAllocator;
|
||||
const enum AssertionLevel {
|
||||
None = 0,
|
||||
Normal = 1,
|
||||
Aggressive = 2,
|
||||
VeryAggressive = 3,
|
||||
}
|
||||
module Debug {
|
||||
function shouldAssert(level: AssertionLevel): boolean;
|
||||
function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void;
|
||||
function fail(message?: string): void;
|
||||
}
|
||||
}
|
||||
declare module "typescript" {
|
||||
interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
useCaseSensitiveFileNames: boolean;
|
||||
write(s: string): void;
|
||||
readFile(fileName: string, encoding?: string): string;
|
||||
writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(fileName: string, callback: (fileName: string) => void): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
createDirectory(directoryName: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
readDirectory(path: string, extension?: string): string[];
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
var sys: System;
|
||||
}
|
||||
declare module "typescript" {
|
||||
interface ReferencePathMatchResult {
|
||||
fileReference?: FileReference;
|
||||
diagnosticMessage?: DiagnosticMessage;
|
||||
isNoDefaultLib?: boolean;
|
||||
}
|
||||
interface SynthesizedNode extends Node {
|
||||
leadingCommentRanges?: CommentRange[];
|
||||
trailingCommentRanges?: CommentRange[];
|
||||
startsOnNewLine: boolean;
|
||||
}
|
||||
function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration;
|
||||
interface StringSymbolWriter extends SymbolWriter {
|
||||
string(): string;
|
||||
}
|
||||
interface EmitHost extends ScriptReferenceHost {
|
||||
getSourceFiles(): SourceFile[];
|
||||
getCommonSourceDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
getNewLine(): string;
|
||||
writeFile: WriteFileCallback;
|
||||
}
|
||||
function getSingleLineStringWriter(): StringSymbolWriter;
|
||||
function releaseStringWriter(writer: StringSymbolWriter): void;
|
||||
function getFullWidth(node: Node): number;
|
||||
function containsParseError(node: Node): boolean;
|
||||
function getSourceFileOfNode(node: Node): SourceFile;
|
||||
function getStartPositionOfLine(line: number, sourceFile: SourceFile): number;
|
||||
function nodePosToString(node: Node): string;
|
||||
function getStartPosOfNode(node: Node): number;
|
||||
function nodeIsMissing(node: Node): boolean;
|
||||
function nodeIsPresent(node: Node): boolean;
|
||||
function getTokenPosOfNode(node: Node, sourceFile?: SourceFile): number;
|
||||
function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node): string;
|
||||
function getTextOfNodeFromSourceText(sourceText: string, node: Node): string;
|
||||
function getTextOfNode(node: Node): string;
|
||||
function escapeIdentifier(identifier: string): string;
|
||||
function unescapeIdentifier(identifier: string): string;
|
||||
function makeIdentifierFromModuleName(moduleName: string): string;
|
||||
function isBlockOrCatchScoped(declaration: Declaration): boolean;
|
||||
function getEnclosingBlockScopeContainer(node: Node): Node;
|
||||
function isCatchClauseVariableDeclaration(declaration: Declaration): boolean;
|
||||
function declarationNameToString(name: DeclarationName): string;
|
||||
function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic;
|
||||
function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): Diagnostic;
|
||||
function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan;
|
||||
function isExternalModule(file: SourceFile): boolean;
|
||||
function isDeclarationFile(file: SourceFile): boolean;
|
||||
function isConstEnumDeclaration(node: Node): boolean;
|
||||
function getCombinedNodeFlags(node: Node): NodeFlags;
|
||||
function isConst(node: Node): boolean;
|
||||
function isLet(node: Node): boolean;
|
||||
function isPrologueDirective(node: Node): boolean;
|
||||
function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
|
||||
function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
|
||||
let fullTripleSlashReferencePathRegEx: RegExp;
|
||||
function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T;
|
||||
function isFunctionLike(node: Node): boolean;
|
||||
function isFunctionBlock(node: Node): boolean;
|
||||
function isObjectLiteralMethod(node: Node): boolean;
|
||||
function getContainingFunction(node: Node): FunctionLikeDeclaration;
|
||||
function getThisContainer(node: Node, includeArrowFunctions: boolean): Node;
|
||||
function getSuperContainer(node: Node, includeFunctions: boolean): Node;
|
||||
function getInvokedExpression(node: CallLikeExpression): Expression;
|
||||
function nodeCanBeDecorated(node: Node): boolean;
|
||||
function nodeIsDecorated(node: Node): boolean;
|
||||
function childIsDecorated(node: Node): boolean;
|
||||
function nodeOrChildIsDecorated(node: Node): boolean;
|
||||
function isExpression(node: Node): boolean;
|
||||
function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean;
|
||||
function isExternalModuleImportEqualsDeclaration(node: Node): boolean;
|
||||
function getExternalModuleImportEqualsDeclarationExpression(node: Node): Expression;
|
||||
function isInternalModuleImportEqualsDeclaration(node: Node): boolean;
|
||||
function getExternalModuleName(node: Node): Expression;
|
||||
function hasDotDotDotToken(node: Node): boolean;
|
||||
function hasQuestionToken(node: Node): boolean;
|
||||
function hasRestParameters(s: SignatureDeclaration): boolean;
|
||||
function isLiteralKind(kind: SyntaxKind): boolean;
|
||||
function isTextualLiteralKind(kind: SyntaxKind): boolean;
|
||||
function isTemplateLiteralKind(kind: SyntaxKind): boolean;
|
||||
function isBindingPattern(node: Node): boolean;
|
||||
function isInAmbientContext(node: Node): boolean;
|
||||
function isDeclaration(node: Node): boolean;
|
||||
function isStatement(n: Node): boolean;
|
||||
function isClassElement(n: Node): boolean;
|
||||
function isDeclarationName(name: Node): boolean;
|
||||
function isAliasSymbolDeclaration(node: Node): boolean;
|
||||
function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration): HeritageClauseElement;
|
||||
function getClassImplementsHeritageClauseElements(node: ClassDeclaration): NodeArray<HeritageClauseElement>;
|
||||
function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray<HeritageClauseElement>;
|
||||
function getHeritageClause(clauses: NodeArray<HeritageClause>, kind: SyntaxKind): HeritageClause;
|
||||
function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile;
|
||||
function getAncestor(node: Node, kind: SyntaxKind): Node;
|
||||
function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult;
|
||||
function isKeyword(token: SyntaxKind): boolean;
|
||||
function isTrivia(token: SyntaxKind): boolean;
|
||||
/**
|
||||
* A declaration has a dynamic name if both of the following are true:
|
||||
* 1. The declaration has a computed property name
|
||||
* 2. The computed name is *not* expressed as Symbol.<name>, where name
|
||||
* is a property of the Symbol constructor that denotes a built in
|
||||
* Symbol.
|
||||
*/
|
||||
function hasDynamicName(declaration: Declaration): boolean;
|
||||
/**
|
||||
* Checks if the expression is of the form:
|
||||
* Symbol.name
|
||||
* where Symbol is literally the word "Symbol", and name is any identifierName
|
||||
*/
|
||||
function isWellKnownSymbolSyntactically(node: Expression): boolean;
|
||||
function getPropertyNameForPropertyNameNode(name: DeclarationName): string;
|
||||
function getPropertyNameForKnownSymbolName(symbolName: string): string;
|
||||
/**
|
||||
* Includes the word "Symbol" with unicode escapes
|
||||
*/
|
||||
function isESSymbolIdentifier(node: Node): boolean;
|
||||
function isModifier(token: SyntaxKind): boolean;
|
||||
function textSpanEnd(span: TextSpan): number;
|
||||
function textSpanIsEmpty(span: TextSpan): boolean;
|
||||
function textSpanContainsPosition(span: TextSpan, position: number): boolean;
|
||||
function textSpanContainsTextSpan(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanOverlapsWith(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanOverlap(span1: TextSpan, span2: TextSpan): TextSpan;
|
||||
function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan): boolean;
|
||||
function textSpanIntersectsWith(span: TextSpan, start: number, length: number): boolean;
|
||||
function textSpanIntersectsWithPosition(span: TextSpan, position: number): boolean;
|
||||
function textSpanIntersection(span1: TextSpan, span2: TextSpan): TextSpan;
|
||||
function createTextSpan(start: number, length: number): TextSpan;
|
||||
function createTextSpanFromBounds(start: number, end: number): TextSpan;
|
||||
function textChangeRangeNewSpan(range: TextChangeRange): TextSpan;
|
||||
function textChangeRangeIsUnchanged(range: TextChangeRange): boolean;
|
||||
function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange;
|
||||
let unchangedTextChangeRange: TextChangeRange;
|
||||
/**
|
||||
* Called to merge all the changes that occurred across several versions of a script snapshot
|
||||
* into a single change. i.e. if a user keeps making successive edits to a script we will
|
||||
* have a text change from V1 to V2, V2 to V3, ..., Vn.
|
||||
*
|
||||
* This function will then merge those changes into a single change range valid between V1 and
|
||||
* Vn.
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function nodeStartsNewLexicalEnvironment(n: Node): boolean;
|
||||
function nodeIsSynthesized(node: Node): boolean;
|
||||
function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node;
|
||||
/**
|
||||
* Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2),
|
||||
* but augmented for a few select characters (e.g. lineSeparator, paragraphSeparator, nextLine)
|
||||
* Note that this doesn't actually wrap the input in double quotes.
|
||||
*/
|
||||
function escapeString(s: string): string;
|
||||
function escapeNonAsciiCharacters(s: string): string;
|
||||
interface EmitTextWriter {
|
||||
write(s: string): void;
|
||||
writeTextOfNode(sourceFile: SourceFile, node: Node): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
decreaseIndent(): void;
|
||||
getText(): string;
|
||||
rawWrite(s: string): void;
|
||||
writeLiteral(s: string): void;
|
||||
getTextPos(): number;
|
||||
getLine(): number;
|
||||
getColumn(): number;
|
||||
getIndent(): number;
|
||||
}
|
||||
function getIndentString(level: number): string;
|
||||
function getIndentSize(): number;
|
||||
function createTextWriter(newLine: String): EmitTextWriter;
|
||||
function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string): string;
|
||||
function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string;
|
||||
function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean): void;
|
||||
function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number;
|
||||
function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration;
|
||||
function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean;
|
||||
function getAllAccessorDeclarations(declarations: NodeArray<Declaration>, accessor: AccessorDeclaration): {
|
||||
firstAccessor: AccessorDeclaration;
|
||||
secondAccessor: AccessorDeclaration;
|
||||
getAccessor: AccessorDeclaration;
|
||||
setAccessor: AccessorDeclaration;
|
||||
};
|
||||
function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void;
|
||||
function emitComments(currentSourceFile: SourceFile, writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void): void;
|
||||
function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string): void;
|
||||
function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean;
|
||||
function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean;
|
||||
function getLocalSymbolForExportDefault(symbol: Symbol): Symbol;
|
||||
}
|
||||
declare module "typescript" {
|
||||
/**
|
||||
* 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" {
|
||||
interface ListItemInfo {
|
||||
listItemIndex: number;
|
||||
list: Node;
|
||||
}
|
||||
function getEndLinePosition(line: number, sourceFile: SourceFile): number;
|
||||
function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number;
|
||||
function rangeContainsRange(r1: TextRange, r2: TextRange): boolean;
|
||||
function startEndContainsRange(start: number, end: number, range: TextRange): boolean;
|
||||
function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean;
|
||||
function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean;
|
||||
function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean;
|
||||
function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean;
|
||||
function isCompletedNode(n: Node, sourceFile: SourceFile): boolean;
|
||||
function findListItemInfo(node: Node): ListItemInfo;
|
||||
function hasChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): boolean;
|
||||
function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node;
|
||||
function findContainingList(node: Node): Node;
|
||||
function getTouchingWord(sourceFile: SourceFile, position: number): Node;
|
||||
function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node;
|
||||
/** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */
|
||||
function getTouchingToken(sourceFile: SourceFile, position: number, includeItemAtEndPosition?: (n: Node) => boolean): Node;
|
||||
/** Returns a token if position is in [start-of-leading-trivia, end) */
|
||||
function getTokenAtPosition(sourceFile: SourceFile, position: number): Node;
|
||||
/**
|
||||
* The token on the left of the position is the token that strictly includes the position
|
||||
* or sits to the left of the cursor if it is on a boundary. For example
|
||||
*
|
||||
* fo|o -> will return foo
|
||||
* foo <comment> |bar -> will return foo
|
||||
*
|
||||
*/
|
||||
function findTokenOnLeftOfPosition(file: SourceFile, position: number): Node;
|
||||
function findNextToken(previousToken: Node, parent: Node): Node;
|
||||
function findPrecedingToken(position: number, sourceFile: SourceFile, startNode?: Node): Node;
|
||||
function getNodeModifiers(node: Node): string;
|
||||
function getTypeArgumentOrTypeParameterList(node: Node): NodeArray<Node>;
|
||||
function isToken(n: Node): boolean;
|
||||
function isWord(kind: SyntaxKind): boolean;
|
||||
function isComment(kind: SyntaxKind): boolean;
|
||||
function isPunctuation(kind: SyntaxKind): boolean;
|
||||
function isInsideTemplateLiteral(node: LiteralExpression, position: number): boolean;
|
||||
function isAccessibilityModifier(kind: SyntaxKind): boolean;
|
||||
function compareDataObjects(dst: any, src: any): boolean;
|
||||
}
|
||||
declare module "typescript" {
|
||||
function isFirstDeclarationOfSymbolParameter(symbol: Symbol): boolean;
|
||||
function symbolPart(text: string, symbol: Symbol): SymbolDisplayPart;
|
||||
function displayPart(text: string, kind: SymbolDisplayPartKind, symbol?: Symbol): SymbolDisplayPart;
|
||||
function spacePart(): SymbolDisplayPart;
|
||||
function keywordPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function punctuationPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function operatorPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function textOrKeywordPart(text: string): SymbolDisplayPart;
|
||||
function textPart(text: string): SymbolDisplayPart;
|
||||
function lineBreakPart(): SymbolDisplayPart;
|
||||
function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[];
|
||||
function typeToDisplayParts(typechecker: TypeChecker, type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[];
|
||||
function symbolToDisplayParts(typeChecker: TypeChecker, symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): SymbolDisplayPart[];
|
||||
function signatureToDisplayParts(typechecker: TypeChecker, signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): SymbolDisplayPart[];
|
||||
}
|
||||
@@ -54,6 +54,7 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, nameMap:
|
||||
var result =
|
||||
'// <auto-generated />\r\n' +
|
||||
'/// <reference path="types.ts" />\r\n' +
|
||||
'/* @internal */\r\n' +
|
||||
'module ts {\r\n' +
|
||||
' export var Diagnostics = {\r\n';
|
||||
var names = Utilities.getObjectKeys(messageTable);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/// <reference path="parser.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
/* @internal */ export let bindTime = 0;
|
||||
export let bindTime = 0;
|
||||
|
||||
export const enum ModuleInstanceState {
|
||||
NonInstantiated = 0,
|
||||
@@ -539,7 +540,7 @@ module ts {
|
||||
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.ExportAssignment:
|
||||
if ((<ExportAssignment>node).expression && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier) {
|
||||
if ((<ExportAssignment>node).expression.kind === SyntaxKind.Identifier) {
|
||||
// An export default clause with an identifier exports all meanings of that identifier
|
||||
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Alias, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
|
||||
}
|
||||
|
||||
+483
-222
File diff suppressed because it is too large
Load Diff
@@ -164,7 +164,6 @@ module ts {
|
||||
}
|
||||
];
|
||||
|
||||
/* @internal */
|
||||
export function parseCommandLine(commandLine: string[]): ParsedCommandLine {
|
||||
var options: CompilerOptions = {};
|
||||
var fileNames: string[] = [];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path="types.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
|
||||
// Ternary values are defined such that
|
||||
// x & y is False if either x or y is False.
|
||||
// x & y is Maybe if either x or y is Maybe, but neither x or y is False.
|
||||
@@ -659,10 +659,6 @@ module ts {
|
||||
"\u0085": "\\u0085" // nextLine
|
||||
};
|
||||
|
||||
export function getDefaultLibFileName(options: CompilerOptions): string {
|
||||
return options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts";
|
||||
}
|
||||
|
||||
export interface ObjectAllocator {
|
||||
getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path="checker.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
|
||||
interface ModuleElementDeclarationEmitInfo {
|
||||
node: Node;
|
||||
outputPos: number;
|
||||
@@ -258,7 +258,7 @@ module ts {
|
||||
handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning));
|
||||
}
|
||||
|
||||
function writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, type: TypeNode | StringLiteralExpression, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) {
|
||||
function writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, type: TypeNode, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) {
|
||||
writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;
|
||||
write(": ");
|
||||
if (type) {
|
||||
@@ -314,12 +314,12 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type: TypeNode | EntityName | HeritageClauseElement, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) {
|
||||
function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type: TypeNode | EntityName, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) {
|
||||
writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;
|
||||
emitType(type);
|
||||
}
|
||||
|
||||
function emitType(type: TypeNode | StringLiteralExpression | Identifier | QualifiedName | HeritageClauseElement) {
|
||||
function emitType(type: TypeNode | Identifier | QualifiedName) {
|
||||
switch (type.kind) {
|
||||
case SyntaxKind.AnyKeyword:
|
||||
case SyntaxKind.StringKeyword:
|
||||
@@ -442,20 +442,41 @@ module ts {
|
||||
emitLines(node.statements);
|
||||
}
|
||||
|
||||
// Return a temp variable name to be used in `export default` statements.
|
||||
// The temp name will be of the form _default_counter.
|
||||
// Note that export default is only allowed at most once in a module, so we
|
||||
// do not need to keep track of created temp names.
|
||||
function getExportDefaultTempVariableName(): string {
|
||||
let baseName = "_default";
|
||||
if (!hasProperty(currentSourceFile.identifiers, baseName)) {
|
||||
return baseName;
|
||||
}
|
||||
let count = 0;
|
||||
while (true) {
|
||||
let name = baseName + "_" + (++count);
|
||||
if (!hasProperty(currentSourceFile.identifiers, name)) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitExportAssignment(node: ExportAssignment) {
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
if (node.expression.kind === SyntaxKind.Identifier) {
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
writeTextOfNode(currentSourceFile, node.expression);
|
||||
}
|
||||
else {
|
||||
// Expression
|
||||
let tempVarName = getExportDefaultTempVariableName();
|
||||
write("declare var ");
|
||||
write(tempVarName);
|
||||
write(": ");
|
||||
if (node.type) {
|
||||
emitType(node.type);
|
||||
}
|
||||
else {
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
}
|
||||
writer.getSymbolAccessibilityDiagnostic = getDefaultExportAccessibilityDiagnostic;
|
||||
resolver.writeTypeOfExpression(node.expression, enclosingDeclaration, TypeFormatFlags.UseTypeOfFunction, writer);
|
||||
write(";");
|
||||
writeLine();
|
||||
write(node.isExportEquals ? "export = " : "export default ");
|
||||
write(tempVarName);
|
||||
}
|
||||
write(";");
|
||||
writeLine();
|
||||
@@ -1105,7 +1126,7 @@ module ts {
|
||||
writeLine();
|
||||
}
|
||||
|
||||
function getTypeAnnotationFromAccessor(accessor: AccessorDeclaration): TypeNode | StringLiteralExpression {
|
||||
function getTypeAnnotationFromAccessor(accessor: AccessorDeclaration): TypeNode {
|
||||
if (accessor) {
|
||||
return accessor.kind === SyntaxKind.GetAccessor
|
||||
? accessor.type // Getter - return type
|
||||
@@ -1540,7 +1561,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
// @internal
|
||||
/* @internal */
|
||||
export function writeDeclarationFile(jsFilePath: string, sourceFile: SourceFile, host: EmitHost, resolver: EmitResolver, diagnostics: Diagnostic[]) {
|
||||
let emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile);
|
||||
// TODO(shkamat): Should we not write any declaration file if any of them can produce error,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// <auto-generated />
|
||||
/// <reference path="types.ts" />
|
||||
/* @internal */
|
||||
module ts {
|
||||
export var Diagnostics = {
|
||||
Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." },
|
||||
@@ -158,7 +159,6 @@ module ts {
|
||||
An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: DiagnosticCategory.Error, key: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." },
|
||||
Unterminated_Unicode_escape_sequence: { code: 1199, category: DiagnosticCategory.Error, key: "Unterminated Unicode escape sequence." },
|
||||
Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." },
|
||||
A_type_annotation_on_an_export_statement_is_only_allowed_in_an_ambient_external_module_declaration: { code: 1201, category: DiagnosticCategory.Error, key: "A type annotation on an export statement is only allowed in an ambient external module declaration." },
|
||||
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." },
|
||||
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." },
|
||||
Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into amd or commonjs when targeting es6 or higher." },
|
||||
@@ -169,6 +169,12 @@ module ts {
|
||||
Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." },
|
||||
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." },
|
||||
A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" },
|
||||
Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode" },
|
||||
Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
|
||||
Identifier_expected_0_is_a_reserved_word_in_strict_mode_External_Module_is_automatically_in_strict_mode: { code: 1214, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. External Module is automatically in strict mode." },
|
||||
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
|
||||
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
|
||||
Type_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode: { code: 1217, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode." },
|
||||
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." },
|
||||
@@ -352,11 +358,12 @@ module ts {
|
||||
Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: DiagnosticCategory.Error, key: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." },
|
||||
Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." },
|
||||
Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." },
|
||||
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." },
|
||||
The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression." },
|
||||
External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: 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." },
|
||||
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
|
||||
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}'." },
|
||||
|
||||
@@ -623,10 +623,6 @@
|
||||
"category": "Error",
|
||||
"code": 1200
|
||||
},
|
||||
"A type annotation on an export statement is only allowed in an ambient external module declaration.": {
|
||||
"category": "Error",
|
||||
"code": 1201
|
||||
},
|
||||
"Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead.": {
|
||||
"category": "Error",
|
||||
"code": 1202
|
||||
@@ -661,12 +657,36 @@
|
||||
},
|
||||
"Invalid use of '{0}'. Class definitions are automatically in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1210
|
||||
"code": 1210
|
||||
},
|
||||
"A class declaration without the 'default' modifier must have a name": {
|
||||
"category": "Error",
|
||||
"code": 1211
|
||||
},
|
||||
"Identifier expected. '{0}' is a reserved word in strict mode": {
|
||||
"category": "Error",
|
||||
"code": 1212
|
||||
},
|
||||
"Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1213
|
||||
},
|
||||
"Identifier expected. '{0}' is a reserved word in strict mode. External Module is automatically in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1214
|
||||
},
|
||||
"Type expected. '{0}' is a reserved word in strict mode": {
|
||||
"category": "Error",
|
||||
"code": 1215
|
||||
},
|
||||
"Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1216
|
||||
},
|
||||
"Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1217
|
||||
},
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2300
|
||||
@@ -1399,7 +1419,7 @@
|
||||
"category": "Error",
|
||||
"code": 2495
|
||||
},
|
||||
"The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": {
|
||||
"The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression.": {
|
||||
"category": "Error",
|
||||
"code": 2496
|
||||
},
|
||||
@@ -1419,6 +1439,10 @@
|
||||
"category": "Error",
|
||||
"code": 2500
|
||||
},
|
||||
"A rest element cannot contain a binding pattern.": {
|
||||
"category": "Error",
|
||||
"code": 2501
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
@@ -2023,19 +2047,19 @@
|
||||
},
|
||||
"'import ... =' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8002
|
||||
"code": 8002
|
||||
},
|
||||
"'export=' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8003
|
||||
"code": 8003
|
||||
},
|
||||
"'type parameter declarations' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8004
|
||||
"code": 8004
|
||||
},
|
||||
"'implements clauses' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8005
|
||||
"code": 8005
|
||||
},
|
||||
"'interface declarations' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
|
||||
+176
-104
@@ -1,6 +1,7 @@
|
||||
/// <reference path="checker.ts"/>
|
||||
/// <reference path="declarationEmitter.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
// represents one LexicalEnvironment frame to store unique generated names
|
||||
interface ScopeFrame {
|
||||
@@ -20,7 +21,6 @@ module ts {
|
||||
_n = 0x20000000, // Use/preference flag for '_n'
|
||||
}
|
||||
|
||||
// @internal
|
||||
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
|
||||
export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult {
|
||||
// emit output for the __extends helper function
|
||||
@@ -1097,6 +1097,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
default:
|
||||
return Comparison.LessThan;
|
||||
}
|
||||
case SyntaxKind.YieldExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
return Comparison.LessThan;
|
||||
default:
|
||||
@@ -1305,6 +1306,17 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
emit((<SpreadElementExpression>node).expression);
|
||||
}
|
||||
|
||||
function emitYieldExpression(node: YieldExpression) {
|
||||
write(tokenToString(SyntaxKind.YieldKeyword));
|
||||
if (node.asteriskToken) {
|
||||
write("*");
|
||||
}
|
||||
if (node.expression) {
|
||||
write(" ");
|
||||
emit(node.expression);
|
||||
}
|
||||
}
|
||||
|
||||
function needsParenthesisForPropertyAccessOrInvocation(node: Expression) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
@@ -1577,23 +1589,40 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
return result;
|
||||
}
|
||||
|
||||
function createPropertyAccessExpression(expression: LeftHandSideExpression, name: Identifier): PropertyAccessExpression {
|
||||
function createPropertyAccessExpression(expression: Expression, name: Identifier): PropertyAccessExpression {
|
||||
let result = <PropertyAccessExpression>createSynthesizedNode(SyntaxKind.PropertyAccessExpression);
|
||||
result.expression = expression;
|
||||
result.expression = parenthesizeForAccess(expression);
|
||||
result.dotToken = createSynthesizedNode(SyntaxKind.DotToken);
|
||||
result.name = name;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
function createElementAccessExpression(expression: LeftHandSideExpression, argumentExpression: Expression): ElementAccessExpression {
|
||||
function createElementAccessExpression(expression: Expression, argumentExpression: Expression): ElementAccessExpression {
|
||||
let result = <ElementAccessExpression>createSynthesizedNode(SyntaxKind.ElementAccessExpression);
|
||||
result.expression = expression;
|
||||
result.expression = parenthesizeForAccess(expression);
|
||||
result.argumentExpression = argumentExpression;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function parenthesizeForAccess(expr: Expression): LeftHandSideExpression {
|
||||
// isLeftHandSideExpression is almost the correct criterion for when it is not necessary
|
||||
// to parenthesize the expression before a dot. The known exceptions are:
|
||||
//
|
||||
// NewExpression:
|
||||
// new C.x -> not the same as (new C).x
|
||||
// NumberLiteral
|
||||
// 1.x -> not the same as (1).x
|
||||
//
|
||||
if (isLeftHandSideExpression(expr) && expr.kind !== SyntaxKind.NewExpression && expr.kind !== SyntaxKind.NumericLiteral) {
|
||||
return <LeftHandSideExpression>expr;
|
||||
}
|
||||
let node = <ParenthesizedExpression>createSynthesizedNode(SyntaxKind.ParenthesizedExpression);
|
||||
node.expression = expr;
|
||||
return node;
|
||||
}
|
||||
|
||||
function emitComputedPropertyName(node: ComputedPropertyName) {
|
||||
write("[");
|
||||
emitExpressionForPropertyName(node);
|
||||
@@ -1601,6 +1630,10 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
}
|
||||
|
||||
function emitMethod(node: MethodDeclaration) {
|
||||
if (languageVersion >= ScriptTarget.ES6 && node.asteriskToken) {
|
||||
write("*");
|
||||
}
|
||||
|
||||
emit(node.name, /*allowGeneratedIdentifiers*/ false);
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
write(": function ");
|
||||
@@ -2260,7 +2293,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
if (node.initializer.kind === SyntaxKind.ArrayLiteralExpression || node.initializer.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
// This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause
|
||||
// the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash.
|
||||
emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined, /*locationForCheckingExistingName*/ node);
|
||||
emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined);
|
||||
}
|
||||
else {
|
||||
emitNodeWithoutSourceMap(assignmentExpression);
|
||||
@@ -2436,7 +2469,11 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
if (node.flags & NodeFlags.Default) {
|
||||
write("exports.default");
|
||||
if (languageVersion === ScriptTarget.ES3) {
|
||||
write("exports[\"default\"]");
|
||||
} else {
|
||||
write("exports.default");
|
||||
}
|
||||
}
|
||||
else {
|
||||
emitModuleMemberName(node);
|
||||
@@ -2464,16 +2501,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the root has a chance of being a synthesized node, callers should also pass a value for
|
||||
* lowestNonSynthesizedAncestor. This should be an ancestor of root, it should not be synthesized,
|
||||
* and there should not be a lower ancestor that introduces a scope. This node will be used as the
|
||||
* location for ensuring that temporary names are unique.
|
||||
*/
|
||||
function emitDestructuring(root: BinaryExpression | VariableDeclaration | ParameterDeclaration,
|
||||
isAssignmentExpressionStatement: boolean,
|
||||
value?: Expression,
|
||||
lowestNonSynthesizedAncestor?: Node) {
|
||||
function emitDestructuring(root: BinaryExpression | VariableDeclaration | ParameterDeclaration, isAssignmentExpressionStatement: boolean, value?: Expression) {
|
||||
let emitCount = 0;
|
||||
// An exported declaration is actually emitted as an assignment (to a property on the module object), so
|
||||
// temporary variables in an exported declaration need to have real declarations elsewhere
|
||||
@@ -2504,9 +2532,6 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
|
||||
function ensureIdentifier(expr: Expression): Expression {
|
||||
if (expr.kind !== SyntaxKind.Identifier) {
|
||||
// In case the root is a synthesized node, we need to pass lowestNonSynthesizedAncestor
|
||||
// as the location for determining uniqueness of the variable we are about to
|
||||
// generate.
|
||||
let identifier = createTempVariable(TempFlags.Auto);
|
||||
if (!isDeclaration) {
|
||||
recordTempDeclaration(identifier);
|
||||
@@ -2545,27 +2570,22 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
return node;
|
||||
}
|
||||
|
||||
function parenthesizeForAccess(expr: Expression): LeftHandSideExpression {
|
||||
if (expr.kind === SyntaxKind.Identifier || expr.kind === SyntaxKind.PropertyAccessExpression || expr.kind === SyntaxKind.ElementAccessExpression) {
|
||||
return <LeftHandSideExpression>expr;
|
||||
}
|
||||
let node = <ParenthesizedExpression>createSynthesizedNode(SyntaxKind.ParenthesizedExpression);
|
||||
node.expression = expr;
|
||||
return node;
|
||||
}
|
||||
|
||||
function createPropertyAccess(object: Expression, propName: Identifier): Expression {
|
||||
function createPropertyAccessForDestructuringProperty(object: Expression, propName: Identifier | LiteralExpression): Expression {
|
||||
if (propName.kind !== SyntaxKind.Identifier) {
|
||||
return createElementAccess(object, propName);
|
||||
return createElementAccessExpression(object, propName);
|
||||
}
|
||||
return createPropertyAccessExpression(parenthesizeForAccess(object), propName);
|
||||
|
||||
return createPropertyAccessExpression(object, propName);
|
||||
}
|
||||
|
||||
function createElementAccess(object: Expression, index: Expression): Expression {
|
||||
let node = <ElementAccessExpression>createSynthesizedNode(SyntaxKind.ElementAccessExpression);
|
||||
node.expression = parenthesizeForAccess(object);
|
||||
node.argumentExpression = index;
|
||||
return node;
|
||||
function createSliceCall(value: Expression, sliceIndex: number): CallExpression {
|
||||
let call = <CallExpression>createSynthesizedNode(SyntaxKind.CallExpression);
|
||||
let sliceIdentifier = <Identifier>createSynthesizedNode(SyntaxKind.Identifier);
|
||||
sliceIdentifier.text = "slice";
|
||||
call.expression = createPropertyAccessExpression(value, sliceIdentifier);
|
||||
call.arguments = <NodeArray<LiteralExpression>>createSynthesizedNodeArray();
|
||||
call.arguments[0] = createNumericLiteral(sliceIndex);
|
||||
return call;
|
||||
}
|
||||
|
||||
function emitObjectLiteralAssignment(target: ObjectLiteralExpression, value: Expression) {
|
||||
@@ -2578,8 +2598,8 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
for (let p of properties) {
|
||||
if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
// TODO(andersh): Computed property support
|
||||
let propName = <Identifier>((<PropertyAssignment>p).name);
|
||||
emitDestructuringAssignment((<PropertyAssignment>p).initializer || propName, createPropertyAccess(value, propName));
|
||||
let propName = <Identifier | LiteralExpression>((<PropertyAssignment>p).name);
|
||||
emitDestructuringAssignment((<PropertyAssignment>p).initializer || propName, createPropertyAccessForDestructuringProperty(value, propName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2595,14 +2615,10 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
let e = elements[i];
|
||||
if (e.kind !== SyntaxKind.OmittedExpression) {
|
||||
if (e.kind !== SyntaxKind.SpreadElementExpression) {
|
||||
emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i)));
|
||||
emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)));
|
||||
}
|
||||
else {
|
||||
if (i === elements.length - 1) {
|
||||
value = ensureIdentifier(value);
|
||||
emitAssignment(<Identifier>(<SpreadElementExpression>e).expression, value);
|
||||
write(".slice(" + i + ")");
|
||||
}
|
||||
else if (i === elements.length - 1) {
|
||||
emitDestructuringAssignment((<SpreadElementExpression>e).expression, createSliceCall(value, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2666,19 +2682,15 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
if (pattern.kind === SyntaxKind.ObjectBindingPattern) {
|
||||
// Rewrite element to a declaration with an initializer that fetches property
|
||||
let propName = element.propertyName || <Identifier>element.name;
|
||||
emitBindingElement(element, createPropertyAccess(value, propName));
|
||||
emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName));
|
||||
}
|
||||
else if (element.kind !== SyntaxKind.OmittedExpression) {
|
||||
if (!element.dotDotDotToken) {
|
||||
// Rewrite element to a declaration that accesses array element at index i
|
||||
emitBindingElement(element, createElementAccess(value, createNumericLiteral(i)));
|
||||
emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i)));
|
||||
}
|
||||
else {
|
||||
if (i === elements.length - 1) {
|
||||
value = ensureIdentifier(value);
|
||||
emitAssignment(<Identifier>element.name, value);
|
||||
write(".slice(" + i + ")");
|
||||
}
|
||||
else if (i === elements.length - 1) {
|
||||
emitBindingElement(element, createSliceCall(value, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2846,6 +2858,12 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
let tempIndex = 0;
|
||||
forEach(node.parameters, p => {
|
||||
// A rest parameter cannot have a binding pattern or an initializer,
|
||||
// so let's just ignore it.
|
||||
if (p.dotDotDotToken) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isBindingPattern(p.name)) {
|
||||
writeLine();
|
||||
write("var ");
|
||||
@@ -2876,6 +2894,12 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
if (languageVersion < ScriptTarget.ES6 && hasRestParameters(node)) {
|
||||
let restIndex = node.parameters.length - 1;
|
||||
let restParam = node.parameters[restIndex];
|
||||
|
||||
// A rest parameter cannot have a binding pattern, so let's just ignore it if it does.
|
||||
if (isBindingPattern(restParam.name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let tempName = createTempVariable(TempFlags._i).text;
|
||||
writeLine();
|
||||
emitLeadingComments(restParam);
|
||||
@@ -2960,7 +2984,12 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
write("default ");
|
||||
}
|
||||
}
|
||||
write("function ");
|
||||
|
||||
write("function");
|
||||
if (languageVersion >= ScriptTarget.ES6 && node.asteriskToken) {
|
||||
write("*");
|
||||
}
|
||||
write(" ");
|
||||
}
|
||||
|
||||
if (shouldEmitFunctionName(node)) {
|
||||
@@ -3344,6 +3373,9 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
else if (member.kind === SyntaxKind.SetAccessor) {
|
||||
write("set ");
|
||||
}
|
||||
if ((<MethodDeclaration>member).asteriskToken) {
|
||||
write("*");
|
||||
}
|
||||
emit((<MethodDeclaration>member).name);
|
||||
emitSignatureAndBody(<MethodDeclaration>member);
|
||||
emitEnd(member);
|
||||
@@ -4183,6 +4215,10 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
return isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation);
|
||||
}
|
||||
|
||||
function isModuleMergedWithES6Class(node: ModuleDeclaration) {
|
||||
return languageVersion === ScriptTarget.ES6 && !!(resolver.getNodeCheckFlags(node) & NodeCheckFlags.LexicalModuleMergesWithClass);
|
||||
}
|
||||
|
||||
function emitModuleDeclaration(node: ModuleDeclaration) {
|
||||
// Emit only if this module is non-ambient.
|
||||
let shouldEmit = shouldEmitModuleDeclaration(node);
|
||||
@@ -4191,15 +4227,19 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
return emitOnlyPinnedOrTripleSlashComments(node);
|
||||
}
|
||||
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
if (!isModuleMergedWithES6Class(node)) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
}
|
||||
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
write(";");
|
||||
emitEnd(node);
|
||||
writeLine();
|
||||
}
|
||||
write("var ");
|
||||
emit(node.name);
|
||||
write(";");
|
||||
emitEnd(node);
|
||||
writeLine();
|
||||
|
||||
emitStart(node);
|
||||
write("(function (");
|
||||
emitStart(node.name);
|
||||
@@ -4524,7 +4564,11 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
emitContainingModuleName(node);
|
||||
write(".default = ");
|
||||
if (languageVersion === ScriptTarget.ES3) {
|
||||
write("[\"default\"] = ");
|
||||
} else {
|
||||
write(".default = ");
|
||||
}
|
||||
emit(node.expression);
|
||||
write(";");
|
||||
emitEnd(node);
|
||||
@@ -4585,19 +4629,6 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
}
|
||||
}
|
||||
|
||||
function sortAMDModules(amdModules: {name: string; path: string}[]) {
|
||||
// AMD modules with declared variable names go first
|
||||
return amdModules.sort((moduleA, moduleB) => {
|
||||
if (moduleA.name === moduleB.name) {
|
||||
return 0;
|
||||
} else if (!moduleA.name) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function emitExportStarHelper() {
|
||||
if (hasExportStars) {
|
||||
writeLine();
|
||||
@@ -4613,44 +4644,83 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
|
||||
function emitAMDModule(node: SourceFile, startIndex: number) {
|
||||
collectExternalModuleInfo(node);
|
||||
|
||||
// An AMD define function has the following shape:
|
||||
// define(id?, dependencies?, factory);
|
||||
//
|
||||
// This has the shape of
|
||||
// define(name, ["module1", "module2"], function (module1Alias) {
|
||||
// The location of the alias in the parameter list in the factory function needs to
|
||||
// match the position of the module name in the dependency list.
|
||||
//
|
||||
// To ensure this is true in cases of modules with no aliases, e.g.:
|
||||
// `import "module"` or `<amd-dependency path= "a.css" />`
|
||||
// we need to add modules without alias names to the end of the dependencies list
|
||||
|
||||
let aliasedModuleNames: string[] = []; // names of modules with corresponding parameter in the
|
||||
// factory function.
|
||||
let unaliasedModuleNames: string[] = []; // names of modules with no corresponding parameters in
|
||||
// factory function.
|
||||
let importAliasNames: string[] = []; // names of the parameters in the factory function; these
|
||||
// paramters need to match the indexes of the corresponding
|
||||
// module names in aliasedModuleNames.
|
||||
|
||||
// Fill in amd-dependency tags
|
||||
for (let amdDependency of node.amdDependencies) {
|
||||
if (amdDependency.name) {
|
||||
aliasedModuleNames.push("\"" + amdDependency.path + "\"");
|
||||
importAliasNames.push(amdDependency.name);
|
||||
}
|
||||
else {
|
||||
unaliasedModuleNames.push("\"" + amdDependency.path + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
for (let importNode of externalImports) {
|
||||
// Find the name of the external module
|
||||
let externalModuleName = "";
|
||||
let moduleName = getExternalModuleName(importNode);
|
||||
if (moduleName.kind === SyntaxKind.StringLiteral) {
|
||||
externalModuleName = getLiteralText(<LiteralExpression>moduleName);
|
||||
}
|
||||
|
||||
// Find the name of the module alais, if there is one
|
||||
let importAliasName: string;
|
||||
let namespaceDeclaration = getNamespaceDeclarationNode(importNode);
|
||||
if (namespaceDeclaration && !isDefaultImport(importNode)) {
|
||||
importAliasName = getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name);
|
||||
}
|
||||
else {
|
||||
importAliasName = getGeneratedNameForNode(<ImportDeclaration | ExportDeclaration>importNode);
|
||||
}
|
||||
|
||||
if (importAliasName) {
|
||||
aliasedModuleNames.push(externalModuleName);
|
||||
importAliasNames.push(importAliasName);
|
||||
}
|
||||
else {
|
||||
unaliasedModuleNames.push(externalModuleName);
|
||||
}
|
||||
}
|
||||
|
||||
writeLine();
|
||||
write("define(");
|
||||
sortAMDModules(node.amdDependencies);
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
write("[\"require\", \"exports\"");
|
||||
for (let importNode of externalImports) {
|
||||
if (aliasedModuleNames.length) {
|
||||
write(", ");
|
||||
let moduleName = getExternalModuleName(importNode);
|
||||
if (moduleName.kind === SyntaxKind.StringLiteral) {
|
||||
emitLiteral(<LiteralExpression>moduleName);
|
||||
}
|
||||
else {
|
||||
write("\"\"");
|
||||
}
|
||||
write(aliasedModuleNames.join(", "));
|
||||
}
|
||||
for (let amdDependency of node.amdDependencies) {
|
||||
let text = "\"" + amdDependency.path + "\"";
|
||||
if (unaliasedModuleNames.length) {
|
||||
write(", ");
|
||||
write(text);
|
||||
write(unaliasedModuleNames.join(", "));
|
||||
}
|
||||
write("], function (require, exports");
|
||||
for (let importNode of externalImports) {
|
||||
if (importAliasNames.length) {
|
||||
write(", ");
|
||||
let namespaceDeclaration = getNamespaceDeclarationNode(importNode);
|
||||
if (namespaceDeclaration && !isDefaultImport(importNode)) {
|
||||
emit(namespaceDeclaration.name);
|
||||
}
|
||||
else {
|
||||
write(getGeneratedNameForNode(<ImportDeclaration | ExportDeclaration>importNode));
|
||||
}
|
||||
}
|
||||
for (let amdDependency of node.amdDependencies) {
|
||||
if (amdDependency.name) {
|
||||
write(", ");
|
||||
write(amdDependency.name);
|
||||
}
|
||||
write(importAliasNames.join(", "));
|
||||
}
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
@@ -4922,6 +4992,8 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
||||
return emitConditionalExpression(<ConditionalExpression>node);
|
||||
case SyntaxKind.SpreadElementExpression:
|
||||
return emitSpreadElementExpression(<SpreadElementExpression>node);
|
||||
case SyntaxKind.YieldExpression:
|
||||
return emitYieldExpression(<YieldExpression>node);
|
||||
case SyntaxKind.OmittedExpression:
|
||||
return;
|
||||
case SyntaxKind.Block:
|
||||
|
||||
+791
-764
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ module ts {
|
||||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
export let version = "1.5.0-alpha";
|
||||
export const version = "1.5.0-alpha";
|
||||
|
||||
export function findConfigFile(searchPath: string): string {
|
||||
var fileName = "tsconfig.json";
|
||||
@@ -54,6 +54,7 @@ module ts {
|
||||
}
|
||||
text = "";
|
||||
}
|
||||
|
||||
return text !== undefined ? createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined;
|
||||
}
|
||||
|
||||
@@ -170,7 +171,7 @@ module ts {
|
||||
getDiagnosticsProducingTypeChecker,
|
||||
getCommonSourceDirectory: () => commonSourceDirectory,
|
||||
emit,
|
||||
getCurrentDirectory: host.getCurrentDirectory,
|
||||
getCurrentDirectory: () => host.getCurrentDirectory(),
|
||||
getNodeCount: () => getDiagnosticsProducingTypeChecker().getNodeCount(),
|
||||
getIdentifierCount: () => getDiagnosticsProducingTypeChecker().getIdentifierCount(),
|
||||
getSymbolCount: () => getDiagnosticsProducingTypeChecker().getSymbolCount(),
|
||||
@@ -180,14 +181,15 @@ module ts {
|
||||
|
||||
function getEmitHost(writeFileCallback?: WriteFileCallback): EmitHost {
|
||||
return {
|
||||
getCanonicalFileName: host.getCanonicalFileName,
|
||||
getCanonicalFileName: fileName => host.getCanonicalFileName(fileName),
|
||||
getCommonSourceDirectory: program.getCommonSourceDirectory,
|
||||
getCompilerOptions: program.getCompilerOptions,
|
||||
getCurrentDirectory: host.getCurrentDirectory,
|
||||
getNewLine: host.getNewLine,
|
||||
getCurrentDirectory: () => host.getCurrentDirectory(),
|
||||
getNewLine: () => host.getNewLine(),
|
||||
getSourceFile: program.getSourceFile,
|
||||
getSourceFiles: program.getSourceFiles,
|
||||
writeFile: writeFileCallback || host.writeFile,
|
||||
writeFile: writeFileCallback || (
|
||||
(fileName, data, writeByteOrderMark, onError) => host.writeFile(fileName, data, writeByteOrderMark, onError)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+83
-55
@@ -2,11 +2,12 @@
|
||||
/// <reference path="diagnosticInformationMap.generated.ts"/>
|
||||
|
||||
module ts {
|
||||
|
||||
/* @internal */
|
||||
export interface ErrorCallback {
|
||||
(message: DiagnosticMessage, length: number): void;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface Scanner {
|
||||
getStartPos(): number;
|
||||
getToken(): SyntaxKind;
|
||||
@@ -23,7 +24,11 @@ module ts {
|
||||
reScanSlashToken(): SyntaxKind;
|
||||
reScanTemplateToken(): SyntaxKind;
|
||||
scan(): SyntaxKind;
|
||||
setText(text: string): void;
|
||||
// Sets the text for the scanner to scan. An optional subrange starting point and length
|
||||
// can be provided to have the scanner only scan a portion of the text.
|
||||
setText(text: string, start?: number, length?: number): void;
|
||||
setOnError(onError: ErrorCallback): void;
|
||||
setScriptTarget(scriptTarget: ScriptTarget): void;
|
||||
setTextPos(textPos: number): void;
|
||||
// Invokes the provided callback then unconditionally restores the scanner to the state it
|
||||
// was in immediately prior to invoking the callback. The result of invoking the callback
|
||||
@@ -262,6 +267,7 @@ module ts {
|
||||
return textToToken[s];
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function computeLineStarts(text: string): number[] {
|
||||
let result: number[] = new Array();
|
||||
let pos = 0;
|
||||
@@ -293,15 +299,18 @@ module ts {
|
||||
return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character);
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number {
|
||||
Debug.assert(line >= 0 && line < lineStarts.length);
|
||||
return lineStarts[line] + character;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function getLineStarts(sourceFile: SourceFile): number[] {
|
||||
return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text));
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function computeLineAndCharacterOfPosition(lineStarts: number[], position: number) {
|
||||
let lineNumber = binarySearch(lineStarts, position);
|
||||
if (lineNumber < 0) {
|
||||
@@ -362,10 +371,12 @@ module ts {
|
||||
return ch >= CharacterCodes._0 && ch <= CharacterCodes._9;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function isOctalDigit(ch: number): boolean {
|
||||
return ch >= CharacterCodes._0 && ch <= CharacterCodes._7;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number {
|
||||
while (true) {
|
||||
let ch = text.charCodeAt(pos);
|
||||
@@ -523,6 +534,7 @@ module ts {
|
||||
let nextChar = text.charCodeAt(pos + 1);
|
||||
let hasTrailingNewLine = false;
|
||||
if (nextChar === CharacterCodes.slash || nextChar === CharacterCodes.asterisk) {
|
||||
let kind = nextChar === CharacterCodes.slash ? SyntaxKind.SingleLineCommentTrivia : SyntaxKind.MultiLineCommentTrivia;
|
||||
let startPos = pos;
|
||||
pos += 2;
|
||||
if (nextChar === CharacterCodes.slash) {
|
||||
@@ -548,7 +560,7 @@ module ts {
|
||||
result = [];
|
||||
}
|
||||
|
||||
result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine });
|
||||
result.push({ pos: startPos, end: pos, hasTrailingNewLine, kind });
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -587,9 +599,11 @@ module ts {
|
||||
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion);
|
||||
}
|
||||
|
||||
export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner {
|
||||
// Creates a scanner over a (possibly unspecified) range of a piece of text.
|
||||
/* @internal */
|
||||
export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner {
|
||||
let pos: number; // Current position (end position of text of current token)
|
||||
let len: number; // Length of text
|
||||
let end: number; // end of text
|
||||
let startPos: number; // Start position of whitespace before current token
|
||||
let tokenPos: number; // Start position of text of current token
|
||||
let token: SyntaxKind;
|
||||
@@ -598,6 +612,32 @@ module ts {
|
||||
let hasExtendedUnicodeEscape: boolean;
|
||||
let tokenIsUnterminated: boolean;
|
||||
|
||||
setText(text, start, length);
|
||||
|
||||
return {
|
||||
getStartPos: () => startPos,
|
||||
getTextPos: () => pos,
|
||||
getToken: () => token,
|
||||
getTokenPos: () => tokenPos,
|
||||
getTokenText: () => text.substring(tokenPos, pos),
|
||||
getTokenValue: () => tokenValue,
|
||||
hasExtendedUnicodeEscape: () => hasExtendedUnicodeEscape,
|
||||
hasPrecedingLineBreak: () => precedingLineBreak,
|
||||
isIdentifier: () => token === SyntaxKind.Identifier || token > SyntaxKind.LastReservedWord,
|
||||
isReservedWord: () => token >= SyntaxKind.FirstReservedWord && token <= SyntaxKind.LastReservedWord,
|
||||
isUnterminated: () => tokenIsUnterminated,
|
||||
reScanGreaterToken,
|
||||
reScanSlashToken,
|
||||
reScanTemplateToken,
|
||||
scan,
|
||||
setText,
|
||||
setScriptTarget,
|
||||
setOnError,
|
||||
setTextPos,
|
||||
tryScan,
|
||||
lookAhead,
|
||||
};
|
||||
|
||||
function error(message: DiagnosticMessage, length?: number): void {
|
||||
if (onError) {
|
||||
onError(message, length || 0);
|
||||
@@ -694,7 +734,7 @@ module ts {
|
||||
let result = "";
|
||||
let start = pos;
|
||||
while (true) {
|
||||
if (pos >= len) {
|
||||
if (pos >= end) {
|
||||
result += text.substring(start, pos);
|
||||
tokenIsUnterminated = true;
|
||||
error(Diagnostics.Unterminated_string_literal);
|
||||
@@ -736,7 +776,7 @@ module ts {
|
||||
let resultingToken: SyntaxKind;
|
||||
|
||||
while (true) {
|
||||
if (pos >= len) {
|
||||
if (pos >= end) {
|
||||
contents += text.substring(start, pos);
|
||||
tokenIsUnterminated = true;
|
||||
error(Diagnostics.Unterminated_template_literal);
|
||||
@@ -755,7 +795,7 @@ module ts {
|
||||
}
|
||||
|
||||
// '${'
|
||||
if (currChar === CharacterCodes.$ && pos + 1 < len && text.charCodeAt(pos + 1) === CharacterCodes.openBrace) {
|
||||
if (currChar === CharacterCodes.$ && pos + 1 < end && text.charCodeAt(pos + 1) === CharacterCodes.openBrace) {
|
||||
contents += text.substring(start, pos);
|
||||
pos += 2;
|
||||
resultingToken = startedWithBacktick ? SyntaxKind.TemplateHead : SyntaxKind.TemplateMiddle;
|
||||
@@ -776,7 +816,7 @@ module ts {
|
||||
contents += text.substring(start, pos);
|
||||
pos++;
|
||||
|
||||
if (pos < len && text.charCodeAt(pos) === CharacterCodes.lineFeed) {
|
||||
if (pos < end && text.charCodeAt(pos) === CharacterCodes.lineFeed) {
|
||||
pos++;
|
||||
}
|
||||
|
||||
@@ -796,7 +836,7 @@ module ts {
|
||||
|
||||
function scanEscapeSequence(): string {
|
||||
pos++;
|
||||
if (pos >= len) {
|
||||
if (pos >= end) {
|
||||
error(Diagnostics.Unexpected_end_of_text);
|
||||
return "";
|
||||
}
|
||||
@@ -822,7 +862,7 @@ module ts {
|
||||
return "\"";
|
||||
case CharacterCodes.u:
|
||||
// '\u{DDDDDDDD}'
|
||||
if (pos < len && text.charCodeAt(pos) === CharacterCodes.openBrace) {
|
||||
if (pos < end && text.charCodeAt(pos) === CharacterCodes.openBrace) {
|
||||
hasExtendedUnicodeEscape = true;
|
||||
pos++;
|
||||
return scanExtendedUnicodeEscape();
|
||||
@@ -838,7 +878,7 @@ module ts {
|
||||
// when encountering a LineContinuation (i.e. a backslash and a line terminator sequence),
|
||||
// the line terminator is interpreted to be "the empty code unit sequence".
|
||||
case CharacterCodes.carriageReturn:
|
||||
if (pos < len && text.charCodeAt(pos) === CharacterCodes.lineFeed) {
|
||||
if (pos < end && text.charCodeAt(pos) === CharacterCodes.lineFeed) {
|
||||
pos++;
|
||||
}
|
||||
// fall through
|
||||
@@ -877,7 +917,7 @@ module ts {
|
||||
isInvalidExtendedEscape = true;
|
||||
}
|
||||
|
||||
if (pos >= len) {
|
||||
if (pos >= end) {
|
||||
error(Diagnostics.Unexpected_end_of_text);
|
||||
isInvalidExtendedEscape = true;
|
||||
}
|
||||
@@ -914,7 +954,7 @@ module ts {
|
||||
// Current character is known to be a backslash. Check for Unicode escape of the form '\uXXXX'
|
||||
// and return code point value if valid Unicode escape is found. Otherwise return -1.
|
||||
function peekUnicodeEscape(): number {
|
||||
if (pos + 5 < len && text.charCodeAt(pos + 1) === CharacterCodes.u) {
|
||||
if (pos + 5 < end && text.charCodeAt(pos + 1) === CharacterCodes.u) {
|
||||
let start = pos;
|
||||
pos += 2;
|
||||
let value = scanExactNumberOfHexDigits(4);
|
||||
@@ -927,7 +967,7 @@ module ts {
|
||||
function scanIdentifierParts(): string {
|
||||
let result = "";
|
||||
let start = pos;
|
||||
while (pos < len) {
|
||||
while (pos < end) {
|
||||
let ch = text.charCodeAt(pos);
|
||||
if (isIdentifierPart(ch)) {
|
||||
pos++;
|
||||
@@ -994,7 +1034,7 @@ module ts {
|
||||
tokenIsUnterminated = false;
|
||||
while (true) {
|
||||
tokenPos = pos;
|
||||
if (pos >= len) {
|
||||
if (pos >= end) {
|
||||
return token = SyntaxKind.EndOfFileToken;
|
||||
}
|
||||
let ch = text.charCodeAt(pos);
|
||||
@@ -1007,7 +1047,7 @@ module ts {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
if (ch === CharacterCodes.carriageReturn && pos + 1 < len && text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) {
|
||||
if (ch === CharacterCodes.carriageReturn && pos + 1 < end && text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) {
|
||||
// consume both CR and LF
|
||||
pos += 2;
|
||||
}
|
||||
@@ -1025,7 +1065,7 @@ module ts {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
while (pos < len && isWhiteSpace(text.charCodeAt(pos))) {
|
||||
while (pos < end && isWhiteSpace(text.charCodeAt(pos))) {
|
||||
pos++;
|
||||
}
|
||||
return token = SyntaxKind.WhitespaceTrivia;
|
||||
@@ -1098,7 +1138,7 @@ module ts {
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.slash) {
|
||||
pos += 2;
|
||||
|
||||
while (pos < len) {
|
||||
while (pos < end) {
|
||||
if (isLineBreak(text.charCodeAt(pos))) {
|
||||
break;
|
||||
}
|
||||
@@ -1118,7 +1158,7 @@ module ts {
|
||||
pos += 2;
|
||||
|
||||
let commentClosed = false;
|
||||
while (pos < len) {
|
||||
while (pos < end) {
|
||||
let ch = text.charCodeAt(pos);
|
||||
|
||||
if (ch === CharacterCodes.asterisk && text.charCodeAt(pos + 1) === CharacterCodes.slash) {
|
||||
@@ -1153,7 +1193,7 @@ module ts {
|
||||
return pos++, token = SyntaxKind.SlashToken;
|
||||
|
||||
case CharacterCodes._0:
|
||||
if (pos + 2 < len && (text.charCodeAt(pos + 1) === CharacterCodes.X || text.charCodeAt(pos + 1) === CharacterCodes.x)) {
|
||||
if (pos + 2 < end && (text.charCodeAt(pos + 1) === CharacterCodes.X || text.charCodeAt(pos + 1) === CharacterCodes.x)) {
|
||||
pos += 2;
|
||||
let value = scanMinimumNumberOfHexDigits(1);
|
||||
if (value < 0) {
|
||||
@@ -1163,7 +1203,7 @@ module ts {
|
||||
tokenValue = "" + value;
|
||||
return token = SyntaxKind.NumericLiteral;
|
||||
}
|
||||
else if (pos + 2 < len && (text.charCodeAt(pos + 1) === CharacterCodes.B || text.charCodeAt(pos + 1) === CharacterCodes.b)) {
|
||||
else if (pos + 2 < end && (text.charCodeAt(pos + 1) === CharacterCodes.B || text.charCodeAt(pos + 1) === CharacterCodes.b)) {
|
||||
pos += 2;
|
||||
let value = scanBinaryOrOctalDigits(/* base */ 2);
|
||||
if (value < 0) {
|
||||
@@ -1173,7 +1213,7 @@ module ts {
|
||||
tokenValue = "" + value;
|
||||
return token = SyntaxKind.NumericLiteral;
|
||||
}
|
||||
else if (pos + 2 < len && (text.charCodeAt(pos + 1) === CharacterCodes.O || text.charCodeAt(pos + 1) === CharacterCodes.o)) {
|
||||
else if (pos + 2 < end && (text.charCodeAt(pos + 1) === CharacterCodes.O || text.charCodeAt(pos + 1) === CharacterCodes.o)) {
|
||||
pos += 2;
|
||||
let value = scanBinaryOrOctalDigits(/* base */ 8);
|
||||
if (value < 0) {
|
||||
@@ -1184,7 +1224,7 @@ module ts {
|
||||
return token = SyntaxKind.NumericLiteral;
|
||||
}
|
||||
// Try to parse as an octal
|
||||
if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) {
|
||||
if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) {
|
||||
tokenValue = "" + scanOctalDigits();
|
||||
return token = SyntaxKind.NumericLiteral;
|
||||
}
|
||||
@@ -1299,7 +1339,7 @@ module ts {
|
||||
default:
|
||||
if (isIdentifierStart(ch)) {
|
||||
pos++;
|
||||
while (pos < len && isIdentifierPart(ch = text.charCodeAt(pos))) pos++;
|
||||
while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos))) pos++;
|
||||
tokenValue = text.substring(tokenPos, pos);
|
||||
if (ch === CharacterCodes.backslash) {
|
||||
tokenValue += scanIdentifierParts();
|
||||
@@ -1350,7 +1390,7 @@ module ts {
|
||||
while (true) {
|
||||
// If we reach the end of a file, or hit a newline, then this is an unterminated
|
||||
// regex. Report error and return what we have so far.
|
||||
if (p >= len) {
|
||||
if (p >= end) {
|
||||
tokenIsUnterminated = true;
|
||||
error(Diagnostics.Unterminated_regular_expression_literal)
|
||||
break;
|
||||
@@ -1386,7 +1426,7 @@ module ts {
|
||||
p++;
|
||||
}
|
||||
|
||||
while (p < len && isIdentifierPart(text.charCodeAt(p))) {
|
||||
while (p < end && isIdentifierPart(text.charCodeAt(p))) {
|
||||
p++;
|
||||
}
|
||||
pos = p;
|
||||
@@ -1435,43 +1475,31 @@ module ts {
|
||||
return speculationHelper(callback, /*isLookahead:*/ false);
|
||||
}
|
||||
|
||||
function setText(newText: string) {
|
||||
function setText(newText: string, start: number, length: number) {
|
||||
text = newText || "";
|
||||
len = text.length;
|
||||
setTextPos(0);
|
||||
end = length === undefined ? text.length : start + length;
|
||||
setTextPos(start || 0);
|
||||
}
|
||||
|
||||
function setOnError(errorCallback: ErrorCallback) {
|
||||
onError = errorCallback;
|
||||
}
|
||||
|
||||
function setScriptTarget(scriptTarget: ScriptTarget) {
|
||||
languageVersion = scriptTarget;
|
||||
}
|
||||
|
||||
function setTextPos(textPos: number) {
|
||||
Debug.assert(textPos >= 0);
|
||||
pos = textPos;
|
||||
startPos = textPos;
|
||||
tokenPos = textPos;
|
||||
token = SyntaxKind.Unknown;
|
||||
precedingLineBreak = false;
|
||||
|
||||
tokenValue = undefined;
|
||||
hasExtendedUnicodeEscape = false;
|
||||
tokenIsUnterminated = false;
|
||||
}
|
||||
|
||||
setText(text);
|
||||
|
||||
|
||||
return {
|
||||
getStartPos: () => startPos,
|
||||
getTextPos: () => pos,
|
||||
getToken: () => token,
|
||||
getTokenPos: () => tokenPos,
|
||||
getTokenText: () => text.substring(tokenPos, pos),
|
||||
getTokenValue: () => tokenValue,
|
||||
hasExtendedUnicodeEscape: () => hasExtendedUnicodeEscape,
|
||||
hasPrecedingLineBreak: () => precedingLineBreak,
|
||||
isIdentifier: () => token === SyntaxKind.Identifier || token > SyntaxKind.LastReservedWord,
|
||||
isReservedWord: () => token >= SyntaxKind.FirstReservedWord && token <= SyntaxKind.LastReservedWord,
|
||||
isUnterminated: () => tokenIsUnterminated,
|
||||
reScanGreaterToken,
|
||||
reScanSlashToken,
|
||||
reScanTemplateToken,
|
||||
scan,
|
||||
setText,
|
||||
setTextPos,
|
||||
tryScan,
|
||||
lookAhead,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -6,17 +6,17 @@ module ts {
|
||||
newLine: string;
|
||||
useCaseSensitiveFileNames: boolean;
|
||||
write(s: string): void;
|
||||
readFile(fileName: string, encoding?: string): string;
|
||||
writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile? (fileName: string, callback: (fileName: string) => void): FileWatcher;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string) => void): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
createDirectory(directoryName: string): void;
|
||||
createDirectory(path: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
readDirectory(path: string, extension?: string): string[];
|
||||
getMemoryUsage? (): number;
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
|
||||
|
||||
+111
-57
@@ -121,7 +121,6 @@ module ts {
|
||||
WhileKeyword,
|
||||
WithKeyword,
|
||||
// Strict mode reserved words
|
||||
AsKeyword,
|
||||
ImplementsKeyword,
|
||||
InterfaceKeyword,
|
||||
LetKeyword,
|
||||
@@ -132,6 +131,7 @@ module ts {
|
||||
StaticKeyword,
|
||||
YieldKeyword,
|
||||
// Contextual keywords
|
||||
AsKeyword,
|
||||
AnyKeyword,
|
||||
BooleanKeyword,
|
||||
ConstructorKeyword,
|
||||
@@ -320,6 +320,7 @@ module ts {
|
||||
BlockScoped = Let | Const
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum ParserContextFlags {
|
||||
// Set if this node was parsed in strict mode. Used for grammar error checks, as well as
|
||||
// checking if the node can be reused in incremental settings.
|
||||
@@ -355,6 +356,7 @@ module ts {
|
||||
HasAggregatedChildData = 1 << 7
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum RelationComparisonResult {
|
||||
Succeeded = 1, // Should be truthy
|
||||
Failed = 2,
|
||||
@@ -366,15 +368,15 @@ module ts {
|
||||
flags: NodeFlags;
|
||||
// Specific context the parser was in when this node was created. Normally undefined.
|
||||
// Only set when the parser was in some interesting context (like async/yield).
|
||||
parserContextFlags?: ParserContextFlags;
|
||||
decorators?: NodeArray<Decorator>; // Array of decorators (in document order)
|
||||
modifiers?: ModifiersArray; // Array of modifiers
|
||||
id?: number; // Unique id (used to look up NodeLinks)
|
||||
parent?: Node; // Parent node (initialized by binding)
|
||||
symbol?: Symbol; // Symbol declared by node (initialized by binding)
|
||||
locals?: SymbolTable; // Locals associated with node (initialized by binding)
|
||||
nextContainer?: Node; // Next container in declaration order (initialized by binding)
|
||||
localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
|
||||
/* @internal */ parserContextFlags?: ParserContextFlags;
|
||||
decorators?: NodeArray<Decorator>; // Array of decorators (in document order)
|
||||
modifiers?: ModifiersArray; // Array of modifiers
|
||||
/* @internal */ id?: number; // Unique id (used to look up NodeLinks)
|
||||
parent?: Node; // Parent node (initialized by binding)
|
||||
/* @internal */ symbol?: Symbol; // Symbol declared by node (initialized by binding)
|
||||
/* @internal */ locals?: SymbolTable; // Locals associated with node (initialized by binding)
|
||||
/* @internal */ nextContainer?: Node; // Next container in declaration order (initialized by binding)
|
||||
/* @internal */ localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes)
|
||||
}
|
||||
|
||||
export interface NodeArray<T> extends Array<T>, TextRange {
|
||||
@@ -386,7 +388,8 @@ module ts {
|
||||
}
|
||||
|
||||
export interface Identifier extends PrimaryExpression {
|
||||
text: string; // Text of identifier (with escapes converted to characters)
|
||||
text: string; // Text of identifier (with escapes converted to characters)
|
||||
originalKeywordKind?: SyntaxKind; // Original syntaxKind which get set so that we can report an error later
|
||||
}
|
||||
|
||||
export interface QualifiedName extends Node {
|
||||
@@ -593,7 +596,11 @@ module ts {
|
||||
type: TypeNode;
|
||||
}
|
||||
|
||||
export interface StringLiteralTypeNode extends LiteralExpression, TypeNode { }
|
||||
// Note that a StringLiteral AST node is both an Expression and a TypeNode. The latter is
|
||||
// because string literals can appear in the type annotation of a parameter node.
|
||||
export interface StringLiteral extends LiteralExpression, TypeNode {
|
||||
_stringLiteralBrand: any;
|
||||
}
|
||||
|
||||
// Note: 'brands' in our syntax nodes serve to give us a small amount of nominal typing.
|
||||
// Consider 'Expression'. Without the brand, 'Expression' is actually no different
|
||||
@@ -686,10 +693,6 @@ module ts {
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
}
|
||||
|
||||
export interface StringLiteralExpression extends LiteralExpression {
|
||||
_stringLiteralExpressionBrand: any;
|
||||
}
|
||||
|
||||
export interface TemplateExpression extends PrimaryExpression {
|
||||
head: LiteralExpression;
|
||||
templateSpans: NodeArray<TemplateSpan>;
|
||||
@@ -736,7 +739,7 @@ module ts {
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
|
||||
export interface HeritageClauseElement extends Node {
|
||||
export interface HeritageClauseElement extends TypeNode {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
@@ -975,8 +978,7 @@ module ts {
|
||||
|
||||
export interface ExportAssignment extends Declaration, ModuleElement {
|
||||
isExportEquals?: boolean;
|
||||
expression?: Expression;
|
||||
type?: TypeNode;
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
export interface FileReference extends TextRange {
|
||||
@@ -985,6 +987,7 @@ module ts {
|
||||
|
||||
export interface CommentRange extends TextRange {
|
||||
hasTrailingNewLine?: boolean;
|
||||
kind: SyntaxKind;
|
||||
}
|
||||
|
||||
// Source files are declarations when they are external modules.
|
||||
@@ -1001,11 +1004,12 @@ module ts {
|
||||
|
||||
hasNoDefaultLib: boolean;
|
||||
|
||||
// The first node that causes this file to be an external module
|
||||
externalModuleIndicator: Node;
|
||||
languageVersion: ScriptTarget;
|
||||
identifiers: Map<string>;
|
||||
|
||||
// The first node that causes this file to be an external module
|
||||
/* @internal */ externalModuleIndicator: Node;
|
||||
|
||||
/* @internal */ identifiers: Map<string>;
|
||||
/* @internal */ nodeCount: number;
|
||||
/* @internal */ identifierCount: number;
|
||||
/* @internal */ symbolCount: number;
|
||||
@@ -1033,6 +1037,9 @@ module ts {
|
||||
}
|
||||
|
||||
export interface Program extends ScriptReferenceHost {
|
||||
/**
|
||||
* Get a list of files in the program
|
||||
*/
|
||||
getSourceFiles(): SourceFile[];
|
||||
|
||||
/**
|
||||
@@ -1052,10 +1059,12 @@ module ts {
|
||||
getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
|
||||
// Gets a type checker that can be used to semantically analyze source fils in the program.
|
||||
/**
|
||||
* Gets a type checker that can be used to semantically analyze source fils in the program.
|
||||
*/
|
||||
getTypeChecker(): TypeChecker;
|
||||
|
||||
getCommonSourceDirectory(): string;
|
||||
/* @internal */ getCommonSourceDirectory(): string;
|
||||
|
||||
// For testing purposes only. Should not be used by any other consumers (including the
|
||||
// language service).
|
||||
@@ -1068,12 +1077,18 @@ module ts {
|
||||
}
|
||||
|
||||
export interface SourceMapSpan {
|
||||
emittedLine: number; // Line number in the .js file
|
||||
emittedColumn: number; // Column number in the .js file
|
||||
sourceLine: number; // Line number in the .ts file
|
||||
sourceColumn: number; // Column number in the .ts file
|
||||
nameIndex?: number; // Optional name (index into names array) associated with this span
|
||||
sourceIndex: number; // .ts file (index into sources array) associated with this span*/
|
||||
/** Line number in the .js file. */
|
||||
emittedLine: number;
|
||||
/** Column number in the .js file. */
|
||||
emittedColumn: number;
|
||||
/** Line number in the .ts file. */
|
||||
sourceLine: number;
|
||||
/** Column number in the .ts file. */
|
||||
sourceColumn: number;
|
||||
/** Optional name (index into names array) associated with this span. */
|
||||
nameIndex?: number;
|
||||
/** .ts file (index into sources array) associated with this span */
|
||||
sourceIndex: number;
|
||||
}
|
||||
|
||||
export interface SourceMapData {
|
||||
@@ -1088,7 +1103,7 @@ module ts {
|
||||
sourceMapDecodedMappings: SourceMapSpan[]; // Raw source map spans that were encoded into the sourceMapMappings
|
||||
}
|
||||
|
||||
// Return code used by getEmitOutput function to indicate status of the function
|
||||
/** Return code used by getEmitOutput function to indicate status of the function */
|
||||
export enum ExitStatus {
|
||||
// Compiler ran successfully. Either this was a simple do-nothing compilation (for example,
|
||||
// when -version or -help was provided, or this was a normal compilation, no diagnostics
|
||||
@@ -1105,7 +1120,7 @@ module ts {
|
||||
export interface EmitResult {
|
||||
emitSkipped: boolean;
|
||||
diagnostics: Diagnostic[];
|
||||
sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps
|
||||
/* @internal */ sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps
|
||||
}
|
||||
|
||||
export interface TypeCheckerHost {
|
||||
@@ -1124,8 +1139,6 @@ module ts {
|
||||
getIndexTypeOfType(type: Type, kind: IndexKind): Type;
|
||||
getReturnTypeOfSignature(signature: Signature): Type;
|
||||
|
||||
// If 'predicate' is supplied, then only the first symbol in scope matching the predicate
|
||||
// will be returned. Otherwise, all symbols in scope will be returned.
|
||||
getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[];
|
||||
getSymbolAtLocation(node: Node): Symbol;
|
||||
getShorthandAssignmentValueSymbol(location: Node): Symbol;
|
||||
@@ -1217,14 +1230,17 @@ module ts {
|
||||
UseOnlyExternalAliasing = 0x00000002,
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum SymbolAccessibility {
|
||||
Accessible,
|
||||
NotAccessible,
|
||||
CannotBeNamed
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
|
||||
/* @internal */
|
||||
export interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: AnyImportSyntax[]; // aliases that need to have this symbol visible
|
||||
@@ -1232,10 +1248,12 @@ module ts {
|
||||
errorNode?: Node; // optional node that results in error
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface SymbolAccessiblityResult extends SymbolVisibilityResult {
|
||||
errorModuleName?: string // If the symbol is not visible from module, module's name
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface EmitResolver {
|
||||
hasGlobalName(name: string): boolean;
|
||||
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
|
||||
@@ -1340,19 +1358,20 @@ module ts {
|
||||
}
|
||||
|
||||
export interface Symbol {
|
||||
flags: SymbolFlags; // Symbol flags
|
||||
name: string; // Name of symbol
|
||||
id?: number; // Unique id (used to look up SymbolLinks)
|
||||
mergeId?: number; // Merge id (used to look up merged symbol)
|
||||
declarations?: Declaration[]; // Declarations associated with this symbol
|
||||
parent?: Symbol; // Parent symbol
|
||||
members?: SymbolTable; // Class, interface or literal instance members
|
||||
exports?: SymbolTable; // Module exports
|
||||
exportSymbol?: Symbol; // Exported symbol associated with this symbol
|
||||
valueDeclaration?: Declaration // First value declaration of the symbol
|
||||
constEnumOnlyModule?: boolean // True if module contains only const enums or other modules with only const enums
|
||||
flags: SymbolFlags; // Symbol flags
|
||||
name: string; // Name of symbol
|
||||
/* @internal */ id?: number; // Unique id (used to look up SymbolLinks)
|
||||
/* @internal */ mergeId?: number; // Merge id (used to look up merged symbol)
|
||||
declarations?: Declaration[]; // Declarations associated with this symbol
|
||||
/* @internal */ parent?: Symbol; // Parent symbol
|
||||
members?: SymbolTable; // Class, interface or literal instance members
|
||||
exports?: SymbolTable; // Module exports
|
||||
/* @internal */ exportSymbol?: Symbol; // Exported symbol associated with this symbol
|
||||
valueDeclaration?: Declaration; // First value declaration of the symbol
|
||||
/* @internal */ constEnumOnlyModule?: boolean; // True if module contains only const enums or other modules with only const enums
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface SymbolLinks {
|
||||
target?: Symbol; // Resolved (non-alias) target of an alias
|
||||
type?: Type; // Type of value symbol
|
||||
@@ -1364,12 +1383,14 @@ module ts {
|
||||
exportsChecked?: boolean; // True if exports of external module have been checked
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface TransientSymbol extends Symbol, SymbolLinks { }
|
||||
|
||||
export interface SymbolTable {
|
||||
[index: string]: Symbol;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum NodeCheckFlags {
|
||||
TypeChecked = 0x00000001, // Node has been type checked
|
||||
LexicalThis = 0x00000002, // Lexical 'this' reference
|
||||
@@ -1384,8 +1405,10 @@ module ts {
|
||||
BlockScopedBindingInLoop = 0x00000100,
|
||||
EmitDecorate = 0x00000200, // Emit __decorate
|
||||
EmitParam = 0x00000400, // Emit __param helper for decorators
|
||||
LexicalModuleMergesWithClass = 0x00000800, // Instantiated lexical module declaration is merged with a previous class declaration.
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface NodeLinks {
|
||||
resolvedType?: Type; // Cached type of type node
|
||||
resolvedSignature?: Signature; // Cached signature of signature node or call expression
|
||||
@@ -1418,27 +1441,34 @@ module ts {
|
||||
Tuple = 0x00002000, // Tuple
|
||||
Union = 0x00004000, // Union
|
||||
Anonymous = 0x00008000, // Anonymous
|
||||
/* @internal */
|
||||
FromSignature = 0x00010000, // Created for signature assignment check
|
||||
ObjectLiteral = 0x00020000, // Originates in an object literal
|
||||
/* @internal */
|
||||
ContainsUndefinedOrNull = 0x00040000, // Type is or contains Undefined or Null type
|
||||
ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type
|
||||
/* @internal */
|
||||
ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type
|
||||
ESSymbol = 0x00100000, // Type of symbol primitive introduced in ES6
|
||||
|
||||
/* @internal */
|
||||
Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null,
|
||||
/* @internal */
|
||||
Primitive = String | Number | Boolean | ESSymbol | Void | Undefined | Null | StringLiteral | Enum,
|
||||
StringLike = String | StringLiteral,
|
||||
NumberLike = Number | Enum,
|
||||
ObjectType = Class | Interface | Reference | Tuple | Anonymous,
|
||||
/* @internal */
|
||||
RequiresWidening = ContainsUndefinedOrNull | ContainsObjectLiteral
|
||||
}
|
||||
|
||||
// Properties common to all types
|
||||
export interface Type {
|
||||
flags: TypeFlags; // Flags
|
||||
id: number; // Unique ID
|
||||
symbol?: Symbol; // Symbol associated with type (if any)
|
||||
flags: TypeFlags; // Flags
|
||||
/* @internal */ id: number; // Unique ID
|
||||
symbol?: Symbol; // Symbol associated with type (if any)
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
// Intrinsic types (TypeFlags.Intrinsic)
|
||||
export interface IntrinsicType extends Type {
|
||||
intrinsicName: string; // Name of intrinsic type
|
||||
@@ -1455,7 +1485,6 @@ module ts {
|
||||
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
|
||||
export interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
|
||||
baseTypes: ObjectType[]; // Base types
|
||||
declaredProperties: Symbol[]; // Declared members
|
||||
declaredCallSignatures: Signature[]; // Declared call signatures
|
||||
declaredConstructSignatures: Signature[]; // Declared construct signatures
|
||||
@@ -1463,6 +1492,10 @@ module ts {
|
||||
declaredNumberIndexType: Type; // Declared numeric index type
|
||||
}
|
||||
|
||||
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
}
|
||||
|
||||
// Type references (TypeFlags.Reference)
|
||||
export interface TypeReference extends ObjectType {
|
||||
target: GenericType; // Type reference target
|
||||
@@ -1471,6 +1504,7 @@ module ts {
|
||||
|
||||
// Generic class and interface types
|
||||
export interface GenericType extends InterfaceType, TypeReference {
|
||||
/* @internal */
|
||||
instantiations: Map<TypeReference>; // Generic instantiation cache
|
||||
}
|
||||
|
||||
@@ -1481,9 +1515,13 @@ module ts {
|
||||
|
||||
export interface UnionType extends Type {
|
||||
types: Type[]; // Constituent types
|
||||
/* @internal */
|
||||
reducedType: Type; // Reduced union type (all subtypes removed)
|
||||
/* @internal */
|
||||
resolvedProperties: SymbolTable; // Cache of resolved properties
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
// Resolved object or union type
|
||||
export interface ResolvedType extends ObjectType, UnionType {
|
||||
members: SymbolTable; // Properties by name
|
||||
@@ -1497,7 +1535,9 @@ module ts {
|
||||
// Type parameters (TypeFlags.TypeParameter)
|
||||
export interface TypeParameter extends Type {
|
||||
constraint: Type; // Constraint
|
||||
/* @internal */
|
||||
target?: TypeParameter; // Instantiation target
|
||||
/* @internal */
|
||||
mapper?: TypeMapper; // Instantiation mapper
|
||||
}
|
||||
|
||||
@@ -1510,14 +1550,23 @@ module ts {
|
||||
declaration: SignatureDeclaration; // Originating declaration
|
||||
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
|
||||
parameters: Symbol[]; // Parameters
|
||||
/* @internal */
|
||||
resolvedReturnType: Type; // Resolved return type
|
||||
/* @internal */
|
||||
minArgumentCount: number; // Number of non-optional parameters
|
||||
/* @internal */
|
||||
hasRestParameter: boolean; // True if last parameter is rest parameter
|
||||
/* @internal */
|
||||
hasStringLiterals: boolean; // True if specialized
|
||||
/* @internal */
|
||||
target?: Signature; // Instantiation target
|
||||
/* @internal */
|
||||
mapper?: TypeMapper; // Instantiation mapper
|
||||
/* @internal */
|
||||
unionSignatures?: Signature[]; // Underlying signatures of a union signature
|
||||
/* @internal */
|
||||
erasedSignatureCache?: Signature; // Erased version of signature (deferred)
|
||||
/* @internal */
|
||||
isolatedSignatureType?: ObjectType; // A manufactured type that just contains the signature for purposes of signature comparison
|
||||
}
|
||||
|
||||
@@ -1526,11 +1575,12 @@ module ts {
|
||||
Number,
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface TypeMapper {
|
||||
(t: Type): Type;
|
||||
}
|
||||
|
||||
// @internal
|
||||
/* @internal */
|
||||
export interface TypeInferences {
|
||||
primary: Type[]; // Inferences made directly to a type parameter
|
||||
secondary: Type[]; // Inferences made to a type parameter in a union type
|
||||
@@ -1538,7 +1588,7 @@ module ts {
|
||||
// If a type parameter is fixed, no more inferences can be made for the type parameter
|
||||
}
|
||||
|
||||
// @internal
|
||||
/* @internal */
|
||||
export interface InferenceContext {
|
||||
typeParameters: TypeParameter[]; // Type parameters for which inferences are made
|
||||
inferUnionTypes: boolean; // Infer union types for disjoint candidates (otherwise undefinedType)
|
||||
@@ -1554,10 +1604,12 @@ module ts {
|
||||
code: number;
|
||||
}
|
||||
|
||||
// A linked list of formatted diagnostic messages to be used as part of a multiline message.
|
||||
// It is built from the bottom up, leaving the head to be the "main" diagnostic.
|
||||
// While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage,
|
||||
// the difference is that messages are all preformatted in DMC.
|
||||
/**
|
||||
* A linked list of formatted diagnostic messages to be used as part of a multiline message.
|
||||
* It is built from the bottom up, leaving the head to be the "main" diagnostic.
|
||||
* While it seems that DiagnosticMessageChain is structurally similar to DiagnosticMessage,
|
||||
* the difference is that messages are all preformatted in DMC.
|
||||
*/
|
||||
export interface DiagnosticMessageChain {
|
||||
messageText: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1641,6 +1693,7 @@ module ts {
|
||||
errors: Diagnostic[];
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface CommandLineOption {
|
||||
name: string;
|
||||
type: string | Map<number>; // "string", "number", "boolean", or an object literal mapping named values to actual values
|
||||
@@ -1652,6 +1705,7 @@ module ts {
|
||||
experimental?: boolean;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export const enum CharacterCodes {
|
||||
nullCharacter = 0,
|
||||
maxAsciiCharacter = 0x7F,
|
||||
@@ -1813,7 +1867,7 @@ module ts {
|
||||
newLength: number;
|
||||
}
|
||||
|
||||
// @internal
|
||||
/* @internal */
|
||||
export interface DiagnosticCollection {
|
||||
// Adds a diagnostic to this diagnostic collection.
|
||||
add(diagnostic: Diagnostic): void;
|
||||
|
||||
+289
-219
@@ -1,5 +1,6 @@
|
||||
/// <reference path="binder.ts" />
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
export interface ReferencePathMatchResult {
|
||||
fileReference?: FileReference
|
||||
@@ -160,6 +161,14 @@ module ts {
|
||||
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
|
||||
}
|
||||
|
||||
export function getNonDecoratorTokenPosOfNode(node: Node, sourceFile?: SourceFile): number {
|
||||
if (nodeIsMissing(node) || !node.decorators) {
|
||||
return getTokenPosOfNode(node, sourceFile);
|
||||
}
|
||||
|
||||
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.decorators.end);
|
||||
}
|
||||
|
||||
export function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node): string {
|
||||
if (nodeIsMissing(node)) {
|
||||
return "";
|
||||
@@ -202,8 +211,10 @@ module ts {
|
||||
isCatchClauseVariableDeclaration(declaration);
|
||||
}
|
||||
|
||||
// Gets the nearest enclosing block scope container that has the provided node
|
||||
// as a descendant, that is not the provided node.
|
||||
export function getEnclosingBlockScopeContainer(node: Node): Node {
|
||||
let current = node;
|
||||
let current = node.parent;
|
||||
while (current) {
|
||||
if (isFunctionLike(current)) {
|
||||
return current;
|
||||
@@ -262,10 +273,8 @@ module ts {
|
||||
};
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function getSpanOfTokenAtPosition(sourceFile: SourceFile, pos: number): TextSpan {
|
||||
let scanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/ true, sourceFile.text);
|
||||
scanner.setTextPos(pos);
|
||||
let scanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/ true, sourceFile.text, /*onError:*/ undefined, pos);
|
||||
scanner.scan();
|
||||
let start = scanner.getTokenPos();
|
||||
return createTextSpanFromBounds(start, scanner.getTextPos());
|
||||
@@ -399,7 +408,6 @@ module ts {
|
||||
|
||||
export let fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/
|
||||
|
||||
|
||||
// Warning: This has the same semantics as the forEach family of functions,
|
||||
// in that traversal terminates in the event that 'visitor' supplies a truthy value.
|
||||
export function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T {
|
||||
@@ -430,7 +438,6 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function isVariableLike(node: Node): boolean {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
@@ -780,6 +787,8 @@ module ts {
|
||||
return node === (<TemplateSpan>parent).expression;
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
return node === (<ComputedPropertyName>parent).expression;
|
||||
case SyntaxKind.Decorator:
|
||||
return true;
|
||||
default:
|
||||
if (isExpression(parent)) {
|
||||
return true;
|
||||
@@ -1140,218 +1149,7 @@ module ts {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function textSpanEnd(span: TextSpan) {
|
||||
return span.start + span.length
|
||||
}
|
||||
|
||||
export function textSpanIsEmpty(span: TextSpan) {
|
||||
return span.length === 0
|
||||
}
|
||||
|
||||
export function textSpanContainsPosition(span: TextSpan, position: number) {
|
||||
return position >= span.start && position < textSpanEnd(span);
|
||||
}
|
||||
|
||||
// Returns true if 'span' contains 'other'.
|
||||
export function textSpanContainsTextSpan(span: TextSpan, other: TextSpan) {
|
||||
return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);
|
||||
}
|
||||
|
||||
export function textSpanOverlapsWith(span: TextSpan, other: TextSpan) {
|
||||
let overlapStart = Math.max(span.start, other.start);
|
||||
let overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other));
|
||||
return overlapStart < overlapEnd;
|
||||
}
|
||||
|
||||
export function textSpanOverlap(span1: TextSpan, span2: TextSpan) {
|
||||
let overlapStart = Math.max(span1.start, span2.start);
|
||||
let overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));
|
||||
if (overlapStart < overlapEnd) {
|
||||
return createTextSpanFromBounds(overlapStart, overlapEnd);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan) {
|
||||
return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start
|
||||
}
|
||||
|
||||
export function textSpanIntersectsWith(span: TextSpan, start: number, length: number) {
|
||||
let end = start + length;
|
||||
return start <= textSpanEnd(span) && end >= span.start;
|
||||
}
|
||||
|
||||
export function textSpanIntersectsWithPosition(span: TextSpan, position: number) {
|
||||
return position <= textSpanEnd(span) && position >= span.start;
|
||||
}
|
||||
|
||||
export function textSpanIntersection(span1: TextSpan, span2: TextSpan) {
|
||||
let intersectStart = Math.max(span1.start, span2.start);
|
||||
let intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));
|
||||
if (intersectStart <= intersectEnd) {
|
||||
return createTextSpanFromBounds(intersectStart, intersectEnd);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function createTextSpan(start: number, length: number): TextSpan {
|
||||
if (start < 0) {
|
||||
throw new Error("start < 0");
|
||||
}
|
||||
if (length < 0) {
|
||||
throw new Error("length < 0");
|
||||
}
|
||||
|
||||
return { start, length };
|
||||
}
|
||||
|
||||
export function createTextSpanFromBounds(start: number, end: number) {
|
||||
return createTextSpan(start, end - start);
|
||||
}
|
||||
|
||||
export function textChangeRangeNewSpan(range: TextChangeRange) {
|
||||
return createTextSpan(range.span.start, range.newLength);
|
||||
}
|
||||
|
||||
export function textChangeRangeIsUnchanged(range: TextChangeRange) {
|
||||
return textSpanIsEmpty(range.span) && range.newLength === 0;
|
||||
}
|
||||
|
||||
export function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange {
|
||||
if (newLength < 0) {
|
||||
throw new Error("newLength < 0");
|
||||
}
|
||||
|
||||
return { span, newLength };
|
||||
}
|
||||
|
||||
export let unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0);
|
||||
|
||||
/**
|
||||
* Called to merge all the changes that occurred across several versions of a script snapshot
|
||||
* into a single change. i.e. if a user keeps making successive edits to a script we will
|
||||
* have a text change from V1 to V2, V2 to V3, ..., Vn.
|
||||
*
|
||||
* This function will then merge those changes into a single change range valid between V1 and
|
||||
* Vn.
|
||||
*/
|
||||
export function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange {
|
||||
if (changes.length === 0) {
|
||||
return unchangedTextChangeRange;
|
||||
}
|
||||
|
||||
if (changes.length === 1) {
|
||||
return changes[0];
|
||||
}
|
||||
|
||||
// We change from talking about { { oldStart, oldLength }, newLength } to { oldStart, oldEnd, newEnd }
|
||||
// as it makes things much easier to reason about.
|
||||
let change0 = changes[0];
|
||||
|
||||
let oldStartN = change0.span.start;
|
||||
let oldEndN = textSpanEnd(change0.span);
|
||||
let newEndN = oldStartN + change0.newLength;
|
||||
|
||||
for (let i = 1; i < changes.length; i++) {
|
||||
let nextChange = changes[i];
|
||||
|
||||
// Consider the following case:
|
||||
// i.e. two edits. The first represents the text change range { { 10, 50 }, 30 }. i.e. The span starting
|
||||
// at 10, with length 50 is reduced to length 30. The second represents the text change range { { 30, 30 }, 40 }.
|
||||
// i.e. the span starting at 30 with length 30 is increased to length 40.
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
// | \
|
||||
// | \
|
||||
// T2 | \
|
||||
// | \
|
||||
// | \
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Merging these turns out to not be too difficult. First, determining the new start of the change is trivial
|
||||
// it's just the min of the old and new starts. i.e.:
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// ------------------------------------------------------------*------------------------------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// ----------------------------------------$-------------------$------------------------------------------
|
||||
// . | \
|
||||
// . | \
|
||||
// T2 . | \
|
||||
// . | \
|
||||
// . | \
|
||||
// ----------------------------------------------------------------------*--------------------------------
|
||||
//
|
||||
// (Note the dots represent the newly inferrred start.
|
||||
// Determining the new and old end is also pretty simple. Basically it boils down to paying attention to the
|
||||
// absolute positions at the asterixes, and the relative change between the dollar signs. Basically, we see
|
||||
// which if the two $'s precedes the other, and we move that one forward until they line up. in this case that
|
||||
// means:
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// --------------------------------------------------------------------------------*----------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// ------------------------------------------------------------$------------------------------------------
|
||||
// . | \
|
||||
// . | \
|
||||
// T2 . | \
|
||||
// . | \
|
||||
// . | \
|
||||
// ----------------------------------------------------------------------*--------------------------------
|
||||
//
|
||||
// In other words (in this case), we're recognizing that the second edit happened after where the first edit
|
||||
// ended with a delta of 20 characters (60 - 40). Thus, if we go back in time to where the first edit started
|
||||
// that's the same as if we started at char 80 instead of 60.
|
||||
//
|
||||
// As it so happens, the same logic applies if the second edit precedes the first edit. In that case rahter
|
||||
// than pusing the first edit forward to match the second, we'll push the second edit forward to match the
|
||||
// first.
|
||||
//
|
||||
// In this case that means we have { oldStart: 10, oldEnd: 80, newEnd: 70 } or, in TextChangeRange
|
||||
// semantics: { { start: 10, length: 70 }, newLength: 60 }
|
||||
//
|
||||
// The math then works out as follows.
|
||||
// If we have { oldStart1, oldEnd1, newEnd1 } and { oldStart2, oldEnd2, newEnd2 } then we can compute the
|
||||
// final result like so:
|
||||
//
|
||||
// {
|
||||
// oldStart3: Min(oldStart1, oldStart2),
|
||||
// oldEnd3 : Max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)),
|
||||
// newEnd3 : Max(newEnd2, newEnd2 + (newEnd1 - oldEnd2))
|
||||
// }
|
||||
|
||||
let oldStart1 = oldStartN;
|
||||
let oldEnd1 = oldEndN;
|
||||
let newEnd1 = newEndN;
|
||||
|
||||
let oldStart2 = nextChange.span.start;
|
||||
let oldEnd2 = textSpanEnd(nextChange.span);
|
||||
let newEnd2 = oldStart2 + nextChange.newLength;
|
||||
|
||||
oldStartN = Math.min(oldStart1, oldStart2);
|
||||
oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1));
|
||||
newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));
|
||||
}
|
||||
|
||||
return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength:*/ newEndN - oldStartN);
|
||||
}
|
||||
|
||||
|
||||
export function nodeStartsNewLexicalEnvironment(n: Node): boolean {
|
||||
return isFunctionLike(n) || n.kind === SyntaxKind.ModuleDeclaration || n.kind === SyntaxKind.SourceFile;
|
||||
}
|
||||
@@ -1368,7 +1166,13 @@ module ts {
|
||||
return node;
|
||||
}
|
||||
|
||||
// @internal
|
||||
export function createSynthesizedNodeArray(): NodeArray<any> {
|
||||
var array = <NodeArray<any>>[];
|
||||
array.pos = -1;
|
||||
array.end = -1;
|
||||
return array;
|
||||
}
|
||||
|
||||
export function createDiagnosticCollection(): DiagnosticCollection {
|
||||
let nonFileDiagnostics: Diagnostic[] = [];
|
||||
let fileDiagnostics: Map<Diagnostic[]> = {};
|
||||
@@ -1816,6 +1620,55 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function modifierToFlag(token: SyntaxKind): NodeFlags {
|
||||
switch (token) {
|
||||
case SyntaxKind.StaticKeyword: return NodeFlags.Static;
|
||||
case SyntaxKind.PublicKeyword: return NodeFlags.Public;
|
||||
case SyntaxKind.ProtectedKeyword: return NodeFlags.Protected;
|
||||
case SyntaxKind.PrivateKeyword: return NodeFlags.Private;
|
||||
case SyntaxKind.ExportKeyword: return NodeFlags.Export;
|
||||
case SyntaxKind.DeclareKeyword: return NodeFlags.Ambient;
|
||||
case SyntaxKind.ConstKeyword: return NodeFlags.Const;
|
||||
case SyntaxKind.DefaultKeyword: return NodeFlags.Default;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
export function isLeftHandSideExpression(expr: Expression): boolean {
|
||||
if (expr) {
|
||||
switch (expr.kind) {
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
case SyntaxKind.NumericLiteral:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
case SyntaxKind.TemplateExpression:
|
||||
case SyntaxKind.FalseKeyword:
|
||||
case SyntaxKind.NullKeyword:
|
||||
case SyntaxKind.ThisKeyword:
|
||||
case SyntaxKind.TrueKeyword:
|
||||
case SyntaxKind.SuperKeyword:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isAssignmentOperator(token: SyntaxKind): boolean {
|
||||
return token >= SyntaxKind.FirstAssignment && token <= SyntaxKind.LastAssignment;
|
||||
}
|
||||
|
||||
// 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 {
|
||||
@@ -1843,3 +1696,220 @@ module ts {
|
||||
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
module ts {
|
||||
export function getDefaultLibFileName(options: CompilerOptions): string {
|
||||
return options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts";
|
||||
}
|
||||
|
||||
export function textSpanEnd(span: TextSpan) {
|
||||
return span.start + span.length
|
||||
}
|
||||
|
||||
export function textSpanIsEmpty(span: TextSpan) {
|
||||
return span.length === 0
|
||||
}
|
||||
|
||||
export function textSpanContainsPosition(span: TextSpan, position: number) {
|
||||
return position >= span.start && position < textSpanEnd(span);
|
||||
}
|
||||
|
||||
// Returns true if 'span' contains 'other'.
|
||||
export function textSpanContainsTextSpan(span: TextSpan, other: TextSpan) {
|
||||
return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);
|
||||
}
|
||||
|
||||
export function textSpanOverlapsWith(span: TextSpan, other: TextSpan) {
|
||||
let overlapStart = Math.max(span.start, other.start);
|
||||
let overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other));
|
||||
return overlapStart < overlapEnd;
|
||||
}
|
||||
|
||||
export function textSpanOverlap(span1: TextSpan, span2: TextSpan) {
|
||||
let overlapStart = Math.max(span1.start, span2.start);
|
||||
let overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));
|
||||
if (overlapStart < overlapEnd) {
|
||||
return createTextSpanFromBounds(overlapStart, overlapEnd);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function textSpanIntersectsWithTextSpan(span: TextSpan, other: TextSpan) {
|
||||
return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start
|
||||
}
|
||||
|
||||
export function textSpanIntersectsWith(span: TextSpan, start: number, length: number) {
|
||||
let end = start + length;
|
||||
return start <= textSpanEnd(span) && end >= span.start;
|
||||
}
|
||||
|
||||
export function textSpanIntersectsWithPosition(span: TextSpan, position: number) {
|
||||
return position <= textSpanEnd(span) && position >= span.start;
|
||||
}
|
||||
|
||||
export function textSpanIntersection(span1: TextSpan, span2: TextSpan) {
|
||||
let intersectStart = Math.max(span1.start, span2.start);
|
||||
let intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2));
|
||||
if (intersectStart <= intersectEnd) {
|
||||
return createTextSpanFromBounds(intersectStart, intersectEnd);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function createTextSpan(start: number, length: number): TextSpan {
|
||||
if (start < 0) {
|
||||
throw new Error("start < 0");
|
||||
}
|
||||
if (length < 0) {
|
||||
throw new Error("length < 0");
|
||||
}
|
||||
|
||||
return { start, length };
|
||||
}
|
||||
|
||||
export function createTextSpanFromBounds(start: number, end: number) {
|
||||
return createTextSpan(start, end - start);
|
||||
}
|
||||
|
||||
export function textChangeRangeNewSpan(range: TextChangeRange) {
|
||||
return createTextSpan(range.span.start, range.newLength);
|
||||
}
|
||||
|
||||
export function textChangeRangeIsUnchanged(range: TextChangeRange) {
|
||||
return textSpanIsEmpty(range.span) && range.newLength === 0;
|
||||
}
|
||||
|
||||
export function createTextChangeRange(span: TextSpan, newLength: number): TextChangeRange {
|
||||
if (newLength < 0) {
|
||||
throw new Error("newLength < 0");
|
||||
}
|
||||
|
||||
return { span, newLength };
|
||||
}
|
||||
|
||||
export let unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0);
|
||||
|
||||
/**
|
||||
* Called to merge all the changes that occurred across several versions of a script snapshot
|
||||
* into a single change. i.e. if a user keeps making successive edits to a script we will
|
||||
* have a text change from V1 to V2, V2 to V3, ..., Vn.
|
||||
*
|
||||
* This function will then merge those changes into a single change range valid between V1 and
|
||||
* Vn.
|
||||
*/
|
||||
export function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange {
|
||||
if (changes.length === 0) {
|
||||
return unchangedTextChangeRange;
|
||||
}
|
||||
|
||||
if (changes.length === 1) {
|
||||
return changes[0];
|
||||
}
|
||||
|
||||
// We change from talking about { { oldStart, oldLength }, newLength } to { oldStart, oldEnd, newEnd }
|
||||
// as it makes things much easier to reason about.
|
||||
let change0 = changes[0];
|
||||
|
||||
let oldStartN = change0.span.start;
|
||||
let oldEndN = textSpanEnd(change0.span);
|
||||
let newEndN = oldStartN + change0.newLength;
|
||||
|
||||
for (let i = 1; i < changes.length; i++) {
|
||||
let nextChange = changes[i];
|
||||
|
||||
// Consider the following case:
|
||||
// i.e. two edits. The first represents the text change range { { 10, 50 }, 30 }. i.e. The span starting
|
||||
// at 10, with length 50 is reduced to length 30. The second represents the text change range { { 30, 30 }, 40 }.
|
||||
// i.e. the span starting at 30 with length 30 is increased to length 40.
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
// | \
|
||||
// | \
|
||||
// T2 | \
|
||||
// | \
|
||||
// | \
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Merging these turns out to not be too difficult. First, determining the new start of the change is trivial
|
||||
// it's just the min of the old and new starts. i.e.:
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// ------------------------------------------------------------*------------------------------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// ----------------------------------------$-------------------$------------------------------------------
|
||||
// . | \
|
||||
// . | \
|
||||
// T2 . | \
|
||||
// . | \
|
||||
// . | \
|
||||
// ----------------------------------------------------------------------*--------------------------------
|
||||
//
|
||||
// (Note the dots represent the newly inferrred start.
|
||||
// Determining the new and old end is also pretty simple. Basically it boils down to paying attention to the
|
||||
// absolute positions at the asterixes, and the relative change between the dollar signs. Basically, we see
|
||||
// which if the two $'s precedes the other, and we move that one forward until they line up. in this case that
|
||||
// means:
|
||||
//
|
||||
// 0 10 20 30 40 50 60 70 80 90 100
|
||||
// --------------------------------------------------------------------------------*----------------------
|
||||
// | /
|
||||
// | /----
|
||||
// T1 | /----
|
||||
// | /----
|
||||
// | /----
|
||||
// ------------------------------------------------------------$------------------------------------------
|
||||
// . | \
|
||||
// . | \
|
||||
// T2 . | \
|
||||
// . | \
|
||||
// . | \
|
||||
// ----------------------------------------------------------------------*--------------------------------
|
||||
//
|
||||
// In other words (in this case), we're recognizing that the second edit happened after where the first edit
|
||||
// ended with a delta of 20 characters (60 - 40). Thus, if we go back in time to where the first edit started
|
||||
// that's the same as if we started at char 80 instead of 60.
|
||||
//
|
||||
// As it so happens, the same logic applies if the second edit precedes the first edit. In that case rahter
|
||||
// than pusing the first edit forward to match the second, we'll push the second edit forward to match the
|
||||
// first.
|
||||
//
|
||||
// In this case that means we have { oldStart: 10, oldEnd: 80, newEnd: 70 } or, in TextChangeRange
|
||||
// semantics: { { start: 10, length: 70 }, newLength: 60 }
|
||||
//
|
||||
// The math then works out as follows.
|
||||
// If we have { oldStart1, oldEnd1, newEnd1 } and { oldStart2, oldEnd2, newEnd2 } then we can compute the
|
||||
// final result like so:
|
||||
//
|
||||
// {
|
||||
// oldStart3: Min(oldStart1, oldStart2),
|
||||
// oldEnd3 : Max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)),
|
||||
// newEnd3 : Max(newEnd2, newEnd2 + (newEnd1 - oldEnd2))
|
||||
// }
|
||||
|
||||
let oldStart1 = oldStartN;
|
||||
let oldEnd1 = oldEndN;
|
||||
let newEnd1 = newEndN;
|
||||
|
||||
let oldStart2 = nextChange.span.start;
|
||||
let oldEnd2 = textSpanEnd(nextChange.span);
|
||||
let newEnd2 = oldStart2 + nextChange.newLength;
|
||||
|
||||
oldStartN = Math.min(oldStart1, oldStart2);
|
||||
oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1));
|
||||
newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2));
|
||||
}
|
||||
|
||||
return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength:*/ newEndN - oldStartN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,6 +253,10 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
});
|
||||
|
||||
it('Correct type baselines for ' + fileName, () => {
|
||||
if (fileName.indexOf("APISample") >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// NEWTODO: Type baselines
|
||||
if (result.errors.length === 0) {
|
||||
// The full walker simulates the types that you would get from doing a full
|
||||
@@ -270,29 +274,53 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
// These types are equivalent, but depend on what order the compiler observed
|
||||
// certain parts of the program.
|
||||
|
||||
var fullWalker = new TypeWriterWalker(program, /*fullTypeCheck:*/ true);
|
||||
var pullWalker = new TypeWriterWalker(program, /*fullTypeCheck:*/ false);
|
||||
let allFiles = toBeCompiled.concat(otherFiles).filter(file => !!program.getSourceFile(file.unitName));
|
||||
|
||||
var fullTypes = generateTypes(fullWalker);
|
||||
var pullTypes = generateTypes(pullWalker);
|
||||
let fullWalker = new TypeWriterWalker(program, /*fullTypeCheck:*/ true);
|
||||
let pullWalker = new TypeWriterWalker(program, /*fullTypeCheck:*/ false);
|
||||
|
||||
if (fullTypes !== pullTypes) {
|
||||
Harness.Baseline.runBaseline('Correct full expression types for ' + fileName, justName.replace(/\.ts/, '.types'), () => fullTypes);
|
||||
Harness.Baseline.runBaseline('Correct pull expression types for ' + fileName, justName.replace(/\.ts/, '.types.pull'), () => pullTypes);
|
||||
}
|
||||
else {
|
||||
Harness.Baseline.runBaseline('Correct expression types for ' + fileName, justName.replace(/\.ts/, '.types'), () => fullTypes);
|
||||
let fullResults: ts.Map<TypeWriterResult[]> = {};
|
||||
let pullResults: ts.Map<TypeWriterResult[]> = {};
|
||||
|
||||
for (let sourceFile of allFiles) {
|
||||
fullResults[sourceFile.unitName] = fullWalker.getTypeAndSymbols(sourceFile.unitName);
|
||||
pullResults[sourceFile.unitName] = fullWalker.getTypeAndSymbols(sourceFile.unitName);
|
||||
}
|
||||
|
||||
function generateTypes(walker: TypeWriterWalker): string {
|
||||
var allFiles = toBeCompiled.concat(otherFiles).filter(file => !!program.getSourceFile(file.unitName));
|
||||
var typeLines: string[] = [];
|
||||
var typeMap: { [fileName: string]: { [lineNum: number]: string[]; } } = {};
|
||||
// Produce baselines. The first gives the types for all expressions.
|
||||
// The second gives symbols for all identifiers.
|
||||
checkBaseLines(/*isSymbolBaseLine:*/ false);
|
||||
checkBaseLines(/*isSymbolBaseLine:*/ true);
|
||||
|
||||
function checkBaseLines(isSymbolBaseLine: boolean) {
|
||||
let fullBaseLine = generateBaseLine(fullResults, isSymbolBaseLine);
|
||||
let pullBaseLine = generateBaseLine(pullResults, isSymbolBaseLine);
|
||||
|
||||
let fullExtension = isSymbolBaseLine ? '.symbols' : '.types';
|
||||
let pullExtension = isSymbolBaseLine ? '.symbols.pull' : '.types.pull';
|
||||
|
||||
if (fullBaseLine !== pullBaseLine) {
|
||||
Harness.Baseline.runBaseline('Correct full information for ' + fileName, justName.replace(/\.ts/, fullExtension), () => fullBaseLine);
|
||||
Harness.Baseline.runBaseline('Correct pull information for ' + fileName, justName.replace(/\.ts/, pullExtension), () => pullBaseLine);
|
||||
}
|
||||
else {
|
||||
Harness.Baseline.runBaseline('Correct information for ' + fileName, justName.replace(/\.ts/, fullExtension), () => fullBaseLine);
|
||||
}
|
||||
}
|
||||
|
||||
function generateBaseLine(typeWriterResults: ts.Map<TypeWriterResult[]>, isSymbolBaseline: boolean): string {
|
||||
let typeLines: string[] = [];
|
||||
let typeMap: { [fileName: string]: { [lineNum: number]: string[]; } } = {};
|
||||
|
||||
allFiles.forEach(file => {
|
||||
var codeLines = file.content.split('\n');
|
||||
walker.getTypes(file.unitName).forEach(result => {
|
||||
var formattedLine = result.sourceText.replace(/\r?\n/g, "") + " : " + result.type;
|
||||
typeWriterResults[file.unitName].forEach(result => {
|
||||
if (isSymbolBaseline && !result.symbol) {
|
||||
return;
|
||||
}
|
||||
|
||||
var typeOrSymbolString = isSymbolBaseline ? result.symbol : result.type;
|
||||
var formattedLine = result.sourceText.replace(/\r?\n/g, "") + " : " + typeOrSymbolString;
|
||||
if (!typeMap[file.unitName]) {
|
||||
typeMap[file.unitName] = {};
|
||||
}
|
||||
@@ -316,11 +344,13 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
typeLines.push('>' + ty + '\r\n');
|
||||
});
|
||||
if (i + 1 < codeLines.length && (codeLines[i + 1].match(/^\s*[{|}]\s*$/) || codeLines[i + 1].trim() === '')) {
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
typeLines.push('\r\n');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
typeLines.push('No type information for this code.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,6 +336,9 @@ module Harness.LanguageService {
|
||||
getOccurrencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[] {
|
||||
return unwrapJSONCallResult(this.shim.getOccurrencesAtPosition(fileName, position));
|
||||
}
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): ts.DocumentHighlights[] {
|
||||
return unwrapJSONCallResult(this.shim.getDocumentHighlights(fileName, position, JSON.stringify(filesToSearch)));
|
||||
}
|
||||
getNavigateToItems(searchValue: string): ts.NavigateToItem[] {
|
||||
return unwrapJSONCallResult(this.shim.getNavigateToItems(searchValue));
|
||||
}
|
||||
|
||||
+29
-76
@@ -1,9 +1,9 @@
|
||||
interface TypeWriterResult {
|
||||
line: number;
|
||||
column: number;
|
||||
syntaxKind: number;
|
||||
sourceText: string;
|
||||
type: string;
|
||||
symbol: string;
|
||||
}
|
||||
|
||||
class TypeWriterWalker {
|
||||
@@ -20,7 +20,7 @@ class TypeWriterWalker {
|
||||
: program.getTypeChecker();
|
||||
}
|
||||
|
||||
public getTypes(fileName: string): TypeWriterResult[] {
|
||||
public getTypeAndSymbols(fileName: string): TypeWriterResult[] {
|
||||
var sourceFile = this.program.getSourceFile(fileName);
|
||||
this.currentSourceFile = sourceFile;
|
||||
this.results = [];
|
||||
@@ -29,90 +29,43 @@ class TypeWriterWalker {
|
||||
}
|
||||
|
||||
private visitNode(node: ts.Node): void {
|
||||
switch (node.kind) {
|
||||
// Should always log expressions that are not tokens
|
||||
// Also, always log the "this" keyword
|
||||
// TODO: Ideally we should log all expressions, but to compare to the
|
||||
// old typeWriter baselines, suppress tokens
|
||||
case ts.SyntaxKind.ThisKeyword:
|
||||
case ts.SyntaxKind.SuperKeyword:
|
||||
case ts.SyntaxKind.ArrayLiteralExpression:
|
||||
case ts.SyntaxKind.ObjectLiteralExpression:
|
||||
case ts.SyntaxKind.ElementAccessExpression:
|
||||
case ts.SyntaxKind.CallExpression:
|
||||
case ts.SyntaxKind.NewExpression:
|
||||
case ts.SyntaxKind.TypeAssertionExpression:
|
||||
case ts.SyntaxKind.ParenthesizedExpression:
|
||||
case ts.SyntaxKind.FunctionExpression:
|
||||
case ts.SyntaxKind.ArrowFunction:
|
||||
case ts.SyntaxKind.TypeOfExpression:
|
||||
case ts.SyntaxKind.VoidExpression:
|
||||
case ts.SyntaxKind.DeleteExpression:
|
||||
case ts.SyntaxKind.PrefixUnaryExpression:
|
||||
case ts.SyntaxKind.PostfixUnaryExpression:
|
||||
case ts.SyntaxKind.BinaryExpression:
|
||||
case ts.SyntaxKind.ConditionalExpression:
|
||||
case ts.SyntaxKind.SpreadElementExpression:
|
||||
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
|
||||
case ts.SyntaxKind.Identifier:
|
||||
var identifier = <ts.Identifier>node;
|
||||
if (!this.isLabel(identifier)) {
|
||||
var type = this.getTypeOfNode(identifier);
|
||||
this.log(node, type);
|
||||
}
|
||||
break;
|
||||
if (ts.isExpression(node) || node.kind === ts.SyntaxKind.Identifier) {
|
||||
this.logTypeAndSymbol(node);
|
||||
}
|
||||
|
||||
ts.forEachChild(node, child => this.visitNode(child));
|
||||
}
|
||||
|
||||
private isLabel(identifier: ts.Identifier): boolean {
|
||||
var parent = identifier.parent;
|
||||
switch (parent.kind) {
|
||||
case ts.SyntaxKind.ContinueStatement:
|
||||
case ts.SyntaxKind.BreakStatement:
|
||||
return (<ts.BreakOrContinueStatement>parent).label === identifier;
|
||||
case ts.SyntaxKind.LabeledStatement:
|
||||
return (<ts.LabeledStatement>parent).label === identifier;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private log(node: ts.Node, type: ts.Type): void {
|
||||
private logTypeAndSymbol(node: ts.Node): void {
|
||||
var actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos);
|
||||
var lineAndCharacter = this.currentSourceFile.getLineAndCharacterOfPosition(actualPos);
|
||||
var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node);
|
||||
|
||||
// If we got an unknown type, we temporarily want to fall back to just pretending the name
|
||||
// (source text) of the node is the type. This is to align with the old typeWriter to make
|
||||
// baseline comparisons easier. In the long term, we will want to just call typeToString
|
||||
this.results.push({
|
||||
line: lineAndCharacter.line,
|
||||
// todo(cyrusn): Not sure why column is one-based for type-writer. But I'm preserving
|
||||
// that behavior to prevent having a lot of baselines to fix up.
|
||||
column: lineAndCharacter.character + 1,
|
||||
syntaxKind: node.kind,
|
||||
sourceText: sourceText,
|
||||
type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.WriteOwnNameForAnyLike)
|
||||
});
|
||||
}
|
||||
|
||||
private getTypeOfNode(node: ts.Node): ts.Type {
|
||||
var type = this.checker.getTypeAtLocation(node);
|
||||
ts.Debug.assert(type !== undefined, "type doesn't exist");
|
||||
return type;
|
||||
var symbol = this.checker.getSymbolAtLocation(node);
|
||||
|
||||
var typeString = this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation);
|
||||
var symbolString: string;
|
||||
if (symbol) {
|
||||
symbolString = "Symbol(" + this.checker.symbolToString(symbol, node.parent);
|
||||
if (symbol.declarations) {
|
||||
for (let declaration of symbol.declarations) {
|
||||
symbolString += ", ";
|
||||
let declSourceFile = declaration.getSourceFile();
|
||||
let declLineAndCharacter = declSourceFile.getLineAndCharacterOfPosition(declaration.pos);
|
||||
symbolString += `Decl(${ ts.getBaseFileName(declSourceFile.fileName) }, ${ declLineAndCharacter.line }, ${ declLineAndCharacter.character })`
|
||||
}
|
||||
}
|
||||
symbolString += ")";
|
||||
}
|
||||
|
||||
this.results.push({
|
||||
line: lineAndCharacter.line,
|
||||
syntaxKind: node.kind,
|
||||
sourceText: sourceText,
|
||||
type: typeString,
|
||||
symbol: symbolString
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -823,7 +823,7 @@ interface RegExp {
|
||||
*/
|
||||
test(string: string): boolean;
|
||||
|
||||
/** Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal. */
|
||||
/** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */
|
||||
source: string;
|
||||
|
||||
/** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */
|
||||
|
||||
Vendored
+11835
-11071
File diff suppressed because it is too large
Load Diff
Vendored
+19
-12
@@ -50,26 +50,21 @@ interface SymbolConstructor {
|
||||
*/
|
||||
isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A Boolean value that if true indicates that an object may be used as a regular expression.
|
||||
*/
|
||||
isRegExp: symbol;
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object.Called by the semantics of the
|
||||
* for-of statement.
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
* abstract operation.
|
||||
*/
|
||||
toPrimitive: symbol;
|
||||
|
||||
/**
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built- in method Object.prototype.toString.
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built-in method Object.prototype.toString.
|
||||
*/
|
||||
toStringTag: symbol;
|
||||
|
||||
@@ -111,7 +106,7 @@ interface ObjectConstructor {
|
||||
getOwnPropertySymbols(o: any): symbol[];
|
||||
|
||||
/**
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* @param value1 The first value.
|
||||
* @param value2 The second value.
|
||||
*/
|
||||
@@ -598,8 +593,6 @@ interface Math {
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
[Symbol.isRegExp]: boolean;
|
||||
|
||||
/**
|
||||
* Matches a string with a regular expression, and returns an array containing the results of
|
||||
* that search.
|
||||
@@ -631,6 +624,20 @@ interface RegExp {
|
||||
*/
|
||||
split(string: string, limit?: number): string[];
|
||||
|
||||
/**
|
||||
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
|
||||
* The characters in this string are sequenced and concatenated in the following order:
|
||||
*
|
||||
* - "g" for global
|
||||
* - "i" for ignoreCase
|
||||
* - "m" for multiline
|
||||
* - "u" for unicode
|
||||
* - "y" for sticky
|
||||
*
|
||||
* If no flags are set, the value is the empty string.
|
||||
*/
|
||||
flags: string;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value indicating the state of the sticky flag (y) used with a regular
|
||||
* expression. Default is false. Read-only.
|
||||
|
||||
Vendored
+1808
-296
File diff suppressed because it is too large
Load Diff
Vendored
+110
-4
@@ -21,13 +21,16 @@ 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.
|
||||
* 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;
|
||||
}
|
||||
@@ -37,10 +40,12 @@ 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.
|
||||
*/
|
||||
@@ -49,37 +54,43 @@ interface TextStreamWriter extends TextStreamBase {
|
||||
|
||||
interface TextStreamReader extends TextStreamBase {
|
||||
/**
|
||||
* Returns a specified number of characters from an input stream, beginning at the current pointer position.
|
||||
* Returns a specified number of characters from an input stream, starting 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.
|
||||
*/
|
||||
@@ -88,85 +99,180 @@ interface TextStreamReader extends TextStreamBase {
|
||||
|
||||
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).
|
||||
* Outputs text to either a message box (under WScript.exe) or the command console window followed by
|
||||
* a newline (under CScript.exe).
|
||||
*/
|
||||
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 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;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allows enumerating over a COM collection, which may not have indexed item access.
|
||||
*/
|
||||
interface Enumerator<T> {
|
||||
/**
|
||||
* Returns true if the current item is the last one in the collection, or the collection is empty,
|
||||
* or the current item is undefined.
|
||||
*/
|
||||
atEnd(): boolean;
|
||||
|
||||
/**
|
||||
* Returns the current item in the collection
|
||||
*/
|
||||
item(): T;
|
||||
|
||||
/**
|
||||
* Resets the current item in the collection to the first item. If there are no items in the collection,
|
||||
* the current item is set to undefined.
|
||||
*/
|
||||
moveFirst(): void;
|
||||
|
||||
/**
|
||||
* Moves the current item to the next item in the collection. If the enumerator is at the end of
|
||||
* the collection or the collection is empty, the current item is set to undefined.
|
||||
*/
|
||||
moveNext(): void;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new <T>(collection: any): Enumerator<T>;
|
||||
new (collection: any): Enumerator<any>;
|
||||
}
|
||||
|
||||
declare var Enumerator: EnumeratorConstructor;
|
||||
|
||||
/**
|
||||
* Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.
|
||||
*/
|
||||
interface VBArray<T> {
|
||||
/**
|
||||
* Returns the number of dimensions (1-based).
|
||||
*/
|
||||
dimensions(): number;
|
||||
|
||||
/**
|
||||
* Takes an index for each dimension in the array, and returns the item at the corresponding location.
|
||||
*/
|
||||
getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;
|
||||
|
||||
/**
|
||||
* Returns the smallest available index for a given dimension.
|
||||
* @param dimension 1-based dimension (defaults to 1)
|
||||
*/
|
||||
lbound(dimension?: number): number;
|
||||
|
||||
/**
|
||||
* Returns the largest available index for a given dimension.
|
||||
* @param dimension 1-based dimension (defaults to 1)
|
||||
*/
|
||||
ubound(dimension?: number): number;
|
||||
|
||||
/**
|
||||
* Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,
|
||||
* each successive dimension is appended to the end of the array.
|
||||
* Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]
|
||||
*/
|
||||
toArray(): T[];
|
||||
}
|
||||
|
||||
interface VBArrayConstructor {
|
||||
new <T>(safeArray: any): VBArray<T>;
|
||||
new (safeArray: any): VBArray<any>;
|
||||
}
|
||||
|
||||
declare var VBArray: VBArrayConstructor;
|
||||
|
||||
Vendored
+765
-707
File diff suppressed because it is too large
Load Diff
@@ -488,6 +488,10 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getDocumentHighlights(fileName: string, position: number): DocumentHighlights[] {
|
||||
throw new Error("Not Implemented Yet.");
|
||||
}
|
||||
|
||||
getOutliningSpans(fileName: string): OutliningSpan[] {
|
||||
throw new Error("Not Implemented Yet.");
|
||||
}
|
||||
|
||||
+69
-45
@@ -118,7 +118,7 @@ module ts.server {
|
||||
|
||||
constructor(private host: ServerHost, private logger: Logger) {
|
||||
this.projectService =
|
||||
new ProjectService(host, logger, (eventName, project, fileName) => {
|
||||
new ProjectService(host, logger, (eventName,project,fileName) => {
|
||||
this.handleEvent(eventName, project, fileName);
|
||||
});
|
||||
}
|
||||
@@ -263,7 +263,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
getDefinition({ line, offset, file: fileName }: protocol.FileLocationRequestArgs): protocol.FileSpan[] {
|
||||
getDefinition(line: number, offset: number, fileName: string): protocol.FileSpan[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -285,7 +285,7 @@ module ts.server {
|
||||
}));
|
||||
}
|
||||
|
||||
getOccurrences({ line, offset, file: fileName }: protocol.FileLocationRequestArgs): protocol.OccurrencesResponseItem[] {
|
||||
getOccurrences(line: number, offset: number, fileName: string): protocol.OccurrencesResponseItem[] {
|
||||
fileName = ts.normalizePath(fileName);
|
||||
let project = this.projectService.getProjectForFile(fileName);
|
||||
|
||||
@@ -315,7 +315,7 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getRenameLocations({line, offset, file: fileName, findInComments, findInStrings }: protocol.RenameRequestArgs): protocol.RenameResponseBody {
|
||||
getRenameLocations(line: number, offset: number, fileName: string,findInComments: boolean, findInStrings: boolean): protocol.RenameResponseBody {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -383,7 +383,7 @@ module ts.server {
|
||||
return { info: renameInfo, locs: bakedRenameLocs };
|
||||
}
|
||||
|
||||
getReferences({ line, offset, file: fileName }: protocol.FileLocationRequestArgs): protocol.ReferencesResponseBody {
|
||||
getReferences(line: number, offset: number, fileName: string): protocol.ReferencesResponseBody {
|
||||
// TODO: get all projects for this file; report refs for all projects deleting duplicates
|
||||
// can avoid duplicates by eliminating same ref file from subsequent projects
|
||||
var file = ts.normalizePath(fileName);
|
||||
@@ -430,12 +430,12 @@ module ts.server {
|
||||
};
|
||||
}
|
||||
|
||||
openClientFile({ file: fileName }: protocol.OpenRequestArgs) {
|
||||
openClientFile(fileName: string) {
|
||||
var file = ts.normalizePath(fileName);
|
||||
this.projectService.openClientFile(file);
|
||||
}
|
||||
|
||||
getQuickInfo({ line, offset, file: fileName }: protocol.FileLocationRequestArgs): protocol.QuickInfoResponseBody {
|
||||
getQuickInfo(line: number, offset: number, fileName: string): protocol.QuickInfoResponseBody {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -461,7 +461,7 @@ module ts.server {
|
||||
};
|
||||
}
|
||||
|
||||
getFormattingEditsForRange({line, offset, endLine, endOffset, file: fileName}: protocol.FormatRequestArgs): protocol.CodeEdit[] {
|
||||
getFormattingEditsForRange(line: number, offset: number, endLine: number, endOffset: number, fileName: string): protocol.CodeEdit[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -488,7 +488,7 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getFormattingEditsAfterKeystroke({line, offset, key, file: fileName}: protocol.FormatOnKeyRequestArgs): protocol.CodeEdit[] {
|
||||
getFormattingEditsAfterKeystroke(line: number, offset: number, key: string, fileName: string): protocol.CodeEdit[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
@@ -561,7 +561,7 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getCompletions({ line, offset, prefix, file: fileName}: protocol.CompletionsRequestArgs): protocol.CompletionEntry[] {
|
||||
getCompletions(line: number, offset: number, prefix: string, fileName: string): protocol.CompletionEntry[] {
|
||||
if (!prefix) {
|
||||
prefix = "";
|
||||
}
|
||||
@@ -587,7 +587,8 @@ module ts.server {
|
||||
}, []).sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
|
||||
getCompletionEntryDetails({ line, offset, entryNames, file: fileName}: protocol.CompletionDetailsRequestArgs): protocol.CompletionEntryDetails[] {
|
||||
getCompletionEntryDetails(line: number, offset: number,
|
||||
entryNames: string[], fileName: string): protocol.CompletionEntryDetails[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -606,20 +607,20 @@ module ts.server {
|
||||
}, []);
|
||||
}
|
||||
|
||||
getSignatureHelpItems({ line, offset, file: fileName }: protocol.SignatureHelpRequestArgs): protocol.SignatureHelpItems {
|
||||
getSignatureHelpItems(line: number, offset: number, fileName: string): protocol.SignatureHelpItems {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
throw Errors.NoProject;
|
||||
}
|
||||
|
||||
|
||||
var compilerService = project.compilerService;
|
||||
var position = compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
var helpItems = compilerService.languageService.getSignatureHelpItems(file, position);
|
||||
if (!helpItems) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
var span = helpItems.applicableSpan;
|
||||
var result: protocol.SignatureHelpItems = {
|
||||
items: helpItems.items,
|
||||
@@ -631,11 +632,11 @@ module ts.server {
|
||||
argumentIndex: helpItems.argumentIndex,
|
||||
argumentCount: helpItems.argumentCount,
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
getDiagnostics({ delay, files: fileNames }: protocol.GeterrRequestArgs): void {
|
||||
|
||||
getDiagnostics(delay: number, fileNames: string[]) {
|
||||
var checkList = fileNames.reduce((accum: PendingErrorCheck[], fileName: string) => {
|
||||
fileName = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(fileName);
|
||||
@@ -646,11 +647,11 @@ module ts.server {
|
||||
}, []);
|
||||
|
||||
if (checkList.length > 0) {
|
||||
this.updateErrorCheck(checkList, this.changeSeq, (n) => n == this.changeSeq, delay)
|
||||
this.updateErrorCheck(checkList, this.changeSeq,(n) => n == this.changeSeq, delay)
|
||||
}
|
||||
}
|
||||
|
||||
change({ line, offset, endLine, endOffset, insertString, file: fileName }: protocol.ChangeRequestArgs): void {
|
||||
change(line: number, offset: number, endLine: number, endOffset: number, insertString: string, fileName: string) {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (project) {
|
||||
@@ -665,7 +666,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
reload({ file: fileName, tmpfile: tempFileName }: protocol.ReloadRequestArgs, reqSeq = 0): void {
|
||||
reload(fileName: string, tempFileName: string, reqSeq = 0) {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var tmpfile = ts.normalizePath(tempFileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
@@ -678,7 +679,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
saveToTmp({ file: fileName, tmpfile: tempFileName }: protocol.SavetoRequestArgs): void {
|
||||
saveToTmp(fileName: string, tempFileName: string) {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var tmpfile = ts.normalizePath(tempFileName);
|
||||
|
||||
@@ -688,7 +689,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
closeClientFile({ file: fileName }: protocol.FileRequestArgs) {
|
||||
closeClientFile(fileName: string) {
|
||||
var file = ts.normalizePath(fileName);
|
||||
this.projectService.closeClientFile(file);
|
||||
}
|
||||
@@ -712,7 +713,7 @@ module ts.server {
|
||||
}));
|
||||
}
|
||||
|
||||
getNavigationBarItems({ file: fileName }: protocol.FileRequestArgs): protocol.NavigationBarItem[]{
|
||||
getNavigationBarItems(fileName: string): protocol.NavigationBarItem[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -728,7 +729,7 @@ module ts.server {
|
||||
return this.decorateNavigationBarItem(project, fileName, items);
|
||||
}
|
||||
|
||||
getNavigateToItems({ searchValue, file: fileName, maxResultCount }: protocol.NavtoRequestArgs): protocol.NavtoItem[]{
|
||||
getNavigateToItems(searchValue: string, fileName: string, maxResultCount?: number): protocol.NavtoItem[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
if (!project) {
|
||||
@@ -767,7 +768,7 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getBraceMatching({ line, offset, file: fileName }: protocol.FileLocationRequestArgs): protocol.TextSpan[]{
|
||||
getBraceMatching(line: number, offset: number, fileName: string): protocol.TextSpan[] {
|
||||
var file = ts.normalizePath(fileName);
|
||||
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
@@ -809,91 +810,114 @@ module ts.server {
|
||||
break;
|
||||
}
|
||||
case CommandNames.Definition: {
|
||||
response = this.getDefinition(<protocol.FileLocationRequestArgs>request.arguments);
|
||||
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getDefinition(defArgs.line, defArgs.offset, defArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.References: {
|
||||
response = this.getReferences(<protocol.FileLocationRequestArgs>request.arguments);
|
||||
var refArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getReferences(refArgs.line, refArgs.offset, refArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Rename: {
|
||||
response = this.getRenameLocations(<protocol.RenameRequestArgs>request.arguments);
|
||||
var renameArgs = <protocol.RenameRequestArgs>request.arguments;
|
||||
response = this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Open: {
|
||||
this.openClientFile(<protocol.OpenRequestArgs>request.arguments);
|
||||
var openArgs = <protocol.OpenRequestArgs>request.arguments;
|
||||
this.openClientFile(openArgs.file);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Quickinfo: {
|
||||
response = this.getQuickInfo(<protocol.FileLocationRequestArgs>request.arguments);
|
||||
var quickinfoArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Format: {
|
||||
response = this.getFormattingEditsForRange(<protocol.FormatRequestArgs>request.arguments);
|
||||
var formatArgs = <protocol.FormatRequestArgs>request.arguments;
|
||||
response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Formatonkey: {
|
||||
response = this.getFormattingEditsAfterKeystroke(<protocol.FormatOnKeyRequestArgs>request.arguments);
|
||||
var formatOnKeyArgs = <protocol.FormatOnKeyRequestArgs>request.arguments;
|
||||
response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Completions: {
|
||||
response = this.getCompletions(<protocol.CompletionsRequestArgs>request.arguments);
|
||||
var completionsArgs = <protocol.CompletionsRequestArgs>request.arguments;
|
||||
response = this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.CompletionDetails: {
|
||||
response = this.getCompletionEntryDetails(<protocol.CompletionDetailsRequestArgs>request.arguments);
|
||||
var completionDetailsArgs = <protocol.CompletionDetailsRequestArgs>request.arguments;
|
||||
response =
|
||||
this.getCompletionEntryDetails(completionDetailsArgs.line,completionDetailsArgs.offset,
|
||||
completionDetailsArgs.entryNames,completionDetailsArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.SignatureHelp: {
|
||||
response = this.getSignatureHelpItems(<protocol.SignatureHelpRequestArgs>request.arguments);
|
||||
var signatureHelpArgs = <protocol.SignatureHelpRequestArgs>request.arguments;
|
||||
response = this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Geterr: {
|
||||
this.getDiagnostics(<protocol.GeterrRequestArgs>request.arguments);
|
||||
var geterrArgs = <protocol.GeterrRequestArgs>request.arguments;
|
||||
response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Change: {
|
||||
this.change(<protocol.ChangeRequestArgs>request.arguments);
|
||||
var changeArgs = <protocol.ChangeRequestArgs>request.arguments;
|
||||
this.change(changeArgs.line, changeArgs.offset, changeArgs.endLine, changeArgs.endOffset,
|
||||
changeArgs.insertString, changeArgs.file);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Configure: {
|
||||
this.projectService.setHostConfiguration(<protocol.ConfigureRequestArguments>request.arguments);
|
||||
var configureArgs = <protocol.ConfigureRequestArguments>request.arguments;
|
||||
this.projectService.setHostConfiguration(configureArgs);
|
||||
this.output(undefined, CommandNames.Configure, request.seq);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Reload: {
|
||||
this.reload(<protocol.ReloadRequestArgs>request.arguments);
|
||||
var reloadArgs = <protocol.ReloadRequestArgs>request.arguments;
|
||||
this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Saveto: {
|
||||
this.saveToTmp(<protocol.SavetoRequestArgs>request.arguments);
|
||||
var savetoArgs = <protocol.SavetoRequestArgs>request.arguments;
|
||||
this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Close: {
|
||||
this.closeClientFile(<protocol.FileRequestArgs>request.arguments);
|
||||
var closeArgs = <protocol.FileRequestArgs>request.arguments;
|
||||
this.closeClientFile(closeArgs.file);
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Navto: {
|
||||
response = this.getNavigateToItems(<protocol.NavtoRequestArgs>request.arguments);
|
||||
var navtoArgs = <protocol.NavtoRequestArgs>request.arguments;
|
||||
response = this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Brace: {
|
||||
response = this.getBraceMatching(<protocol.FileLocationRequestArgs>request.arguments);
|
||||
var braceArguments = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.NavBar: {
|
||||
response = this.getNavigationBarItems(<protocol.FileRequestArgs>request.arguments);
|
||||
var navBarArgs = <protocol.FileRequestArgs>request.arguments;
|
||||
response = this.getNavigationBarItems(navBarArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.Occurrences: {
|
||||
response = this.getOccurrences(<protocol.FileLocationRequestArgs>request.arguments);
|
||||
var { line, offset, file: fileName } = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getOccurrences(line, offset, fileName);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
/// <reference path='services.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.BreakpointResolver {
|
||||
/**
|
||||
* Get the breakpoint span in given sourceFile
|
||||
@@ -173,10 +174,6 @@ module ts.BreakpointResolver {
|
||||
return textSpan(node, (<ThrowStatement>node).expression);
|
||||
|
||||
case SyntaxKind.ExportAssignment:
|
||||
if (!(<ExportAssignment>node).expression) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// span on export = id
|
||||
return textSpan(node, (<ExportAssignment>node).expression);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
///<reference path='rulesProvider.ts' />
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
|
||||
export interface TextRangeWithKind extends TextRange {
|
||||
@@ -328,8 +329,13 @@ module ts.formatting {
|
||||
|
||||
if (formattingScanner.isOnToken()) {
|
||||
let startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line;
|
||||
let undecoratedStartLine = startLine;
|
||||
if (enclosingNode.decorators) {
|
||||
undecoratedStartLine = sourceFile.getLineAndCharacterOfPosition(getNonDecoratorTokenPosOfNode(enclosingNode, sourceFile)).line;
|
||||
}
|
||||
|
||||
let delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile);
|
||||
processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta);
|
||||
processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta);
|
||||
}
|
||||
|
||||
formattingScanner.close();
|
||||
@@ -500,7 +506,7 @@ module ts.formatting {
|
||||
}
|
||||
}
|
||||
|
||||
function processNode(node: Node, contextNode: Node, nodeStartLine: number, indentation: number, delta: number) {
|
||||
function processNode(node: Node, contextNode: Node, nodeStartLine: number, undecoratedNodeStartLine: number, indentation: number, delta: number) {
|
||||
if (!rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) {
|
||||
return;
|
||||
}
|
||||
@@ -526,7 +532,7 @@ module ts.formatting {
|
||||
forEachChild(
|
||||
node,
|
||||
child => {
|
||||
processChildNode(child, /*inheritedIndentation*/ Constants.Unknown, node, nodeDynamicIndentation, nodeStartLine, /*isListElement*/ false)
|
||||
processChildNode(child, /*inheritedIndentation*/ Constants.Unknown, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListElement*/ false)
|
||||
},
|
||||
(nodes: NodeArray<Node>) => {
|
||||
processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);
|
||||
@@ -547,11 +553,17 @@ module ts.formatting {
|
||||
parent: Node,
|
||||
parentDynamicIndentation: DynamicIndentation,
|
||||
parentStartLine: number,
|
||||
undecoratedParentStartLine: number,
|
||||
isListItem: boolean): number {
|
||||
|
||||
let childStartPos = child.getStart(sourceFile);
|
||||
|
||||
let childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos);
|
||||
let childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
|
||||
|
||||
let undecoratedChildStartLine = childStartLine;
|
||||
if (child.decorators) {
|
||||
undecoratedChildStartLine = sourceFile.getLineAndCharacterOfPosition(getNonDecoratorTokenPosOfNode(child, sourceFile)).line;
|
||||
}
|
||||
|
||||
// if child is a list item - try to get its indentation
|
||||
let childIndentationAmount = Constants.Unknown;
|
||||
@@ -594,9 +606,10 @@ module ts.formatting {
|
||||
return inheritedIndentation;
|
||||
}
|
||||
|
||||
let childIndentation = computeIndentation(child, childStart.line, childIndentationAmount, node, parentDynamicIndentation, parentStartLine);
|
||||
let effectiveParentStartLine = child.kind === SyntaxKind.Decorator ? childStartLine : undecoratedParentStartLine;
|
||||
let childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine);
|
||||
|
||||
processNode(child, childContextNode, childStart.line, childIndentation.indentation, childIndentation.delta);
|
||||
processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta);
|
||||
|
||||
childContextNode = node;
|
||||
|
||||
@@ -640,7 +653,7 @@ module ts.formatting {
|
||||
|
||||
let inheritedIndentation = Constants.Unknown;
|
||||
for (let child of nodes) {
|
||||
inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, /*isListElement*/ true)
|
||||
inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true)
|
||||
}
|
||||
|
||||
if (listEndToken !== SyntaxKind.Unknown) {
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/// <reference path="references.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class FormattingContext {
|
||||
public currentTokenSpan: TextRangeWithKind;
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/// <reference path="references.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export const enum FormattingRequestKind {
|
||||
FormatDocument,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference path="formatting.ts"/>
|
||||
/// <reference path="..\..\compiler\scanner.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
let scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false);
|
||||
|
||||
|
||||
@@ -1,18 +1,3 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='..\services.ts' />
|
||||
///<reference path='formattingContext.ts' />
|
||||
///<reference path='formattingRequestKind.ts' />
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class Rule {
|
||||
constructor(
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export const enum RuleAction {
|
||||
Ignore = 0x00000001,
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class RuleDescriptor {
|
||||
constructor(public LeftTokenRange: Shared.TokenRange, public RightTokenRange: Shared.TokenRange) {
|
||||
|
||||
@@ -1,20 +1,7 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export const enum RuleFlags {
|
||||
None,
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class RuleOperation {
|
||||
public Context: RuleOperationContext;
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
|
||||
export class RuleOperationContext {
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class Rules {
|
||||
public getRuleName(rule: Rule) {
|
||||
@@ -208,6 +194,11 @@ module ts.formatting {
|
||||
public SpaceAfterAnonymousFunctionKeyword: Rule;
|
||||
public NoSpaceAfterAnonymousFunctionKeyword: Rule;
|
||||
|
||||
// Insert space after @ in decorator
|
||||
public SpaceBeforeAt: Rule;
|
||||
public NoSpaceAfterAt: Rule;
|
||||
public SpaceAfterDecorator: Rule;
|
||||
|
||||
constructor() {
|
||||
///
|
||||
/// Common Rules
|
||||
@@ -344,6 +335,11 @@ module ts.formatting {
|
||||
// Remove spaces in empty interface literals. e.g.: x: {}
|
||||
this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), RuleAction.Delete));
|
||||
|
||||
// decorators
|
||||
this.SpaceBeforeAt = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.AtToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.NoSpaceAfterAt = new Rule(RuleDescriptor.create3(SyntaxKind.AtToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.SpaceAfterDecorator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.ExportKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.ClassKeyword, SyntaxKind.StaticKeyword, SyntaxKind.PublicKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.GetKeyword, SyntaxKind.SetKeyword, SyntaxKind.OpenBracketToken, SyntaxKind.AsteriskToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), RuleAction.Space));
|
||||
|
||||
// These rules are higher in priority than user-configurable rules.
|
||||
this.HighPriorityCommonRules =
|
||||
[
|
||||
@@ -381,7 +377,10 @@ module ts.formatting {
|
||||
this.NoSpaceBetweenCloseParenAndAngularBracket,
|
||||
this.NoSpaceAfterOpenAngularBracket,
|
||||
this.NoSpaceBeforeCloseAngularBracket,
|
||||
this.NoSpaceAfterCloseAngularBracket
|
||||
this.NoSpaceAfterCloseAngularBracket,
|
||||
this.SpaceBeforeAt,
|
||||
this.NoSpaceAfterAt,
|
||||
this.SpaceAfterDecorator,
|
||||
];
|
||||
|
||||
// These rules are lower in priority than user-configurable rules.
|
||||
@@ -649,6 +648,20 @@ module ts.formatting {
|
||||
return context.TokensAreOnSameLine();
|
||||
}
|
||||
|
||||
static IsEndOfDecoratorContextOnSameLine(context: FormattingContext): boolean {
|
||||
return context.TokensAreOnSameLine() &&
|
||||
context.contextNode.decorators &&
|
||||
Rules.NodeIsInDecoratorContext(context.currentTokenParent) &&
|
||||
!Rules.NodeIsInDecoratorContext(context.nextTokenParent);
|
||||
}
|
||||
|
||||
static NodeIsInDecoratorContext(node: Node): boolean {
|
||||
while (isExpression(node)) {
|
||||
node = node.parent;
|
||||
}
|
||||
return node.kind === SyntaxKind.Decorator;
|
||||
}
|
||||
|
||||
static IsStartOfVariableDeclarationList(context: FormattingContext): boolean {
|
||||
return context.currentTokenParent.kind === SyntaxKind.VariableDeclarationList &&
|
||||
context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos;
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class RulesMap {
|
||||
public map: RulesBucket[];
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/// <reference path="references.ts"/>
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export class RulesProvider {
|
||||
private globalRules: Rules;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
///<reference path='..\services.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export module SmartIndenter {
|
||||
|
||||
|
||||
@@ -1,20 +1,6 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
///<reference path='references.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.formatting {
|
||||
export module Shared {
|
||||
export interface ITokenAccess {
|
||||
|
||||
+28
-42
@@ -1,3 +1,4 @@
|
||||
/* @internal */
|
||||
module ts.NavigateTo {
|
||||
type RawNavigateToItem = { name: string; fileName: string; matchKind: PatternMatchKind; isCaseSensitive: boolean; declaration: Declaration };
|
||||
|
||||
@@ -9,11 +10,10 @@ module ts.NavigateTo {
|
||||
forEach(program.getSourceFiles(), sourceFile => {
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
|
||||
let declarations = sourceFile.getNamedDeclarations();
|
||||
for (let declaration of declarations) {
|
||||
var name = getDeclarationName(declaration);
|
||||
if (name !== undefined) {
|
||||
|
||||
let nameToDeclarations = sourceFile.getNamedDeclarations();
|
||||
for (let name in nameToDeclarations) {
|
||||
let declarations = getProperty(nameToDeclarations, name);
|
||||
if (declarations) {
|
||||
// First do a quick check to see if the name of the declaration matches the
|
||||
// last portion of the (possibly) dotted name they're searching for.
|
||||
let matches = patternMatcher.getMatchesForLastSegmentOfPattern(name);
|
||||
@@ -22,24 +22,26 @@ module ts.NavigateTo {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 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);
|
||||
if (!containers) {
|
||||
return undefined;
|
||||
for (let declaration of declarations) {
|
||||
// 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);
|
||||
if (!containers) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
matches = patternMatcher.getMatches(containers, name);
|
||||
|
||||
if (!matches) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
matches = patternMatcher.getMatches(containers, name);
|
||||
|
||||
if (!matches) {
|
||||
continue;
|
||||
}
|
||||
let fileName = sourceFile.fileName;
|
||||
let matchKind = bestMatchKind(matches);
|
||||
rawItems.push({ name, fileName, matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration });
|
||||
}
|
||||
|
||||
let fileName = sourceFile.fileName;
|
||||
let matchKind = bestMatchKind(matches);
|
||||
rawItems.push({ name, fileName, matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -66,30 +68,14 @@ module ts.NavigateTo {
|
||||
return true;
|
||||
}
|
||||
|
||||
function getDeclarationName(declaration: Declaration): string {
|
||||
let result = getTextOfIdentifierOrLiteral(declaration.name);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (declaration.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
let expr = (<ComputedPropertyName>declaration.name).expression;
|
||||
if (expr.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
return (<PropertyAccessExpression>expr).name.text;
|
||||
}
|
||||
|
||||
return getTextOfIdentifierOrLiteral(expr);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getTextOfIdentifierOrLiteral(node: Node) {
|
||||
if (node.kind === SyntaxKind.Identifier ||
|
||||
node.kind === SyntaxKind.StringLiteral ||
|
||||
node.kind === SyntaxKind.NumericLiteral) {
|
||||
if (node) {
|
||||
if (node.kind === SyntaxKind.Identifier ||
|
||||
node.kind === SyntaxKind.StringLiteral ||
|
||||
node.kind === SyntaxKind.NumericLiteral) {
|
||||
|
||||
return (<Identifier | LiteralExpression>node).text;
|
||||
return (<Identifier | LiteralExpression>node).text;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/// <reference path='services.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.NavigationBar {
|
||||
export function getNavigationBarItems(sourceFile: SourceFile): ts.NavigationBarItem[] {
|
||||
// If the source file has any child items, then it included in the tree
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
export module OutliningElementsCollector {
|
||||
export function collectElements(sourceFile: SourceFile): OutliningSpan[] {
|
||||
@@ -31,6 +17,66 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function addOutliningSpanComments(commentSpan: CommentRange, autoCollapse: boolean) {
|
||||
if (commentSpan) {
|
||||
let span: OutliningSpan = {
|
||||
textSpan: createTextSpanFromBounds(commentSpan.pos, commentSpan.end),
|
||||
hintSpan: createTextSpanFromBounds(commentSpan.pos, commentSpan.end),
|
||||
bannerText: collapseText,
|
||||
autoCollapse: autoCollapse
|
||||
};
|
||||
elements.push(span);
|
||||
}
|
||||
}
|
||||
|
||||
function addOutliningForLeadingCommentsForNode(n: Node) {
|
||||
let comments = ts.getLeadingCommentRangesOfNode(n, sourceFile);
|
||||
|
||||
if (comments) {
|
||||
let firstSingleLineCommentStart = -1;
|
||||
let lastSingleLineCommentEnd = -1;
|
||||
let isFirstSingleLineComment = true;
|
||||
let singleLineCommentCount = 0;
|
||||
|
||||
for (let currentComment of comments) {
|
||||
|
||||
// For single line comments, combine consecutive ones (2 or more) into
|
||||
// a single span from the start of the first till the end of the last
|
||||
if (currentComment.kind === SyntaxKind.SingleLineCommentTrivia) {
|
||||
if (isFirstSingleLineComment) {
|
||||
firstSingleLineCommentStart = currentComment.pos;
|
||||
}
|
||||
isFirstSingleLineComment = false;
|
||||
lastSingleLineCommentEnd = currentComment.end;
|
||||
singleLineCommentCount++;
|
||||
}
|
||||
else if (currentComment.kind === SyntaxKind.MultiLineCommentTrivia) {
|
||||
combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);
|
||||
addOutliningSpanComments(currentComment, /*autoCollapse*/ false);
|
||||
|
||||
singleLineCommentCount = 0;
|
||||
lastSingleLineCommentEnd = -1;
|
||||
isFirstSingleLineComment = true;
|
||||
}
|
||||
}
|
||||
|
||||
combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd);
|
||||
}
|
||||
}
|
||||
|
||||
function combineAndAddMultipleSingleLineComments(count: number, start: number, end: number) {
|
||||
// Only outline spans of two or more consecutive single line comments
|
||||
if (count > 1) {
|
||||
let multipleSingleLineComments = {
|
||||
pos: start,
|
||||
end: end,
|
||||
kind: SyntaxKind.SingleLineCommentTrivia
|
||||
}
|
||||
|
||||
addOutliningSpanComments(multipleSingleLineComments, /*autoCollapse*/ false);
|
||||
}
|
||||
}
|
||||
|
||||
function autoCollapse(node: Node) {
|
||||
return isFunctionBlock(node) && node.parent.kind !== SyntaxKind.ArrowFunction;
|
||||
}
|
||||
@@ -41,6 +87,11 @@ module ts {
|
||||
if (depth > maxDepth) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDeclaration(n)) {
|
||||
addOutliningForLeadingCommentsForNode(n);
|
||||
}
|
||||
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.Block:
|
||||
if (!isFunctionBlock(n)) {
|
||||
@@ -93,7 +144,7 @@ module ts {
|
||||
});
|
||||
break;
|
||||
}
|
||||
// Fallthrough.
|
||||
// Fallthrough.
|
||||
|
||||
case SyntaxKind.ModuleBlock: {
|
||||
let openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* @internal */
|
||||
module ts {
|
||||
// Note(cyrusn): this enum is ordered from strongest match type to weakest match type.
|
||||
export enum PatternMatchKind {
|
||||
|
||||
+856
-700
File diff suppressed because it is too large
Load Diff
+22
-1
@@ -15,8 +15,10 @@
|
||||
|
||||
/// <reference path='services.ts' />
|
||||
|
||||
/* @internal */
|
||||
var debugObjectHost = (<any>this);
|
||||
|
||||
/* @internal */
|
||||
module ts {
|
||||
export interface ScriptSnapshotShim {
|
||||
/** Gets a portion of the script snapshot specified by [start, end). */
|
||||
@@ -135,11 +137,21 @@ module ts {
|
||||
findReferences(fileName: string, position: number): string;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[]
|
||||
*/
|
||||
getOccurrencesAtPosition(fileName: string, position: number): string;
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { fileName: string; highlights: { start: number; length: number, isDefinition: boolean }[] }[]
|
||||
*
|
||||
* @param fileToSearch A JSON encoded string[] containing the file names that should be
|
||||
* considered when searching.
|
||||
*/
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string;
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = [];
|
||||
@@ -331,7 +343,6 @@ 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));
|
||||
}
|
||||
@@ -590,6 +601,14 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
public getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string {
|
||||
return this.forwardJSONCall(
|
||||
"getDocumentHighlights('" + fileName + "', " + position + ")",
|
||||
() => {
|
||||
return this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch));
|
||||
});
|
||||
}
|
||||
|
||||
/// COMPLETION LISTS
|
||||
|
||||
/**
|
||||
@@ -844,8 +863,10 @@ module ts {
|
||||
|
||||
|
||||
/// TODO: this is used by VS, clean this up on both sides of the interface
|
||||
/* @internal */
|
||||
module TypeScript.Services {
|
||||
export var TypeScriptServicesFactory = ts.TypeScriptServicesFactory;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
let toolsVersion = "1.4";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///<reference path='services.ts' />
|
||||
|
||||
/* @internal */
|
||||
module ts.SignatureHelp {
|
||||
|
||||
// A partially written generic type expression is not guaranteed to have the correct syntax tree. the expression could be parsed as less than/greater than expression or a comma expression
|
||||
@@ -178,7 +178,9 @@ module ts.SignatureHelp {
|
||||
argumentCount: number;
|
||||
}
|
||||
|
||||
export function getSignatureHelpItems(sourceFile: SourceFile, position: number, typeInfoResolver: TypeChecker, cancellationToken: CancellationTokenObject): SignatureHelpItems {
|
||||
export function getSignatureHelpItems(program: Program, sourceFile: SourceFile, position: number, cancellationToken: CancellationTokenObject): SignatureHelpItems {
|
||||
let typeChecker = program.getTypeChecker();
|
||||
|
||||
// Decide whether to show signature help
|
||||
let startingToken = findTokenOnLeftOfPosition(sourceFile, position);
|
||||
if (!startingToken) {
|
||||
@@ -196,15 +198,61 @@ module ts.SignatureHelp {
|
||||
|
||||
let call = argumentInfo.invocation;
|
||||
let candidates = <Signature[]>[];
|
||||
let resolvedSignature = typeInfoResolver.getResolvedSignature(call, candidates);
|
||||
let resolvedSignature = typeChecker.getResolvedSignature(call, candidates);
|
||||
cancellationToken.throwIfCancellationRequested();
|
||||
|
||||
if (!candidates.length) {
|
||||
// We didn't have any sig help items produced by the TS compiler. If this is a JS
|
||||
// file, then see if we can figure out anything better.
|
||||
if (isJavaScript(sourceFile.fileName)) {
|
||||
return createJavaScriptSignatureHelpItems(argumentInfo);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo);
|
||||
|
||||
function createJavaScriptSignatureHelpItems(argumentInfo: ArgumentListInfo): SignatureHelpItems {
|
||||
if (argumentInfo.invocation.kind !== SyntaxKind.CallExpression) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// See if we can find some symbol with the call expression name that has call signatures.
|
||||
let callExpression = <CallExpression>argumentInfo.invocation;
|
||||
let expression = callExpression.expression;
|
||||
let name = expression.kind === SyntaxKind.Identifier
|
||||
? <Identifier> expression
|
||||
: expression.kind === SyntaxKind.PropertyAccessExpression
|
||||
? (<PropertyAccessExpression>expression).name
|
||||
: undefined;
|
||||
|
||||
if (!name || !name.text) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let typeChecker = program.getTypeChecker();
|
||||
for (let sourceFile of program.getSourceFiles()) {
|
||||
let nameToDeclarations = sourceFile.getNamedDeclarations();
|
||||
let declarations = getProperty(nameToDeclarations, name.text);
|
||||
|
||||
if (declarations) {
|
||||
for (let declaration of declarations) {
|
||||
let symbol = declaration.symbol;
|
||||
if (symbol) {
|
||||
let type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration);
|
||||
if (type) {
|
||||
let callSignatures = type.getCallSignatures();
|
||||
if (callSignatures && callSignatures.length) {
|
||||
return createSignatureHelpItems(callSignatures, callSignatures[0], argumentInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns relevant information for the argument list and the current argument if we are
|
||||
* in the argument of an invocation; returns undefined otherwise.
|
||||
@@ -494,8 +542,8 @@ module ts.SignatureHelp {
|
||||
|
||||
let invocation = argumentListInfo.invocation;
|
||||
let callTarget = getInvokedExpression(invocation)
|
||||
let callTargetSymbol = typeInfoResolver.getSymbolAtLocation(callTarget);
|
||||
let callTargetDisplayParts = callTargetSymbol && symbolToDisplayParts(typeInfoResolver, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined);
|
||||
let callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget);
|
||||
let callTargetDisplayParts = callTargetSymbol && symbolToDisplayParts(typeChecker, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined);
|
||||
let items: SignatureHelpItem[] = map(candidates, candidateSignature => {
|
||||
let signatureHelpParameters: SignatureHelpParameter[];
|
||||
let prefixDisplayParts: SymbolDisplayPart[] = [];
|
||||
@@ -511,12 +559,12 @@ module ts.SignatureHelp {
|
||||
signatureHelpParameters = typeParameters && typeParameters.length > 0 ? map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray;
|
||||
suffixDisplayParts.push(punctuationPart(SyntaxKind.GreaterThanToken));
|
||||
let parameterParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation));
|
||||
typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation));
|
||||
suffixDisplayParts.push.apply(suffixDisplayParts, parameterParts);
|
||||
}
|
||||
else {
|
||||
let typeParameterParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation));
|
||||
typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation));
|
||||
prefixDisplayParts.push.apply(prefixDisplayParts, typeParameterParts);
|
||||
prefixDisplayParts.push(punctuationPart(SyntaxKind.OpenParenToken));
|
||||
|
||||
@@ -526,7 +574,7 @@ module ts.SignatureHelp {
|
||||
}
|
||||
|
||||
let returnTypeParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation));
|
||||
typeChecker.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation));
|
||||
suffixDisplayParts.push.apply(suffixDisplayParts, returnTypeParts);
|
||||
|
||||
return {
|
||||
@@ -561,7 +609,7 @@ module ts.SignatureHelp {
|
||||
|
||||
function createSignatureHelpParameterForParameter(parameter: Symbol): SignatureHelpParameter {
|
||||
let displayParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation));
|
||||
typeChecker.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation));
|
||||
|
||||
let isOptional = hasQuestionToken(parameter.valueDeclaration);
|
||||
|
||||
@@ -575,7 +623,7 @@ module ts.SignatureHelp {
|
||||
|
||||
function createSignatureHelpParameterForTypeParameter(typeParameter: TypeParameter): SignatureHelpParameter {
|
||||
let displayParts = mapToDisplayParts(writer =>
|
||||
typeInfoResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation));
|
||||
typeChecker.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation));
|
||||
|
||||
return {
|
||||
name: typeParameter.symbol.name,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// These utilities are common to multiple language service features.
|
||||
/* @internal */
|
||||
module ts {
|
||||
export interface ListItemInfo {
|
||||
listItemIndex: number;
|
||||
@@ -500,6 +501,7 @@ module ts {
|
||||
}
|
||||
|
||||
// Display-part writer helpers
|
||||
/* @internal */
|
||||
module ts {
|
||||
export function isFirstDeclarationOfSymbolParameter(symbol: Symbol) {
|
||||
return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === SyntaxKind.Parameter;
|
||||
@@ -650,4 +652,8 @@ module ts {
|
||||
typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);
|
||||
});
|
||||
}
|
||||
|
||||
export function isJavaScript(fileName: string) {
|
||||
return fileExtensionIs(fileName, ".js");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
=== tests/cases/compiler/2dArrays.ts ===
|
||||
class Cell {
|
||||
>Cell : Symbol(Cell, Decl(2dArrays.ts, 0, 0))
|
||||
}
|
||||
|
||||
class Ship {
|
||||
>Ship : Symbol(Ship, Decl(2dArrays.ts, 1, 1))
|
||||
|
||||
isSunk: boolean;
|
||||
>isSunk : Symbol(isSunk, Decl(2dArrays.ts, 3, 12))
|
||||
}
|
||||
|
||||
class Board {
|
||||
>Board : Symbol(Board, Decl(2dArrays.ts, 5, 1))
|
||||
|
||||
ships: Ship[];
|
||||
>ships : Symbol(ships, Decl(2dArrays.ts, 7, 13))
|
||||
>Ship : Symbol(Ship, Decl(2dArrays.ts, 1, 1))
|
||||
|
||||
cells: Cell[];
|
||||
>cells : Symbol(cells, Decl(2dArrays.ts, 8, 18))
|
||||
>Cell : Symbol(Cell, Decl(2dArrays.ts, 0, 0))
|
||||
|
||||
private allShipsSunk() {
|
||||
>allShipsSunk : Symbol(allShipsSunk, Decl(2dArrays.ts, 9, 18))
|
||||
|
||||
return this.ships.every(function (val) { return val.isSunk; });
|
||||
>this.ships.every : Symbol(Array.every, Decl(lib.d.ts, 1094, 62))
|
||||
>this.ships : Symbol(ships, Decl(2dArrays.ts, 7, 13))
|
||||
>this : Symbol(Board, Decl(2dArrays.ts, 5, 1))
|
||||
>ships : Symbol(ships, Decl(2dArrays.ts, 7, 13))
|
||||
>every : Symbol(Array.every, Decl(lib.d.ts, 1094, 62))
|
||||
>val : Symbol(val, Decl(2dArrays.ts, 12, 42))
|
||||
>val.isSunk : Symbol(Ship.isSunk, Decl(2dArrays.ts, 3, 12))
|
||||
>val : Symbol(val, Decl(2dArrays.ts, 12, 42))
|
||||
>isSunk : Symbol(Ship.isSunk, Decl(2dArrays.ts, 3, 12))
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
=== tests/cases/compiler/APISample_compile.ts ===
|
||||
|
||||
/*
|
||||
* Note: This test is a public API sample. The sample sources can be found
|
||||
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler
|
||||
* Please log a "breaking change" issue for any API breaking change affecting this issue
|
||||
*/
|
||||
|
||||
declare var process: any;
|
||||
>process : any
|
||||
|
||||
declare var console: any;
|
||||
>console : any
|
||||
|
||||
declare var os: any;
|
||||
>os : any
|
||||
|
||||
import ts = require("typescript");
|
||||
>ts : typeof ts
|
||||
|
||||
export function compile(fileNames: string[], options: ts.CompilerOptions): void {
|
||||
>compile : (fileNames: string[], options: ts.CompilerOptions) => void
|
||||
>fileNames : string[]
|
||||
>options : ts.CompilerOptions
|
||||
>ts : unknown
|
||||
>CompilerOptions : ts.CompilerOptions
|
||||
|
||||
var program = ts.createProgram(fileNames, options);
|
||||
>program : ts.Program
|
||||
>ts.createProgram(fileNames, options) : ts.Program
|
||||
>ts.createProgram : (rootNames: string[], options: ts.CompilerOptions, host?: ts.CompilerHost) => ts.Program
|
||||
>ts : typeof ts
|
||||
>createProgram : (rootNames: string[], options: ts.CompilerOptions, host?: ts.CompilerHost) => ts.Program
|
||||
>fileNames : string[]
|
||||
>options : ts.CompilerOptions
|
||||
|
||||
var emitResult = program.emit();
|
||||
>emitResult : ts.EmitResult
|
||||
>program.emit() : ts.EmitResult
|
||||
>program.emit : (targetSourceFile?: ts.SourceFile, writeFile?: ts.WriteFileCallback) => ts.EmitResult
|
||||
>program : ts.Program
|
||||
>emit : (targetSourceFile?: ts.SourceFile, writeFile?: ts.WriteFileCallback) => ts.EmitResult
|
||||
|
||||
var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
||||
>allDiagnostics : ts.Diagnostic[]
|
||||
>ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics) : ts.Diagnostic[]
|
||||
>ts.getPreEmitDiagnostics(program).concat : { <U extends ts.Diagnostic[]>(...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; }
|
||||
>ts.getPreEmitDiagnostics(program) : ts.Diagnostic[]
|
||||
>ts.getPreEmitDiagnostics : (program: ts.Program) => ts.Diagnostic[]
|
||||
>ts : typeof ts
|
||||
>getPreEmitDiagnostics : (program: ts.Program) => ts.Diagnostic[]
|
||||
>program : ts.Program
|
||||
>concat : { <U extends ts.Diagnostic[]>(...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; }
|
||||
>emitResult.diagnostics : ts.Diagnostic[]
|
||||
>emitResult : ts.EmitResult
|
||||
>diagnostics : ts.Diagnostic[]
|
||||
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
>allDiagnostics.forEach(diagnostic => { var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); }) : void
|
||||
>allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
|
||||
>allDiagnostics : ts.Diagnostic[]
|
||||
>forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
|
||||
>diagnostic => { var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); } : (diagnostic: ts.Diagnostic) => void
|
||||
>diagnostic : ts.Diagnostic
|
||||
|
||||
var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
>line : number
|
||||
>character : number
|
||||
>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter
|
||||
>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>diagnostic.file : ts.SourceFile
|
||||
>diagnostic : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>diagnostic.start : number
|
||||
>diagnostic : ts.Diagnostic
|
||||
>start : number
|
||||
|
||||
var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
||||
>message : string
|
||||
>ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n') : string
|
||||
>ts.flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string
|
||||
>ts : typeof ts
|
||||
>flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string
|
||||
>diagnostic.messageText : string | ts.DiagnosticMessageChain
|
||||
>diagnostic : ts.Diagnostic
|
||||
>messageText : string | ts.DiagnosticMessageChain
|
||||
|
||||
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
>console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
>diagnostic.file.fileName : string
|
||||
>diagnostic.file : ts.SourceFile
|
||||
>diagnostic : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
>fileName : string
|
||||
>line + 1 : number
|
||||
>line : number
|
||||
>character + 1 : number
|
||||
>character : number
|
||||
>message : string
|
||||
|
||||
});
|
||||
|
||||
var exitCode = emitResult.emitSkipped ? 1 : 0;
|
||||
>exitCode : number
|
||||
>emitResult.emitSkipped ? 1 : 0 : number
|
||||
>emitResult.emitSkipped : boolean
|
||||
>emitResult : ts.EmitResult
|
||||
>emitSkipped : boolean
|
||||
|
||||
console.log(`Process exiting with code '${exitCode}'.`);
|
||||
>console.log(`Process exiting with code '${exitCode}'.`) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
>exitCode : number
|
||||
|
||||
process.exit(exitCode);
|
||||
>process.exit(exitCode) : any
|
||||
>process.exit : any
|
||||
>process : any
|
||||
>exit : any
|
||||
>exitCode : number
|
||||
}
|
||||
|
||||
compile(process.argv.slice(2), {
|
||||
>compile(process.argv.slice(2), { noEmitOnError: true, noImplicitAny: true, target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS}) : void
|
||||
>compile : (fileNames: string[], options: ts.CompilerOptions) => void
|
||||
>process.argv.slice(2) : any
|
||||
>process.argv.slice : any
|
||||
>process.argv : any
|
||||
>process : any
|
||||
>argv : any
|
||||
>slice : any
|
||||
>{ noEmitOnError: true, noImplicitAny: true, target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS} : { [x: string]: boolean | ts.ScriptTarget | ts.ModuleKind; noEmitOnError: boolean; noImplicitAny: boolean; target: ts.ScriptTarget; module: ts.ModuleKind; }
|
||||
|
||||
noEmitOnError: true, noImplicitAny: true,
|
||||
>noEmitOnError : boolean
|
||||
>noImplicitAny : boolean
|
||||
|
||||
target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS
|
||||
>target : ts.ScriptTarget
|
||||
>ts.ScriptTarget.ES5 : ts.ScriptTarget
|
||||
>ts.ScriptTarget : typeof ts.ScriptTarget
|
||||
>ts : typeof ts
|
||||
>ScriptTarget : typeof ts.ScriptTarget
|
||||
>ES5 : ts.ScriptTarget
|
||||
>module : ts.ModuleKind
|
||||
>ts.ModuleKind.CommonJS : ts.ModuleKind
|
||||
>ts.ModuleKind : typeof ts.ModuleKind
|
||||
>ts : typeof ts
|
||||
>ModuleKind : typeof ts.ModuleKind
|
||||
>CommonJS : ts.ModuleKind
|
||||
|
||||
});
|
||||
@@ -1,303 +0,0 @@
|
||||
=== tests/cases/compiler/APISample_linter.ts ===
|
||||
|
||||
/*
|
||||
* Note: This test is a public API sample. The sample sources can be found
|
||||
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter
|
||||
* Please log a "breaking change" issue for any API breaking change affecting this issue
|
||||
*/
|
||||
|
||||
declare var process: any;
|
||||
>process : any
|
||||
|
||||
declare var console: any;
|
||||
>console : any
|
||||
|
||||
declare var readFileSync: any;
|
||||
>readFileSync : any
|
||||
|
||||
import * as ts from "typescript";
|
||||
>ts : typeof ts
|
||||
|
||||
export function delint(sourceFile: ts.SourceFile) {
|
||||
>delint : (sourceFile: ts.SourceFile) => void
|
||||
>sourceFile : ts.SourceFile
|
||||
>ts : unknown
|
||||
>SourceFile : ts.SourceFile
|
||||
|
||||
delintNode(sourceFile);
|
||||
>delintNode(sourceFile) : void
|
||||
>delintNode : (node: ts.Node) => void
|
||||
>sourceFile : ts.SourceFile
|
||||
|
||||
function delintNode(node: ts.Node) {
|
||||
>delintNode : (node: ts.Node) => void
|
||||
>node : ts.Node
|
||||
>ts : unknown
|
||||
>Node : ts.Node
|
||||
|
||||
switch (node.kind) {
|
||||
>node.kind : ts.SyntaxKind
|
||||
>node : ts.Node
|
||||
>kind : ts.SyntaxKind
|
||||
|
||||
case ts.SyntaxKind.ForStatement:
|
||||
>ts.SyntaxKind.ForStatement : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>ForStatement : ts.SyntaxKind
|
||||
|
||||
case ts.SyntaxKind.ForInStatement:
|
||||
>ts.SyntaxKind.ForInStatement : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>ForInStatement : ts.SyntaxKind
|
||||
|
||||
case ts.SyntaxKind.WhileStatement:
|
||||
>ts.SyntaxKind.WhileStatement : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>WhileStatement : ts.SyntaxKind
|
||||
|
||||
case ts.SyntaxKind.DoStatement:
|
||||
>ts.SyntaxKind.DoStatement : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>DoStatement : ts.SyntaxKind
|
||||
|
||||
if ((<ts.IterationStatement>node).statement.kind !== ts.SyntaxKind.Block) {
|
||||
>(<ts.IterationStatement>node).statement.kind !== ts.SyntaxKind.Block : boolean
|
||||
>(<ts.IterationStatement>node).statement.kind : ts.SyntaxKind
|
||||
>(<ts.IterationStatement>node).statement : ts.Statement
|
||||
>(<ts.IterationStatement>node) : ts.IterationStatement
|
||||
><ts.IterationStatement>node : ts.IterationStatement
|
||||
>ts : unknown
|
||||
>IterationStatement : ts.IterationStatement
|
||||
>node : ts.Node
|
||||
>statement : ts.Statement
|
||||
>kind : ts.SyntaxKind
|
||||
>ts.SyntaxKind.Block : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>Block : ts.SyntaxKind
|
||||
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
>report(node, "A looping statement's contents should be wrapped in a block body.") : void
|
||||
>report : (node: ts.Node, message: string) => void
|
||||
>node : ts.Node
|
||||
}
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.IfStatement:
|
||||
>ts.SyntaxKind.IfStatement : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>IfStatement : ts.SyntaxKind
|
||||
|
||||
let ifStatement = (<ts.IfStatement>node);
|
||||
>ifStatement : ts.IfStatement
|
||||
>(<ts.IfStatement>node) : ts.IfStatement
|
||||
><ts.IfStatement>node : ts.IfStatement
|
||||
>ts : unknown
|
||||
>IfStatement : ts.IfStatement
|
||||
>node : ts.Node
|
||||
|
||||
if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) {
|
||||
>ifStatement.thenStatement.kind !== ts.SyntaxKind.Block : boolean
|
||||
>ifStatement.thenStatement.kind : ts.SyntaxKind
|
||||
>ifStatement.thenStatement : ts.Statement
|
||||
>ifStatement : ts.IfStatement
|
||||
>thenStatement : ts.Statement
|
||||
>kind : ts.SyntaxKind
|
||||
>ts.SyntaxKind.Block : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>Block : ts.SyntaxKind
|
||||
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
>report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.") : void
|
||||
>report : (node: ts.Node, message: string) => void
|
||||
>ifStatement.thenStatement : ts.Statement
|
||||
>ifStatement : ts.IfStatement
|
||||
>thenStatement : ts.Statement
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
>ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean
|
||||
>ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean
|
||||
>ifStatement.elseStatement : ts.Statement
|
||||
>ifStatement : ts.IfStatement
|
||||
>elseStatement : ts.Statement
|
||||
|
||||
ifStatement.elseStatement.kind !== ts.SyntaxKind.Block &&
|
||||
>ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean
|
||||
>ifStatement.elseStatement.kind : ts.SyntaxKind
|
||||
>ifStatement.elseStatement : ts.Statement
|
||||
>ifStatement : ts.IfStatement
|
||||
>elseStatement : ts.Statement
|
||||
>kind : ts.SyntaxKind
|
||||
>ts.SyntaxKind.Block : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>Block : ts.SyntaxKind
|
||||
|
||||
ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
|
||||
>ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean
|
||||
>ifStatement.elseStatement.kind : ts.SyntaxKind
|
||||
>ifStatement.elseStatement : ts.Statement
|
||||
>ifStatement : ts.IfStatement
|
||||
>elseStatement : ts.Statement
|
||||
>kind : ts.SyntaxKind
|
||||
>ts.SyntaxKind.IfStatement : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>IfStatement : ts.SyntaxKind
|
||||
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
>report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.") : void
|
||||
>report : (node: ts.Node, message: string) => void
|
||||
>ifStatement.elseStatement : ts.Statement
|
||||
>ifStatement : ts.IfStatement
|
||||
>elseStatement : ts.Statement
|
||||
}
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.BinaryExpression:
|
||||
>ts.SyntaxKind.BinaryExpression : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>BinaryExpression : ts.SyntaxKind
|
||||
|
||||
let op = (<ts.BinaryExpression>node).operatorToken.kind;
|
||||
>op : ts.SyntaxKind
|
||||
>(<ts.BinaryExpression>node).operatorToken.kind : ts.SyntaxKind
|
||||
>(<ts.BinaryExpression>node).operatorToken : ts.Node
|
||||
>(<ts.BinaryExpression>node) : ts.BinaryExpression
|
||||
><ts.BinaryExpression>node : ts.BinaryExpression
|
||||
>ts : unknown
|
||||
>BinaryExpression : ts.BinaryExpression
|
||||
>node : ts.Node
|
||||
>operatorToken : ts.Node
|
||||
>kind : ts.SyntaxKind
|
||||
|
||||
if (op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken) {
|
||||
>op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken : boolean
|
||||
>op === ts.SyntaxKind.EqualsEqualsToken : boolean
|
||||
>op : ts.SyntaxKind
|
||||
>ts.SyntaxKind.EqualsEqualsToken : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>EqualsEqualsToken : ts.SyntaxKind
|
||||
>op == ts.SyntaxKind.ExclamationEqualsToken : boolean
|
||||
>op : ts.SyntaxKind
|
||||
>ts.SyntaxKind.ExclamationEqualsToken : ts.SyntaxKind
|
||||
>ts.SyntaxKind : typeof ts.SyntaxKind
|
||||
>ts : typeof ts
|
||||
>SyntaxKind : typeof ts.SyntaxKind
|
||||
>ExclamationEqualsToken : ts.SyntaxKind
|
||||
|
||||
report(node, "Use '===' and '!=='.")
|
||||
>report(node, "Use '===' and '!=='.") : void
|
||||
>report : (node: ts.Node, message: string) => void
|
||||
>node : ts.Node
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ts.forEachChild(node, delintNode);
|
||||
>ts.forEachChild(node, delintNode) : void
|
||||
>ts.forEachChild : <T>(node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T
|
||||
>ts : typeof ts
|
||||
>forEachChild : <T>(node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T
|
||||
>node : ts.Node
|
||||
>delintNode : (node: ts.Node) => void
|
||||
}
|
||||
|
||||
function report(node: ts.Node, message: string) {
|
||||
>report : (node: ts.Node, message: string) => void
|
||||
>node : ts.Node
|
||||
>ts : unknown
|
||||
>Node : ts.Node
|
||||
>message : string
|
||||
|
||||
let { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
||||
>line : number
|
||||
>character : number
|
||||
>sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter
|
||||
>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>sourceFile : ts.SourceFile
|
||||
>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>node.getStart() : number
|
||||
>node.getStart : (sourceFile?: ts.SourceFile) => number
|
||||
>node : ts.Node
|
||||
>getStart : (sourceFile?: ts.SourceFile) => number
|
||||
|
||||
console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
>console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
>sourceFile.fileName : string
|
||||
>sourceFile : ts.SourceFile
|
||||
>fileName : string
|
||||
>line + 1 : number
|
||||
>line : number
|
||||
>character + 1 : number
|
||||
>character : number
|
||||
>message : string
|
||||
}
|
||||
}
|
||||
|
||||
const fileNames = process.argv.slice(2);
|
||||
>fileNames : any
|
||||
>process.argv.slice(2) : any
|
||||
>process.argv.slice : any
|
||||
>process.argv : any
|
||||
>process : any
|
||||
>argv : any
|
||||
>slice : any
|
||||
|
||||
fileNames.forEach(fileName => {
|
||||
>fileNames.forEach(fileName => { // Parse a file let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);}) : any
|
||||
>fileNames.forEach : any
|
||||
>fileNames : any
|
||||
>forEach : any
|
||||
>fileName => { // Parse a file let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);} : (fileName: any) => void
|
||||
>fileName : any
|
||||
|
||||
// Parse a file
|
||||
let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true);
|
||||
>sourceFile : ts.SourceFile
|
||||
>ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true) : ts.SourceFile
|
||||
>ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile
|
||||
>ts : typeof ts
|
||||
>createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile
|
||||
>fileName : any
|
||||
>readFileSync(fileName).toString() : any
|
||||
>readFileSync(fileName).toString : any
|
||||
>readFileSync(fileName) : any
|
||||
>readFileSync : any
|
||||
>fileName : any
|
||||
>toString : any
|
||||
>ts.ScriptTarget.ES6 : ts.ScriptTarget
|
||||
>ts.ScriptTarget : typeof ts.ScriptTarget
|
||||
>ts : typeof ts
|
||||
>ScriptTarget : typeof ts.ScriptTarget
|
||||
>ES6 : ts.ScriptTarget
|
||||
|
||||
// delint it
|
||||
delint(sourceFile);
|
||||
>delint(sourceFile) : void
|
||||
>delint : (sourceFile: ts.SourceFile) => void
|
||||
>sourceFile : ts.SourceFile
|
||||
|
||||
});
|
||||
@@ -1,43 +0,0 @@
|
||||
=== tests/cases/compiler/APISample_transform.ts ===
|
||||
|
||||
/*
|
||||
* Note: This test is a public API sample. The sample sources can be found
|
||||
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function
|
||||
* Please log a "breaking change" issue for any API breaking change affecting this issue
|
||||
*/
|
||||
|
||||
declare var console: any;
|
||||
>console : any
|
||||
|
||||
import * as ts from "typescript";
|
||||
>ts : typeof ts
|
||||
|
||||
const source = "let x: string = 'string'";
|
||||
>source : string
|
||||
|
||||
let result = ts.transpile(source, { module: ts.ModuleKind.CommonJS });
|
||||
>result : string
|
||||
>ts.transpile(source, { module: ts.ModuleKind.CommonJS }) : string
|
||||
>ts.transpile : (input: string, compilerOptions?: ts.CompilerOptions, fileName?: string, diagnostics?: ts.Diagnostic[]) => string
|
||||
>ts : typeof ts
|
||||
>transpile : (input: string, compilerOptions?: ts.CompilerOptions, fileName?: string, diagnostics?: ts.Diagnostic[]) => string
|
||||
>source : string
|
||||
>{ module: ts.ModuleKind.CommonJS } : { [x: string]: ts.ModuleKind; module: ts.ModuleKind; }
|
||||
>module : ts.ModuleKind
|
||||
>ts.ModuleKind.CommonJS : ts.ModuleKind
|
||||
>ts.ModuleKind : typeof ts.ModuleKind
|
||||
>ts : typeof ts
|
||||
>ModuleKind : typeof ts.ModuleKind
|
||||
>CommonJS : ts.ModuleKind
|
||||
|
||||
console.log(JSON.stringify(result));
|
||||
>console.log(JSON.stringify(result)) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
>JSON.stringify(result) : string
|
||||
>JSON.stringify : { (value: any): string; (value: any, replacer: (key: string, value: any) => any): string; (value: any, replacer: any[]): string; (value: any, replacer: (key: string, value: any) => any, space: any): string; (value: any, replacer: any[], space: any): string; }
|
||||
>JSON : JSON
|
||||
>stringify : { (value: any): string; (value: any, replacer: (key: string, value: any) => any): string; (value: any, replacer: any[]): string; (value: any, replacer: (key: string, value: any) => any, space: any): string; (value: any, replacer: any[], space: any): string; }
|
||||
>result : string
|
||||
|
||||
@@ -1,428 +0,0 @@
|
||||
=== tests/cases/compiler/APISample_watcher.ts ===
|
||||
|
||||
/*
|
||||
* Note: This test is a public API sample. The sample sources can be found
|
||||
at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services
|
||||
* Please log a "breaking change" issue for any API breaking change affecting this issue
|
||||
*/
|
||||
|
||||
declare var process: any;
|
||||
>process : any
|
||||
|
||||
declare var console: any;
|
||||
>console : any
|
||||
|
||||
declare var fs: any;
|
||||
>fs : any
|
||||
|
||||
declare var path: any;
|
||||
>path : any
|
||||
|
||||
import * as ts from "typescript";
|
||||
>ts : typeof ts
|
||||
|
||||
function watch(rootFileNames: string[], options: ts.CompilerOptions) {
|
||||
>watch : (rootFileNames: string[], options: ts.CompilerOptions) => void
|
||||
>rootFileNames : string[]
|
||||
>options : ts.CompilerOptions
|
||||
>ts : unknown
|
||||
>CompilerOptions : ts.CompilerOptions
|
||||
|
||||
const files: ts.Map<{ version: number }> = {};
|
||||
>files : ts.Map<{ version: number; }>
|
||||
>ts : unknown
|
||||
>Map : ts.Map<T>
|
||||
>version : number
|
||||
>{} : { [x: string]: undefined; }
|
||||
|
||||
// initialize the list of files
|
||||
rootFileNames.forEach(fileName => {
|
||||
>rootFileNames.forEach(fileName => { files[fileName] = { version: 0 }; }) : void
|
||||
>rootFileNames.forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void
|
||||
>rootFileNames : string[]
|
||||
>forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void
|
||||
>fileName => { files[fileName] = { version: 0 }; } : (fileName: string) => void
|
||||
>fileName : string
|
||||
|
||||
files[fileName] = { version: 0 };
|
||||
>files[fileName] = { version: 0 } : { version: number; }
|
||||
>files[fileName] : { version: number; }
|
||||
>files : ts.Map<{ version: number; }>
|
||||
>fileName : string
|
||||
>{ version: 0 } : { version: number; }
|
||||
>version : number
|
||||
|
||||
});
|
||||
|
||||
// Create the language service host to allow the LS to communicate with the host
|
||||
const servicesHost: ts.LanguageServiceHost = {
|
||||
>servicesHost : ts.LanguageServiceHost
|
||||
>ts : unknown
|
||||
>LanguageServiceHost : ts.LanguageServiceHost
|
||||
>{ getScriptFileNames: () => rootFileNames, getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(), getScriptSnapshot: (fileName) => { if (!fs.existsSync(fileName)) { return undefined; } return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); }, getCurrentDirectory: () => process.cwd(), getCompilationSettings: () => options, getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), } : { getScriptFileNames: () => string[]; getScriptVersion: (fileName: string) => string; getScriptSnapshot: (fileName: string) => ts.IScriptSnapshot; getCurrentDirectory: () => any; getCompilationSettings: () => ts.CompilerOptions; getDefaultLibFileName: (options: ts.CompilerOptions) => string; }
|
||||
|
||||
getScriptFileNames: () => rootFileNames,
|
||||
>getScriptFileNames : () => string[]
|
||||
>() => rootFileNames : () => string[]
|
||||
>rootFileNames : string[]
|
||||
|
||||
getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(),
|
||||
>getScriptVersion : (fileName: string) => string
|
||||
>(fileName) => files[fileName] && files[fileName].version.toString() : (fileName: string) => string
|
||||
>fileName : string
|
||||
>files[fileName] && files[fileName].version.toString() : string
|
||||
>files[fileName] : { version: number; }
|
||||
>files : ts.Map<{ version: number; }>
|
||||
>fileName : string
|
||||
>files[fileName].version.toString() : string
|
||||
>files[fileName].version.toString : (radix?: number) => string
|
||||
>files[fileName].version : number
|
||||
>files[fileName] : { version: number; }
|
||||
>files : ts.Map<{ version: number; }>
|
||||
>fileName : string
|
||||
>version : number
|
||||
>toString : (radix?: number) => string
|
||||
|
||||
getScriptSnapshot: (fileName) => {
|
||||
>getScriptSnapshot : (fileName: string) => ts.IScriptSnapshot
|
||||
>(fileName) => { if (!fs.existsSync(fileName)) { return undefined; } return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); } : (fileName: string) => ts.IScriptSnapshot
|
||||
>fileName : string
|
||||
|
||||
if (!fs.existsSync(fileName)) {
|
||||
>!fs.existsSync(fileName) : boolean
|
||||
>fs.existsSync(fileName) : any
|
||||
>fs.existsSync : any
|
||||
>fs : any
|
||||
>existsSync : any
|
||||
>fileName : string
|
||||
|
||||
return undefined;
|
||||
>undefined : undefined
|
||||
}
|
||||
|
||||
return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString());
|
||||
>ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()) : ts.IScriptSnapshot
|
||||
>ts.ScriptSnapshot.fromString : (text: string) => ts.IScriptSnapshot
|
||||
>ts.ScriptSnapshot : typeof ts.ScriptSnapshot
|
||||
>ts : typeof ts
|
||||
>ScriptSnapshot : typeof ts.ScriptSnapshot
|
||||
>fromString : (text: string) => ts.IScriptSnapshot
|
||||
>fs.readFileSync(fileName).toString() : any
|
||||
>fs.readFileSync(fileName).toString : any
|
||||
>fs.readFileSync(fileName) : any
|
||||
>fs.readFileSync : any
|
||||
>fs : any
|
||||
>readFileSync : any
|
||||
>fileName : string
|
||||
>toString : any
|
||||
|
||||
},
|
||||
getCurrentDirectory: () => process.cwd(),
|
||||
>getCurrentDirectory : () => any
|
||||
>() => process.cwd() : () => any
|
||||
>process.cwd() : any
|
||||
>process.cwd : any
|
||||
>process : any
|
||||
>cwd : any
|
||||
|
||||
getCompilationSettings: () => options,
|
||||
>getCompilationSettings : () => ts.CompilerOptions
|
||||
>() => options : () => ts.CompilerOptions
|
||||
>options : ts.CompilerOptions
|
||||
|
||||
getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options),
|
||||
>getDefaultLibFileName : (options: ts.CompilerOptions) => string
|
||||
>(options) => ts.getDefaultLibFilePath(options) : (options: ts.CompilerOptions) => string
|
||||
>options : ts.CompilerOptions
|
||||
>ts.getDefaultLibFilePath(options) : string
|
||||
>ts.getDefaultLibFilePath : (options: ts.CompilerOptions) => string
|
||||
>ts : typeof ts
|
||||
>getDefaultLibFilePath : (options: ts.CompilerOptions) => string
|
||||
>options : ts.CompilerOptions
|
||||
|
||||
};
|
||||
|
||||
// Create the language service files
|
||||
const services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry())
|
||||
>services : ts.LanguageService
|
||||
>ts.createLanguageService(servicesHost, ts.createDocumentRegistry()) : ts.LanguageService
|
||||
>ts.createLanguageService : (host: ts.LanguageServiceHost, documentRegistry?: ts.DocumentRegistry) => ts.LanguageService
|
||||
>ts : typeof ts
|
||||
>createLanguageService : (host: ts.LanguageServiceHost, documentRegistry?: ts.DocumentRegistry) => ts.LanguageService
|
||||
>servicesHost : ts.LanguageServiceHost
|
||||
>ts.createDocumentRegistry() : ts.DocumentRegistry
|
||||
>ts.createDocumentRegistry : () => ts.DocumentRegistry
|
||||
>ts : typeof ts
|
||||
>createDocumentRegistry : () => ts.DocumentRegistry
|
||||
|
||||
// Now let's watch the files
|
||||
rootFileNames.forEach(fileName => {
|
||||
>rootFileNames.forEach(fileName => { // First time around, emit all files emitFile(fileName); // Add a watch on the file to handle next change fs.watchFile(fileName, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); }); }) : void
|
||||
>rootFileNames.forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void
|
||||
>rootFileNames : string[]
|
||||
>forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void
|
||||
>fileName => { // First time around, emit all files emitFile(fileName); // Add a watch on the file to handle next change fs.watchFile(fileName, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); }); } : (fileName: string) => void
|
||||
>fileName : string
|
||||
|
||||
// First time around, emit all files
|
||||
emitFile(fileName);
|
||||
>emitFile(fileName) : void
|
||||
>emitFile : (fileName: string) => void
|
||||
>fileName : string
|
||||
|
||||
// Add a watch on the file to handle next change
|
||||
fs.watchFile(fileName,
|
||||
>fs.watchFile(fileName, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); }) : any
|
||||
>fs.watchFile : any
|
||||
>fs : any
|
||||
>watchFile : any
|
||||
>fileName : string
|
||||
|
||||
{ persistent: true, interval: 250 },
|
||||
>{ persistent: true, interval: 250 } : { persistent: boolean; interval: number; }
|
||||
>persistent : boolean
|
||||
>interval : number
|
||||
|
||||
(curr, prev) => {
|
||||
>(curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); } : (curr: any, prev: any) => void
|
||||
>curr : any
|
||||
>prev : any
|
||||
|
||||
// Check timestamp
|
||||
if (+curr.mtime <= +prev.mtime) {
|
||||
>+curr.mtime <= +prev.mtime : boolean
|
||||
>+curr.mtime : number
|
||||
>curr.mtime : any
|
||||
>curr : any
|
||||
>mtime : any
|
||||
>+prev.mtime : number
|
||||
>prev.mtime : any
|
||||
>prev : any
|
||||
>mtime : any
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the version to signal a change in the file
|
||||
files[fileName].version++;
|
||||
>files[fileName].version++ : number
|
||||
>files[fileName].version : number
|
||||
>files[fileName] : { version: number; }
|
||||
>files : ts.Map<{ version: number; }>
|
||||
>fileName : string
|
||||
>version : number
|
||||
|
||||
// write the changes to disk
|
||||
emitFile(fileName);
|
||||
>emitFile(fileName) : void
|
||||
>emitFile : (fileName: string) => void
|
||||
>fileName : string
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function emitFile(fileName: string) {
|
||||
>emitFile : (fileName: string) => void
|
||||
>fileName : string
|
||||
|
||||
let output = services.getEmitOutput(fileName);
|
||||
>output : ts.EmitOutput
|
||||
>services.getEmitOutput(fileName) : ts.EmitOutput
|
||||
>services.getEmitOutput : (fileName: string) => ts.EmitOutput
|
||||
>services : ts.LanguageService
|
||||
>getEmitOutput : (fileName: string) => ts.EmitOutput
|
||||
>fileName : string
|
||||
|
||||
if (!output.emitSkipped) {
|
||||
>!output.emitSkipped : boolean
|
||||
>output.emitSkipped : boolean
|
||||
>output : ts.EmitOutput
|
||||
>emitSkipped : boolean
|
||||
|
||||
console.log(`Emitting ${fileName}`);
|
||||
>console.log(`Emitting ${fileName}`) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
>fileName : string
|
||||
}
|
||||
else {
|
||||
console.log(`Emitting ${fileName} failed`);
|
||||
>console.log(`Emitting ${fileName} failed`) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
>fileName : string
|
||||
|
||||
logErrors(fileName);
|
||||
>logErrors(fileName) : void
|
||||
>logErrors : (fileName: string) => void
|
||||
>fileName : string
|
||||
}
|
||||
|
||||
output.outputFiles.forEach(o => {
|
||||
>output.outputFiles.forEach(o => { fs.writeFileSync(o.name, o.text, "utf8"); }) : void
|
||||
>output.outputFiles.forEach : (callbackfn: (value: ts.OutputFile, index: number, array: ts.OutputFile[]) => void, thisArg?: any) => void
|
||||
>output.outputFiles : ts.OutputFile[]
|
||||
>output : ts.EmitOutput
|
||||
>outputFiles : ts.OutputFile[]
|
||||
>forEach : (callbackfn: (value: ts.OutputFile, index: number, array: ts.OutputFile[]) => void, thisArg?: any) => void
|
||||
>o => { fs.writeFileSync(o.name, o.text, "utf8"); } : (o: ts.OutputFile) => void
|
||||
>o : ts.OutputFile
|
||||
|
||||
fs.writeFileSync(o.name, o.text, "utf8");
|
||||
>fs.writeFileSync(o.name, o.text, "utf8") : any
|
||||
>fs.writeFileSync : any
|
||||
>fs : any
|
||||
>writeFileSync : any
|
||||
>o.name : string
|
||||
>o : ts.OutputFile
|
||||
>name : string
|
||||
>o.text : string
|
||||
>o : ts.OutputFile
|
||||
>text : string
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function logErrors(fileName: string) {
|
||||
>logErrors : (fileName: string) => void
|
||||
>fileName : string
|
||||
|
||||
let allDiagnostics = services.getCompilerOptionsDiagnostics()
|
||||
>allDiagnostics : ts.Diagnostic[]
|
||||
>services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) .concat(services.getSemanticDiagnostics(fileName)) : ts.Diagnostic[]
|
||||
>services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) .concat : { <U extends ts.Diagnostic[]>(...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; }
|
||||
>services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) : ts.Diagnostic[]
|
||||
>services.getCompilerOptionsDiagnostics() .concat : { <U extends ts.Diagnostic[]>(...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; }
|
||||
>services.getCompilerOptionsDiagnostics() : ts.Diagnostic[]
|
||||
>services.getCompilerOptionsDiagnostics : () => ts.Diagnostic[]
|
||||
>services : ts.LanguageService
|
||||
>getCompilerOptionsDiagnostics : () => ts.Diagnostic[]
|
||||
|
||||
.concat(services.getSyntacticDiagnostics(fileName))
|
||||
>concat : { <U extends ts.Diagnostic[]>(...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; }
|
||||
>services.getSyntacticDiagnostics(fileName) : ts.Diagnostic[]
|
||||
>services.getSyntacticDiagnostics : (fileName: string) => ts.Diagnostic[]
|
||||
>services : ts.LanguageService
|
||||
>getSyntacticDiagnostics : (fileName: string) => ts.Diagnostic[]
|
||||
>fileName : string
|
||||
|
||||
.concat(services.getSemanticDiagnostics(fileName));
|
||||
>concat : { <U extends ts.Diagnostic[]>(...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; }
|
||||
>services.getSemanticDiagnostics(fileName) : ts.Diagnostic[]
|
||||
>services.getSemanticDiagnostics : (fileName: string) => ts.Diagnostic[]
|
||||
>services : ts.LanguageService
|
||||
>getSemanticDiagnostics : (fileName: string) => ts.Diagnostic[]
|
||||
>fileName : string
|
||||
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
>allDiagnostics.forEach(diagnostic => { let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); if (diagnostic.file) { let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); } else { console.log(` Error: ${message}`); } }) : void
|
||||
>allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
|
||||
>allDiagnostics : ts.Diagnostic[]
|
||||
>forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void
|
||||
>diagnostic => { let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); if (diagnostic.file) { let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); } else { console.log(` Error: ${message}`); } } : (diagnostic: ts.Diagnostic) => void
|
||||
>diagnostic : ts.Diagnostic
|
||||
|
||||
let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
||||
>message : string
|
||||
>ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n") : string
|
||||
>ts.flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string
|
||||
>ts : typeof ts
|
||||
>flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string
|
||||
>diagnostic.messageText : string | ts.DiagnosticMessageChain
|
||||
>diagnostic : ts.Diagnostic
|
||||
>messageText : string | ts.DiagnosticMessageChain
|
||||
|
||||
if (diagnostic.file) {
|
||||
>diagnostic.file : ts.SourceFile
|
||||
>diagnostic : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
|
||||
let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
>line : number
|
||||
>character : number
|
||||
>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter
|
||||
>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>diagnostic.file : ts.SourceFile
|
||||
>diagnostic : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter
|
||||
>diagnostic.start : number
|
||||
>diagnostic : ts.Diagnostic
|
||||
>start : number
|
||||
|
||||
console.log(` Error ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
>console.log(` Error ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
>diagnostic.file.fileName : string
|
||||
>diagnostic.file : ts.SourceFile
|
||||
>diagnostic : ts.Diagnostic
|
||||
>file : ts.SourceFile
|
||||
>fileName : string
|
||||
>line + 1 : number
|
||||
>line : number
|
||||
>character + 1 : number
|
||||
>character : number
|
||||
>message : string
|
||||
}
|
||||
else {
|
||||
console.log(` Error: ${message}`);
|
||||
>console.log(` Error: ${message}`) : any
|
||||
>console.log : any
|
||||
>console : any
|
||||
>log : any
|
||||
>message : string
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize files constituting the program as all .ts files in the current directory
|
||||
const currentDirectoryFiles = fs.readdirSync(process.cwd()).
|
||||
>currentDirectoryFiles : any
|
||||
>fs.readdirSync(process.cwd()). filter(fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts") : any
|
||||
>fs.readdirSync(process.cwd()). filter : any
|
||||
>fs.readdirSync(process.cwd()) : any
|
||||
>fs.readdirSync : any
|
||||
>fs : any
|
||||
>readdirSync : any
|
||||
>process.cwd() : any
|
||||
>process.cwd : any
|
||||
>process : any
|
||||
>cwd : any
|
||||
|
||||
filter(fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts");
|
||||
>filter : any
|
||||
>fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts" : (fileName: any) => boolean
|
||||
>fileName : any
|
||||
>fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts" : boolean
|
||||
>fileName.length >= 3 : boolean
|
||||
>fileName.length : any
|
||||
>fileName : any
|
||||
>length : any
|
||||
>fileName.substr(fileName.length - 3, 3) === ".ts" : boolean
|
||||
>fileName.substr(fileName.length - 3, 3) : any
|
||||
>fileName.substr : any
|
||||
>fileName : any
|
||||
>substr : any
|
||||
>fileName.length - 3 : number
|
||||
>fileName.length : any
|
||||
>fileName : any
|
||||
>length : any
|
||||
|
||||
// Start the watcher
|
||||
watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS });
|
||||
>watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }) : void
|
||||
>watch : (rootFileNames: string[], options: ts.CompilerOptions) => void
|
||||
>currentDirectoryFiles : any
|
||||
>{ module: ts.ModuleKind.CommonJS } : { [x: string]: ts.ModuleKind; module: ts.ModuleKind; }
|
||||
>module : ts.ModuleKind
|
||||
>ts.ModuleKind.CommonJS : ts.ModuleKind
|
||||
>ts.ModuleKind : typeof ts.ModuleKind
|
||||
>ts : typeof ts
|
||||
>ModuleKind : typeof ts.ModuleKind
|
||||
>CommonJS : ts.ModuleKind
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
|
||||
declare module Point {
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 0), Decl(function.d.ts, 0, 0))
|
||||
|
||||
export var Origin: { x: number; y: number; }
|
||||
>Origin : Symbol(Origin, Decl(module.d.ts, 1, 14))
|
||||
>x : Symbol(x, Decl(module.d.ts, 1, 24))
|
||||
>y : Symbol(y, Decl(module.d.ts, 1, 35))
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/function.d.ts ===
|
||||
declare function Point(): { x: number; y: number; }
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 0), Decl(function.d.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(function.d.ts, 0, 27))
|
||||
>y : Symbol(y, Decl(function.d.ts, 0, 38))
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
|
||||
var cl: { x: number; y: number; }
|
||||
>cl : Symbol(cl, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>x : Symbol(x, Decl(test.ts, 0, 9))
|
||||
>y : Symbol(y, Decl(test.ts, 0, 20))
|
||||
|
||||
var cl = Point();
|
||||
>cl : Symbol(cl, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 0), Decl(function.d.ts, 0, 0))
|
||||
|
||||
var cl = Point.Origin;
|
||||
>cl : Symbol(cl, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>Point.Origin : Symbol(Point.Origin, Decl(module.d.ts, 1, 14))
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 0), Decl(function.d.ts, 0, 0))
|
||||
>Origin : Symbol(Point.Origin, Decl(module.d.ts, 1, 14))
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
|
||||
declare module A {
|
||||
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(class.d.ts, 0, 0))
|
||||
|
||||
export module Point {
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
|
||||
|
||||
export var Origin: {
|
||||
>Origin : Symbol(Origin, Decl(module.d.ts, 2, 18))
|
||||
|
||||
x: number;
|
||||
>x : Symbol(x, Decl(module.d.ts, 2, 28))
|
||||
|
||||
y: number;
|
||||
>y : Symbol(y, Decl(module.d.ts, 3, 22))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/class.d.ts ===
|
||||
declare module A {
|
||||
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(class.d.ts, 0, 0))
|
||||
|
||||
export class Point {
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
|
||||
|
||||
constructor(x: number, y: number);
|
||||
>x : Symbol(x, Decl(class.d.ts, 2, 20))
|
||||
>y : Symbol(y, Decl(class.d.ts, 2, 30))
|
||||
|
||||
x: number;
|
||||
>x : Symbol(x, Decl(class.d.ts, 2, 42))
|
||||
|
||||
y: number;
|
||||
>y : Symbol(y, Decl(class.d.ts, 3, 18))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
|
||||
var p: { x: number; y: number; }
|
||||
>p : Symbol(p, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>x : Symbol(x, Decl(test.ts, 0, 8))
|
||||
>y : Symbol(y, Decl(test.ts, 0, 19))
|
||||
|
||||
var p = A.Point.Origin;
|
||||
>p : Symbol(p, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>A.Point.Origin : Symbol(A.Point.Origin, Decl(module.d.ts, 2, 18))
|
||||
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
|
||||
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(class.d.ts, 0, 0))
|
||||
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
|
||||
>Origin : Symbol(A.Point.Origin, Decl(module.d.ts, 2, 18))
|
||||
|
||||
var p = new A.Point(0, 0); // unexpected error here, bug 840000
|
||||
>p : Symbol(p, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
|
||||
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(class.d.ts, 0, 0))
|
||||
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(class.d.ts, 0, 18))
|
||||
|
||||
@@ -56,4 +56,6 @@ var p = new A.Point(0, 0); // unexpected error here, bug 840000
|
||||
>A.Point : typeof A.Point
|
||||
>A : typeof A
|
||||
>Point : typeof A.Point
|
||||
>0 : number
|
||||
>0 : number
|
||||
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
|
||||
declare module A {
|
||||
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(classPoint.ts, 0, 0))
|
||||
|
||||
export module Point {
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
|
||||
|
||||
export var Origin: {
|
||||
>Origin : Symbol(Origin, Decl(module.d.ts, 2, 18))
|
||||
|
||||
x: number;
|
||||
>x : Symbol(x, Decl(module.d.ts, 2, 28))
|
||||
|
||||
y: number;
|
||||
>y : Symbol(y, Decl(module.d.ts, 3, 22))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/classPoint.ts ===
|
||||
module A {
|
||||
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(classPoint.ts, 0, 0))
|
||||
|
||||
export class Point {
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : Symbol(x, Decl(classPoint.ts, 2, 20))
|
||||
>y : Symbol(y, Decl(classPoint.ts, 2, 37))
|
||||
}
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
|
||||
var p: { x: number; y: number; }
|
||||
>p : Symbol(p, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>x : Symbol(x, Decl(test.ts, 0, 8))
|
||||
>y : Symbol(y, Decl(test.ts, 0, 19))
|
||||
|
||||
var p = A.Point.Origin;
|
||||
>p : Symbol(p, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>A.Point.Origin : Symbol(A.Point.Origin, Decl(module.d.ts, 2, 18))
|
||||
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
|
||||
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(classPoint.ts, 0, 0))
|
||||
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
|
||||
>Origin : Symbol(A.Point.Origin, Decl(module.d.ts, 2, 18))
|
||||
|
||||
var p = new A.Point(0, 0); // unexpected error here, bug 840000
|
||||
>p : Symbol(p, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>A.Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
|
||||
>A : Symbol(A, Decl(module.d.ts, 0, 0), Decl(classPoint.ts, 0, 0))
|
||||
>Point : Symbol(A.Point, Decl(module.d.ts, 0, 18), Decl(classPoint.ts, 0, 10))
|
||||
|
||||
+2
@@ -50,4 +50,6 @@ var p = new A.Point(0, 0); // unexpected error here, bug 840000
|
||||
>A.Point : typeof A.Point
|
||||
>A : typeof A
|
||||
>Point : typeof A.Point
|
||||
>0 : number
|
||||
>0 : number
|
||||
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/module.d.ts ===
|
||||
declare module Point {
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 0), Decl(function.ts, 0, 0))
|
||||
|
||||
export var Origin: { x: number; y: number; }
|
||||
>Origin : Symbol(Origin, Decl(module.d.ts, 1, 14))
|
||||
>x : Symbol(x, Decl(module.d.ts, 1, 24))
|
||||
>y : Symbol(y, Decl(module.d.ts, 1, 35))
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/function.ts ===
|
||||
function Point() {
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 0), Decl(function.ts, 0, 0))
|
||||
|
||||
return { x: 0, y: 0 };
|
||||
>x : Symbol(x, Decl(function.ts, 1, 12))
|
||||
>y : Symbol(y, Decl(function.ts, 1, 18))
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
|
||||
var cl: { x: number; y: number; }
|
||||
>cl : Symbol(cl, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>x : Symbol(x, Decl(test.ts, 0, 9))
|
||||
>y : Symbol(y, Decl(test.ts, 0, 20))
|
||||
|
||||
var cl = Point();
|
||||
>cl : Symbol(cl, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 0), Decl(function.ts, 0, 0))
|
||||
|
||||
var cl = Point.Origin;
|
||||
>cl : Symbol(cl, Decl(test.ts, 0, 3), Decl(test.ts, 1, 3), Decl(test.ts, 2, 3))
|
||||
>Point.Origin : Symbol(Point.Origin, Decl(module.d.ts, 1, 14))
|
||||
>Point : Symbol(Point, Decl(module.d.ts, 0, 0), Decl(function.ts, 0, 0))
|
||||
>Origin : Symbol(Point.Origin, Decl(module.d.ts, 1, 14))
|
||||
|
||||
+2
@@ -15,7 +15,9 @@ function Point() {
|
||||
return { x: 0, y: 0 };
|
||||
>{ x: 0, y: 0 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/test.ts ===
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction4.ts ===
|
||||
var v = (a, b) => {
|
||||
>v : Symbol(v, Decl(ArrowFunction4.ts, 0, 3))
|
||||
>a : Symbol(a, Decl(ArrowFunction4.ts, 0, 9))
|
||||
>b : Symbol(b, Decl(ArrowFunction4.ts, 0, 11))
|
||||
|
||||
};
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts ===
|
||||
class Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 4, 1))
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 16))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 33))
|
||||
|
||||
static Origin(): Point { return { x: 0, y: 0 }; }
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 1, 55))
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 4, 1))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 3, 37))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 3, 43))
|
||||
}
|
||||
|
||||
module Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 4, 1))
|
||||
|
||||
function Origin() { return ""; }// not an error, since not exported
|
||||
>Origin : Symbol(Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 6, 14))
|
||||
}
|
||||
|
||||
|
||||
module A {
|
||||
>A : Symbol(A, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 8, 1))
|
||||
|
||||
export class Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 16, 5))
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 20))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 37))
|
||||
|
||||
static Origin(): Point { return { x: 0, y: 0 }; }
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 13, 59))
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 16, 5))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 15, 41))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 15, 47))
|
||||
}
|
||||
|
||||
export module Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 16, 5))
|
||||
|
||||
function Origin() { return ""; }// not an error since not exported
|
||||
>Origin : Symbol(Origin, Decl(ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts, 18, 25))
|
||||
}
|
||||
}
|
||||
+6
@@ -11,7 +11,9 @@ class Point {
|
||||
>Point : Point
|
||||
>{ x: 0, y: 0 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
}
|
||||
|
||||
module Point {
|
||||
@@ -19,6 +21,7 @@ module Point {
|
||||
|
||||
function Origin() { return ""; }// not an error, since not exported
|
||||
>Origin : () => string
|
||||
>"" : string
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +40,9 @@ module A {
|
||||
>Point : Point
|
||||
>{ x: 0, y: 0 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
}
|
||||
|
||||
export module Point {
|
||||
@@ -45,5 +50,6 @@ module A {
|
||||
|
||||
function Origin() { return ""; }// not an error since not exported
|
||||
>Origin : () => string
|
||||
>"" : string
|
||||
}
|
||||
}
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts ===
|
||||
class Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 4, 1))
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 16))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 33))
|
||||
|
||||
static Origin: Point = { x: 0, y: 0 };
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 1, 55))
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 4, 1))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 3, 28))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 3, 34))
|
||||
}
|
||||
|
||||
module Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 0, 0), Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 4, 1))
|
||||
|
||||
var Origin = ""; // not an error, since not exported
|
||||
>Origin : Symbol(Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 7, 7))
|
||||
}
|
||||
|
||||
|
||||
module A {
|
||||
>A : Symbol(A, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 8, 1))
|
||||
|
||||
export class Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 16, 5))
|
||||
|
||||
constructor(public x: number, public y: number) { }
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 20))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 37))
|
||||
|
||||
static Origin: Point = { x: 0, y: 0 };
|
||||
>Origin : Symbol(Point.Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 13, 59))
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 16, 5))
|
||||
>x : Symbol(x, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 15, 32))
|
||||
>y : Symbol(y, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 15, 38))
|
||||
}
|
||||
|
||||
export module Point {
|
||||
>Point : Symbol(Point, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 11, 10), Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 16, 5))
|
||||
|
||||
var Origin = ""; // not an error since not exported
|
||||
>Origin : Symbol(Origin, Decl(ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts, 19, 11))
|
||||
}
|
||||
}
|
||||
+6
@@ -11,7 +11,9 @@ class Point {
|
||||
>Point : Point
|
||||
>{ x: 0, y: 0 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
}
|
||||
|
||||
module Point {
|
||||
@@ -19,6 +21,7 @@ module Point {
|
||||
|
||||
var Origin = ""; // not an error, since not exported
|
||||
>Origin : string
|
||||
>"" : string
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +40,9 @@ module A {
|
||||
>Point : Point
|
||||
>{ x: 0, y: 0 } : { x: number; y: number; }
|
||||
>x : number
|
||||
>0 : number
|
||||
>y : number
|
||||
>0 : number
|
||||
}
|
||||
|
||||
export module Point {
|
||||
@@ -45,5 +50,6 @@ module A {
|
||||
|
||||
var Origin = ""; // not an error since not exported
|
||||
>Origin : string
|
||||
>"" : string
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
=== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithStringIndexerAndExportedFunctionWithTypeIncompatibleWithIndexer.ts ===
|
||||
|
||||
No type information for this code.
|
||||
@@ -0,0 +1,44 @@
|
||||
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/class.ts (0 errors) ====
|
||||
module X.Y {
|
||||
export class Point {
|
||||
constructor(x: number, y: number) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ====
|
||||
module X.Y {
|
||||
export module Point {
|
||||
~~~~~
|
||||
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
|
||||
export var Origin = new Point(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/test.ts (0 errors) ====
|
||||
//var cl: { x: number; y: number; }
|
||||
var cl = new X.Y.Point(1,1);
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (0 errors) ====
|
||||
class A {
|
||||
id: string;
|
||||
}
|
||||
|
||||
module A {
|
||||
export var Instance = new A();
|
||||
}
|
||||
|
||||
// ensure merging works as expected
|
||||
var a = A.Instance;
|
||||
var a = new A();
|
||||
var a: { id: string };
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
//// [tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleWithSameNameAndCommonRootES6.ts] ////
|
||||
|
||||
//// [class.ts]
|
||||
module X.Y {
|
||||
export class Point {
|
||||
constructor(x: number, y: number) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
}
|
||||
|
||||
//// [module.ts]
|
||||
module X.Y {
|
||||
export module Point {
|
||||
export var Origin = new Point(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//// [test.ts]
|
||||
//var cl: { x: number; y: number; }
|
||||
var cl = new X.Y.Point(1,1);
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
|
||||
|
||||
//// [simple.ts]
|
||||
class A {
|
||||
id: string;
|
||||
}
|
||||
|
||||
module A {
|
||||
export var Instance = new A();
|
||||
}
|
||||
|
||||
// ensure merging works as expected
|
||||
var a = A.Instance;
|
||||
var a = new A();
|
||||
var a: { id: string };
|
||||
|
||||
|
||||
//// [class.js]
|
||||
var X;
|
||||
(function (X) {
|
||||
var Y;
|
||||
(function (Y) {
|
||||
class Point {
|
||||
constructor(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
Y.Point = Point;
|
||||
})(Y = X.Y || (X.Y = {}));
|
||||
})(X || (X = {}));
|
||||
//// [module.js]
|
||||
var X;
|
||||
(function (X) {
|
||||
var Y;
|
||||
(function (Y) {
|
||||
var Point;
|
||||
(function (Point) {
|
||||
Point.Origin = new Point(0, 0);
|
||||
})(Point = Y.Point || (Y.Point = {}));
|
||||
})(Y = X.Y || (X.Y = {}));
|
||||
})(X || (X = {}));
|
||||
//// [test.js]
|
||||
//var cl: { x: number; y: number; }
|
||||
var cl = new X.Y.Point(1, 1);
|
||||
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
|
||||
//// [simple.js]
|
||||
class A {
|
||||
}
|
||||
(function (A) {
|
||||
A.Instance = new A();
|
||||
})(A || (A = {}));
|
||||
// ensure merging works as expected
|
||||
var a = A.Instance;
|
||||
var a = new A();
|
||||
var a;
|
||||
@@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck2.ts ===
|
||||
for (var v of [true]) { }
|
||||
>v : Symbol(v, Decl(ES3For-ofTypeCheck2.ts, 0, 8))
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
for (var v of [true]) { }
|
||||
>v : boolean
|
||||
>[true] : boolean[]
|
||||
>true : boolean
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES3For-ofTypeCheck6.ts ===
|
||||
var union: string[] | number[];
|
||||
>union : Symbol(union, Decl(ES3For-ofTypeCheck6.ts, 0, 3))
|
||||
|
||||
for (var v of union) { }
|
||||
>v : Symbol(v, Decl(ES3For-ofTypeCheck6.ts, 1, 8))
|
||||
>union : Symbol(union, Decl(ES3For-ofTypeCheck6.ts, 0, 3))
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of10.ts ===
|
||||
function foo() {
|
||||
>foo : Symbol(foo, Decl(ES5For-of10.ts, 0, 0))
|
||||
|
||||
return { x: 0 };
|
||||
>x : Symbol(x, Decl(ES5For-of10.ts, 1, 12))
|
||||
}
|
||||
for (foo().x of []) {
|
||||
>foo().x : Symbol(x, Decl(ES5For-of10.ts, 1, 12))
|
||||
>foo : Symbol(foo, Decl(ES5For-of10.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(ES5For-of10.ts, 1, 12))
|
||||
|
||||
for (foo().x of [])
|
||||
>foo().x : Symbol(x, Decl(ES5For-of10.ts, 1, 12))
|
||||
>foo : Symbol(foo, Decl(ES5For-of10.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(ES5For-of10.ts, 1, 12))
|
||||
|
||||
var p = foo().x;
|
||||
>p : Symbol(p, Decl(ES5For-of10.ts, 5, 11))
|
||||
>foo().x : Symbol(x, Decl(ES5For-of10.ts, 1, 12))
|
||||
>foo : Symbol(foo, Decl(ES5For-of10.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(ES5For-of10.ts, 1, 12))
|
||||
}
|
||||
@@ -5,6 +5,7 @@ function foo() {
|
||||
return { x: 0 };
|
||||
>{ x: 0 } : { x: number; }
|
||||
>x : number
|
||||
>0 : number
|
||||
}
|
||||
for (foo().x of []) {
|
||||
>foo().x : number
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of11.ts ===
|
||||
var v;
|
||||
>v : Symbol(v, Decl(ES5For-of11.ts, 0, 3))
|
||||
|
||||
for (v of []) { }
|
||||
>v : Symbol(v, Decl(ES5For-of11.ts, 0, 3))
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of13.ts ===
|
||||
for (let v of ['a', 'b', 'c']) {
|
||||
>v : Symbol(v, Decl(ES5For-of13.ts, 0, 8))
|
||||
|
||||
var x = v;
|
||||
>x : Symbol(x, Decl(ES5For-of13.ts, 1, 7))
|
||||
>v : Symbol(v, Decl(ES5For-of13.ts, 0, 8))
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
for (let v of ['a', 'b', 'c']) {
|
||||
>v : string
|
||||
>['a', 'b', 'c'] : string[]
|
||||
>'a' : string
|
||||
>'b' : string
|
||||
>'c' : string
|
||||
|
||||
var x = v;
|
||||
>x : string
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of14.ts ===
|
||||
for (const v of []) {
|
||||
>v : Symbol(v, Decl(ES5For-of14.ts, 0, 10))
|
||||
|
||||
var x = v;
|
||||
>x : Symbol(x, Decl(ES5For-of14.ts, 1, 7))
|
||||
>v : Symbol(v, Decl(ES5For-of14.ts, 0, 10))
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of15.ts ===
|
||||
for (let v of []) {
|
||||
>v : Symbol(v, Decl(ES5For-of15.ts, 0, 8))
|
||||
|
||||
v;
|
||||
>v : Symbol(v, Decl(ES5For-of15.ts, 0, 8))
|
||||
|
||||
for (const v of []) {
|
||||
>v : Symbol(v, Decl(ES5For-of15.ts, 2, 14))
|
||||
|
||||
var x = v;
|
||||
>x : Symbol(x, Decl(ES5For-of15.ts, 3, 11))
|
||||
>v : Symbol(v, Decl(ES5For-of15.ts, 2, 14))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of16.ts ===
|
||||
for (let v of []) {
|
||||
>v : Symbol(v, Decl(ES5For-of16.ts, 0, 8))
|
||||
|
||||
v;
|
||||
>v : Symbol(v, Decl(ES5For-of16.ts, 0, 8))
|
||||
|
||||
for (let v of []) {
|
||||
>v : Symbol(v, Decl(ES5For-of16.ts, 2, 12))
|
||||
|
||||
var x = v;
|
||||
>x : Symbol(x, Decl(ES5For-of16.ts, 3, 11))
|
||||
>v : Symbol(v, Decl(ES5For-of16.ts, 2, 12))
|
||||
|
||||
v++;
|
||||
>v : Symbol(v, Decl(ES5For-of16.ts, 2, 12))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/statements/for-ofStatements/ES5For-of18.ts ===
|
||||
for (let v of []) {
|
||||
>v : Symbol(v, Decl(ES5For-of18.ts, 0, 8))
|
||||
|
||||
v;
|
||||
>v : Symbol(v, Decl(ES5For-of18.ts, 0, 8))
|
||||
}
|
||||
for (let v of []) {
|
||||
>v : Symbol(v, Decl(ES5For-of18.ts, 3, 8))
|
||||
|
||||
v;
|
||||
>v : Symbol(v, Decl(ES5For-of18.ts, 3, 8))
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user