mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
fix merge conflicts with master
This commit is contained in:
+2
-1
@@ -1 +1,2 @@
|
||||
*.js linguist-language=TypeScript
|
||||
*.js linguist-language=TypeScript
|
||||
* -text
|
||||
|
||||
@@ -21,6 +21,7 @@ tests/services/baselines/local/*
|
||||
tests/baselines/prototyping/local/*
|
||||
tests/baselines/rwc/*
|
||||
tests/baselines/test262/*
|
||||
tests/baselines/reference/projectOutput/*
|
||||
tests/baselines/local/projectOutput/*
|
||||
tests/services/baselines/prototyping/local/*
|
||||
tests/services/browser/typescriptServices.js
|
||||
@@ -46,3 +47,5 @@ scripts/*.js.map
|
||||
coverage/
|
||||
internal/
|
||||
**/.DS_Store
|
||||
.settings/*
|
||||
!.settings/tasks.json
|
||||
|
||||
+2
-1
@@ -4,4 +4,5 @@ scripts
|
||||
src
|
||||
tests
|
||||
Jakefile
|
||||
.travis.yml
|
||||
.travis.yml
|
||||
.settings/
|
||||
@@ -0,0 +1,23 @@
|
||||
// Available variables which can be used inside of strings.
|
||||
// ${workspaceRoot}: the root folder of the team
|
||||
// ${file}: the current opened file
|
||||
// ${fileBasename}: the current opened file's basename
|
||||
// ${fileDirname}: the current opened file's dirname
|
||||
// ${fileExtname}: the current opened file's extension
|
||||
// ${cwd}: the current working directory of the spawned process
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "jake",
|
||||
"isShellCommand": true,
|
||||
"showOutput": "silent",
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "local",
|
||||
"isBuildCommand": true,
|
||||
"showOutput": "silent",
|
||||
"problemMatcher": [
|
||||
"$tsc"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
+47
-16
@@ -31,44 +31,75 @@ Your pull request should:
|
||||
## Running the Tests
|
||||
To run all tests, invoke the runtests target using jake:
|
||||
|
||||
`jake runtests`
|
||||
```Shell
|
||||
jake runtests
|
||||
```
|
||||
|
||||
This run will all tests; to run only a specific subset of tests, use:
|
||||
|
||||
`jake runtests tests=<regex>`
|
||||
```Shell
|
||||
jake runtests tests=<regex>
|
||||
```
|
||||
|
||||
e.g. to run all compiler baseline tests:
|
||||
|
||||
`jake runtests tests=compiler`
|
||||
```Shell
|
||||
jake runtests tests=compiler
|
||||
```
|
||||
|
||||
or to run specifc test:tests\cases\compiler\2dArrays.ts
|
||||
or to run specifc test: `tests\cases\compiler\2dArrays.ts`
|
||||
|
||||
`jake runtests tests=2dArrays`
|
||||
```Shell
|
||||
jake runtests tests=2dArrays
|
||||
```
|
||||
|
||||
## Adding a Test
|
||||
To add a new testcase, simply place a .ts file in tests\cases\compiler containing code that exemplifies the bugfix or change you are making.
|
||||
To add a new testcase, simply place a `.ts` file in `tests\cases\compiler` containing code that exemplifies the bugfix or change you are making.
|
||||
|
||||
These files support metadata tags in the format // @name: value . The supported names and values are:
|
||||
These files support metadata tags in the format `// @metaDataName: value`. The supported names and values are:
|
||||
|
||||
* comments, sourcemap, noimplicitany, declaration: true or false (corresponds to the compiler command-line options of the same name)
|
||||
* target: ES3 or ES5 (same as compiler)
|
||||
* out, outDir: path (same as compiler)
|
||||
* module: local, commonjs, or amd (local corresponds to not passing any compiler --module flag)
|
||||
* `comments`, `sourcemap`, `noimplicitany`, `declaration`: true or false (corresponds to the compiler command-line options of the same name)
|
||||
* `target`: ES3 or ES5 (same as compiler)
|
||||
* `out`, outDir: path (same as compiler)
|
||||
* `module`: local, commonjs, or amd (local corresponds to not passing any compiler --module flag)
|
||||
* `fileName`: path
|
||||
* These tags delimit sections of a file to be used as separate compilation units. They are useful for tests relating to modules. See below for examples.
|
||||
|
||||
**Note** that if you have a test corresponding to a specific spec compliance item, you can place it in tests\cases\conformance in an appropriately-named subfolder.
|
||||
**Note** that if you have a test corresponding to a specific spec compliance item, you can place it in `tests\cases\conformance` in an appropriately-named subfolder.
|
||||
**Note** that filenames here must be distinct from all other compiler testcase names, so you may have to work a bit to find a unique name if it's something common.
|
||||
|
||||
### Tests for multiple files
|
||||
|
||||
When one needs to test for scenarios which require multiple files, it is useful to use the `fileName` metadata tag as such:
|
||||
|
||||
```TypeScript
|
||||
// @fileName: file1.ts
|
||||
export function f() {
|
||||
}
|
||||
|
||||
// @fileName: file2.ts
|
||||
import { f as g } from "file1";
|
||||
|
||||
var x = g();
|
||||
```
|
||||
|
||||
One can also write a project test, but it is slightly more involved.
|
||||
|
||||
## Managing the Baselines
|
||||
Compiler testcases generate baselines that track the emitted .js, the errors produced by the compiler, and the type of each expression in the file. Additionally, some testcases opt in to baselining the source map output.
|
||||
Compiler testcases generate baselines that track the emitted `.js`, the errors produced by the compiler, and the type of each expression in the file. Additionally, some testcases opt in to baselining the source map output.
|
||||
|
||||
When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use
|
||||
|
||||
`jake diff`
|
||||
```Shell
|
||||
jake diff
|
||||
```
|
||||
|
||||
After verifying that the changes in the baselines are correct, run
|
||||
|
||||
`jake baseline-accept`
|
||||
```Shell
|
||||
jake baseline-accept
|
||||
```
|
||||
|
||||
to establish the new baselines as the desired behavior. This will change the files in tests\baselines\reference, which should be included as part of your commit. It's important to carefully validate changes in the baselines.
|
||||
to establish the new baselines as the desired behavior. This will change the files in `tests\baselines\reference`, which should be included as part of your commit. It's important to carefully validate changes in the baselines.
|
||||
|
||||
**Note** that baseline-accept should only be run after a full test run! Accepting baselines after running a subset of tests will delete baseline files for the tests that didn't run.
|
||||
|
||||
+5
-3
@@ -123,12 +123,14 @@ var harnessSources = [
|
||||
return path.join(harnessDirectory, f);
|
||||
}).concat([
|
||||
"incrementalParser.ts",
|
||||
"jsDocParsing.ts",
|
||||
"services/colorization.ts",
|
||||
"services/documentRegistry.ts",
|
||||
"services/preProcessFile.ts",
|
||||
"services/patternMatcher.ts",
|
||||
"versionCache.ts",
|
||||
"convertToBase64.ts"
|
||||
"convertToBase64.ts",
|
||||
"transpile.ts"
|
||||
].map(function (f) {
|
||||
return path.join(unittestsDirectory, f);
|
||||
})).concat([
|
||||
@@ -147,7 +149,7 @@ var librarySourceMap = [
|
||||
{ target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.d.ts", sources: ["core.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]},
|
||||
{ target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"]},
|
||||
{ target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] },
|
||||
];
|
||||
|
||||
var libraryTargets = librarySourceMap.map(function (f) {
|
||||
@@ -505,7 +507,7 @@ function cleanTestDirs() {
|
||||
// used to pass data from jake command line directly to run.js
|
||||
function writeTestConfigFile(tests, testConfigFile) {
|
||||
console.log('Running test(s): ' + tests);
|
||||
var testConfigContents = '{\n' + '\ttest: [\'' + tests + '\']\n}';
|
||||
var testConfigContents = JSON.stringify({ test: [tests]});
|
||||
fs.writeFileSync('test.config', testConfigContents);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
# TypeScript
|
||||
|
||||
[](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](http://blogs.msdn.com/typescript) and [twitter account](https://twitter.com/typescriptlang).
|
||||
|
||||
|
||||
|
||||
Vendored
+59
-26
@@ -1237,11 +1237,41 @@ interface SymbolConstructor {
|
||||
isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object.Called by the semantics of the
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
*/
|
||||
match: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
* String.prototype.replace method.
|
||||
*/
|
||||
replace: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* regular expression. Called by the String.prototype.search method.
|
||||
*/
|
||||
search: symbol;
|
||||
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
* derived objects.
|
||||
*/
|
||||
species: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* expression. Called by the String.prototype.split method.
|
||||
*/
|
||||
split: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
@@ -1472,6 +1502,11 @@ interface Array<T> {
|
||||
copyWithin(target: number, start: number, end?: number): T[];
|
||||
}
|
||||
|
||||
interface IArguments {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<any>;
|
||||
}
|
||||
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Creates an array from an array-like object.
|
||||
@@ -1656,14 +1691,6 @@ interface GeneratorFunctionConstructor {
|
||||
}
|
||||
declare var GeneratorFunction: GeneratorFunctionConstructor;
|
||||
|
||||
interface Generator<T> extends IterableIterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
throw(exception: any): IteratorResult<T>;
|
||||
return(value: T): IteratorResult<T>;
|
||||
[Symbol.iterator](): Generator<T>;
|
||||
[Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface Math {
|
||||
/**
|
||||
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
|
||||
@@ -4728,6 +4755,17 @@ declare module Reflect {
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
|
||||
interface PromiseLike<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
*/
|
||||
@@ -4738,14 +4776,17 @@ interface Promise<T> {
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Promise<TResult>, onrejected?: (reason: any) => TResult | Promise<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected?: (reason: any) => T | Promise<T>): Promise<T>;
|
||||
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
[Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
@@ -4756,13 +4797,11 @@ interface PromiseConstructor {
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param init A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
<T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
@@ -4770,15 +4809,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of values.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all(values: Promise<void>[]): Promise<void>;
|
||||
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
@@ -4786,7 +4817,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: (T | Promise<T>)[]): Promise<T>;
|
||||
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
@@ -4807,13 +4838,15 @@ interface PromiseConstructor {
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
resolve<T>(value: T | Promise<T>): Promise<T>;
|
||||
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise .
|
||||
* @returns A resolved promise.
|
||||
*/
|
||||
resolve(): Promise<void>;
|
||||
|
||||
[Symbol.species]: Function;
|
||||
}
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
||||
|
||||
Vendored
+163
-11
@@ -1231,6 +1231,139 @@ interface ArrayBufferView {
|
||||
byteOffset: number;
|
||||
}
|
||||
|
||||
interface DataView {
|
||||
buffer: ArrayBuffer;
|
||||
byteLength: number;
|
||||
byteOffset: number;
|
||||
/**
|
||||
* Gets the Float32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Float64 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat64(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Int8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Int16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt16(byteOffset: number, littleEndian: boolean): number;
|
||||
/**
|
||||
* Gets the Int32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint16(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Stores an Float32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Float64 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setInt8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Int16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setUint8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
}
|
||||
|
||||
interface DataViewConstructor {
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
|
||||
}
|
||||
declare var DataView: DataViewConstructor;
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
@@ -3419,10 +3552,10 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedNumberFormatOptions;
|
||||
}
|
||||
var NumberFormat: {
|
||||
new (locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
new (locale?: string, options?: NumberFormatOptions): Collator;
|
||||
(locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
(locale?: string, options?: NumberFormatOptions): Collator;
|
||||
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
|
||||
}
|
||||
@@ -3464,10 +3597,10 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedDateTimeFormatOptions;
|
||||
}
|
||||
var DateTimeFormat: {
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
(locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
|
||||
}
|
||||
@@ -7222,6 +7355,8 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
||||
* @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl");
|
||||
*/
|
||||
getContext(contextId: "2d"): CanvasRenderingContext2D;
|
||||
getContext(contextId: "experimental-webgl"): WebGLRenderingContext;
|
||||
getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext;
|
||||
/**
|
||||
* Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.
|
||||
@@ -11200,10 +11335,10 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: string;
|
||||
readyState: number;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: string): void;
|
||||
endOfStream(error?: number): void;
|
||||
removeSourceBuffer(sourceBuffer: SourceBuffer): void;
|
||||
}
|
||||
|
||||
@@ -11932,7 +12067,7 @@ declare var PopStateEvent: {
|
||||
|
||||
interface Position {
|
||||
coords: Coordinates;
|
||||
timestamp: Date;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
declare var Position: {
|
||||
@@ -14613,9 +14748,17 @@ interface WebGLRenderingContext {
|
||||
stencilMaskSeparate(face: number, mask: number): void;
|
||||
stencilOp(fail: number, zfail: number, zpass: number): void;
|
||||
stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, image: HTMLImageElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, canvas: HTMLCanvasElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, video: HTMLVideoElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageData): void;
|
||||
texParameterf(target: number, pname: number, param: number): void;
|
||||
texParameteri(target: number, pname: number, param: number): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, image: HTMLImageElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void;
|
||||
uniform1f(location: WebGLUniformLocation, x: number): void;
|
||||
uniform1fv(location: WebGLUniformLocation, v: any): void;
|
||||
@@ -15703,6 +15846,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
overrideMimeType(mime: string): void;
|
||||
send(data?: Document): void;
|
||||
send(data?: string): void;
|
||||
send(data?: any): void;
|
||||
setRequestHeader(header: string, value: string): void;
|
||||
DONE: number;
|
||||
HEADERS_RECEIVED: number;
|
||||
@@ -15854,14 +15998,17 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent;
|
||||
createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent;
|
||||
createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent;
|
||||
createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent;
|
||||
createEvent(eventInterface:"CloseEvent"): CloseEvent;
|
||||
createEvent(eventInterface:"CommandEvent"): CommandEvent;
|
||||
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
|
||||
createEvent(eventInterface:"CustomEvent"): CustomEvent;
|
||||
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
|
||||
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
|
||||
createEvent(eventInterface:"DragEvent"): DragEvent;
|
||||
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
|
||||
createEvent(eventInterface:"Event"): Event;
|
||||
createEvent(eventInterface:"Events"): Event;
|
||||
createEvent(eventInterface:"FocusEvent"): FocusEvent;
|
||||
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
|
||||
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
|
||||
@@ -15876,8 +16023,10 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
|
||||
createEvent(eventInterface:"MessageEvent"): MessageEvent;
|
||||
createEvent(eventInterface:"MouseEvent"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseEvents"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
|
||||
createEvent(eventInterface:"MutationEvent"): MutationEvent;
|
||||
createEvent(eventInterface:"MutationEvents"): MutationEvent;
|
||||
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
|
||||
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
|
||||
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
|
||||
@@ -15888,6 +16037,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
|
||||
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
|
||||
createEvent(eventInterface:"StorageEvent"): StorageEvent;
|
||||
createEvent(eventInterface:"TextEvent"): TextEvent;
|
||||
@@ -15895,6 +16045,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"TrackEvent"): TrackEvent;
|
||||
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
|
||||
createEvent(eventInterface:"UIEvent"): UIEvent;
|
||||
createEvent(eventInterface:"UIEvents"): UIEvent;
|
||||
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
|
||||
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
|
||||
createEvent(eventInterface:"WheelEvent"): WheelEvent;
|
||||
@@ -16486,6 +16637,7 @@ declare function addEventListener(type: "volumechange", listener: (ev: Event) =>
|
||||
declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
|
||||
/////////////////////////////
|
||||
/// WorkerGlobalScope APIs
|
||||
/////////////////////////////
|
||||
|
||||
Vendored
+163
-12
@@ -61,6 +61,139 @@ interface ArrayBufferView {
|
||||
byteOffset: number;
|
||||
}
|
||||
|
||||
interface DataView {
|
||||
buffer: ArrayBuffer;
|
||||
byteLength: number;
|
||||
byteOffset: number;
|
||||
/**
|
||||
* Gets the Float32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Float64 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat64(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Int8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Int16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt16(byteOffset: number, littleEndian: boolean): number;
|
||||
/**
|
||||
* Gets the Int32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint16(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Stores an Float32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Float64 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setInt8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Int16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setUint8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
}
|
||||
|
||||
interface DataViewConstructor {
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
|
||||
}
|
||||
declare var DataView: DataViewConstructor;
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
@@ -2249,10 +2382,10 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedNumberFormatOptions;
|
||||
}
|
||||
var NumberFormat: {
|
||||
new (locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
new (locale?: string, options?: NumberFormatOptions): Collator;
|
||||
(locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
(locale?: string, options?: NumberFormatOptions): Collator;
|
||||
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
|
||||
}
|
||||
@@ -2294,10 +2427,10 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedDateTimeFormatOptions;
|
||||
}
|
||||
var DateTimeFormat: {
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
(locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
|
||||
}
|
||||
@@ -6052,6 +6185,8 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
||||
* @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl");
|
||||
*/
|
||||
getContext(contextId: "2d"): CanvasRenderingContext2D;
|
||||
getContext(contextId: "experimental-webgl"): WebGLRenderingContext;
|
||||
getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext;
|
||||
/**
|
||||
* Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.
|
||||
@@ -10030,10 +10165,10 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: string;
|
||||
readyState: number;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: string): void;
|
||||
endOfStream(error?: number): void;
|
||||
removeSourceBuffer(sourceBuffer: SourceBuffer): void;
|
||||
}
|
||||
|
||||
@@ -10762,7 +10897,7 @@ declare var PopStateEvent: {
|
||||
|
||||
interface Position {
|
||||
coords: Coordinates;
|
||||
timestamp: Date;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
declare var Position: {
|
||||
@@ -13443,9 +13578,17 @@ interface WebGLRenderingContext {
|
||||
stencilMaskSeparate(face: number, mask: number): void;
|
||||
stencilOp(fail: number, zfail: number, zpass: number): void;
|
||||
stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, image: HTMLImageElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, canvas: HTMLCanvasElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, video: HTMLVideoElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageData): void;
|
||||
texParameterf(target: number, pname: number, param: number): void;
|
||||
texParameteri(target: number, pname: number, param: number): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, image: HTMLImageElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void;
|
||||
uniform1f(location: WebGLUniformLocation, x: number): void;
|
||||
uniform1fv(location: WebGLUniformLocation, v: any): void;
|
||||
@@ -14533,6 +14676,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
overrideMimeType(mime: string): void;
|
||||
send(data?: Document): void;
|
||||
send(data?: string): void;
|
||||
send(data?: any): void;
|
||||
setRequestHeader(header: string, value: string): void;
|
||||
DONE: number;
|
||||
HEADERS_RECEIVED: number;
|
||||
@@ -14684,14 +14828,17 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent;
|
||||
createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent;
|
||||
createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent;
|
||||
createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent;
|
||||
createEvent(eventInterface:"CloseEvent"): CloseEvent;
|
||||
createEvent(eventInterface:"CommandEvent"): CommandEvent;
|
||||
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
|
||||
createEvent(eventInterface:"CustomEvent"): CustomEvent;
|
||||
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
|
||||
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
|
||||
createEvent(eventInterface:"DragEvent"): DragEvent;
|
||||
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
|
||||
createEvent(eventInterface:"Event"): Event;
|
||||
createEvent(eventInterface:"Events"): Event;
|
||||
createEvent(eventInterface:"FocusEvent"): FocusEvent;
|
||||
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
|
||||
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
|
||||
@@ -14706,8 +14853,10 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
|
||||
createEvent(eventInterface:"MessageEvent"): MessageEvent;
|
||||
createEvent(eventInterface:"MouseEvent"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseEvents"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
|
||||
createEvent(eventInterface:"MutationEvent"): MutationEvent;
|
||||
createEvent(eventInterface:"MutationEvents"): MutationEvent;
|
||||
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
|
||||
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
|
||||
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
|
||||
@@ -14718,6 +14867,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
|
||||
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
|
||||
createEvent(eventInterface:"StorageEvent"): StorageEvent;
|
||||
createEvent(eventInterface:"TextEvent"): TextEvent;
|
||||
@@ -14725,6 +14875,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"TrackEvent"): TrackEvent;
|
||||
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
|
||||
createEvent(eventInterface:"UIEvent"): UIEvent;
|
||||
createEvent(eventInterface:"UIEvents"): UIEvent;
|
||||
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
|
||||
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
|
||||
createEvent(eventInterface:"WheelEvent"): WheelEvent;
|
||||
@@ -15315,4 +15466,4 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any,
|
||||
declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
|
||||
Vendored
+89
-37
@@ -1237,11 +1237,41 @@ interface SymbolConstructor {
|
||||
isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object.Called by the semantics of the
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
*/
|
||||
match: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
* String.prototype.replace method.
|
||||
*/
|
||||
replace: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* regular expression. Called by the String.prototype.search method.
|
||||
*/
|
||||
search: symbol;
|
||||
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
* derived objects.
|
||||
*/
|
||||
species: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* expression. Called by the String.prototype.split method.
|
||||
*/
|
||||
split: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
@@ -1472,6 +1502,11 @@ interface Array<T> {
|
||||
copyWithin(target: number, start: number, end?: number): T[];
|
||||
}
|
||||
|
||||
interface IArguments {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<any>;
|
||||
}
|
||||
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Creates an array from an array-like object.
|
||||
@@ -1656,14 +1691,6 @@ interface GeneratorFunctionConstructor {
|
||||
}
|
||||
declare var GeneratorFunction: GeneratorFunctionConstructor;
|
||||
|
||||
interface Generator<T> extends IterableIterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
throw(exception: any): IteratorResult<T>;
|
||||
return(value: T): IteratorResult<T>;
|
||||
[Symbol.iterator](): Generator<T>;
|
||||
[Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface Math {
|
||||
/**
|
||||
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
|
||||
@@ -4728,6 +4755,17 @@ declare module Reflect {
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
|
||||
interface PromiseLike<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
*/
|
||||
@@ -4738,14 +4776,17 @@ interface Promise<T> {
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Promise<TResult>, onrejected?: (reason: any) => TResult | Promise<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected?: (reason: any) => T | Promise<T>): Promise<T>;
|
||||
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
[Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
@@ -4756,13 +4797,11 @@ interface PromiseConstructor {
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param init A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
<T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
@@ -4770,15 +4809,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of values.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all(values: Promise<void>[]): Promise<void>;
|
||||
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
@@ -4786,7 +4817,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: (T | Promise<T>)[]): Promise<T>;
|
||||
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
@@ -4807,13 +4838,15 @@ interface PromiseConstructor {
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
resolve<T>(value: T | Promise<T>): Promise<T>;
|
||||
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise .
|
||||
* @returns A resolved promise.
|
||||
*/
|
||||
resolve(): Promise<void>;
|
||||
|
||||
[Symbol.species]: Function;
|
||||
}
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
||||
@@ -4897,10 +4930,10 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedNumberFormatOptions;
|
||||
}
|
||||
var NumberFormat: {
|
||||
new (locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
new (locale?: string, options?: NumberFormatOptions): Collator;
|
||||
(locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
(locale?: string, options?: NumberFormatOptions): Collator;
|
||||
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
|
||||
}
|
||||
@@ -4942,10 +4975,10 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedDateTimeFormatOptions;
|
||||
}
|
||||
var DateTimeFormat: {
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
(locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
|
||||
}
|
||||
@@ -8700,6 +8733,8 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
||||
* @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl");
|
||||
*/
|
||||
getContext(contextId: "2d"): CanvasRenderingContext2D;
|
||||
getContext(contextId: "experimental-webgl"): WebGLRenderingContext;
|
||||
getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext;
|
||||
/**
|
||||
* Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.
|
||||
@@ -12678,10 +12713,10 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: string;
|
||||
readyState: number;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: string): void;
|
||||
endOfStream(error?: number): void;
|
||||
removeSourceBuffer(sourceBuffer: SourceBuffer): void;
|
||||
}
|
||||
|
||||
@@ -13410,7 +13445,7 @@ declare var PopStateEvent: {
|
||||
|
||||
interface Position {
|
||||
coords: Coordinates;
|
||||
timestamp: Date;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
declare var Position: {
|
||||
@@ -16091,9 +16126,17 @@ interface WebGLRenderingContext {
|
||||
stencilMaskSeparate(face: number, mask: number): void;
|
||||
stencilOp(fail: number, zfail: number, zpass: number): void;
|
||||
stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, image: HTMLImageElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, canvas: HTMLCanvasElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, video: HTMLVideoElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageData): void;
|
||||
texParameterf(target: number, pname: number, param: number): void;
|
||||
texParameteri(target: number, pname: number, param: number): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, image: HTMLImageElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void;
|
||||
uniform1f(location: WebGLUniformLocation, x: number): void;
|
||||
uniform1fv(location: WebGLUniformLocation, v: any): void;
|
||||
@@ -17181,6 +17224,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
overrideMimeType(mime: string): void;
|
||||
send(data?: Document): void;
|
||||
send(data?: string): void;
|
||||
send(data?: any): void;
|
||||
setRequestHeader(header: string, value: string): void;
|
||||
DONE: number;
|
||||
HEADERS_RECEIVED: number;
|
||||
@@ -17332,14 +17376,17 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent;
|
||||
createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent;
|
||||
createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent;
|
||||
createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent;
|
||||
createEvent(eventInterface:"CloseEvent"): CloseEvent;
|
||||
createEvent(eventInterface:"CommandEvent"): CommandEvent;
|
||||
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
|
||||
createEvent(eventInterface:"CustomEvent"): CustomEvent;
|
||||
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
|
||||
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
|
||||
createEvent(eventInterface:"DragEvent"): DragEvent;
|
||||
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
|
||||
createEvent(eventInterface:"Event"): Event;
|
||||
createEvent(eventInterface:"Events"): Event;
|
||||
createEvent(eventInterface:"FocusEvent"): FocusEvent;
|
||||
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
|
||||
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
|
||||
@@ -17354,8 +17401,10 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
|
||||
createEvent(eventInterface:"MessageEvent"): MessageEvent;
|
||||
createEvent(eventInterface:"MouseEvent"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseEvents"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
|
||||
createEvent(eventInterface:"MutationEvent"): MutationEvent;
|
||||
createEvent(eventInterface:"MutationEvents"): MutationEvent;
|
||||
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
|
||||
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
|
||||
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
|
||||
@@ -17366,6 +17415,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
|
||||
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
|
||||
createEvent(eventInterface:"StorageEvent"): StorageEvent;
|
||||
createEvent(eventInterface:"TextEvent"): TextEvent;
|
||||
@@ -17373,6 +17423,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"TrackEvent"): TrackEvent;
|
||||
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
|
||||
createEvent(eventInterface:"UIEvent"): UIEvent;
|
||||
createEvent(eventInterface:"UIEvents"): UIEvent;
|
||||
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
|
||||
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
|
||||
createEvent(eventInterface:"WheelEvent"): WheelEvent;
|
||||
@@ -17964,6 +18015,7 @@ declare function addEventListener(type: "volumechange", listener: (ev: Event) =>
|
||||
declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
|
||||
/////////////////////////////
|
||||
/// WorkerGlobalScope APIs
|
||||
/////////////////////////////
|
||||
|
||||
Vendored
+141
-8
@@ -61,6 +61,139 @@ interface ArrayBufferView {
|
||||
byteOffset: number;
|
||||
}
|
||||
|
||||
interface DataView {
|
||||
buffer: ArrayBuffer;
|
||||
byteLength: number;
|
||||
byteOffset: number;
|
||||
/**
|
||||
* Gets the Float32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Float64 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getFloat64(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Int8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Int16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt16(byteOffset: number, littleEndian: boolean): number;
|
||||
/**
|
||||
* Gets the Int32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getInt32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint8(byteOffset: number): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint16(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
|
||||
* no alignment constraint; multi-byte values may be fetched from any offset.
|
||||
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
||||
*/
|
||||
getUint32(byteOffset: number, littleEndian: boolean): number;
|
||||
|
||||
/**
|
||||
* Stores an Float32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Float64 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setInt8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Int16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Int32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint8 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
setUint8(byteOffset: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint16 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
|
||||
/**
|
||||
* Stores an Uint32 value at the specified byte offset from the start of the view.
|
||||
* @param byteOffset The place in the buffer at which the value should be set.
|
||||
* @param value The value to set.
|
||||
* @param littleEndian If false or undefined, a big-endian value should be written,
|
||||
* otherwise a little-endian value should be written.
|
||||
*/
|
||||
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
|
||||
}
|
||||
|
||||
interface DataViewConstructor {
|
||||
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
|
||||
}
|
||||
declare var DataView: DataViewConstructor;
|
||||
|
||||
/**
|
||||
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
|
||||
* number of bytes could not be allocated an exception is raised.
|
||||
@@ -2249,10 +2382,10 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedNumberFormatOptions;
|
||||
}
|
||||
var NumberFormat: {
|
||||
new (locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
new (locale?: string, options?: NumberFormatOptions): Collator;
|
||||
(locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
(locale?: string, options?: NumberFormatOptions): Collator;
|
||||
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
|
||||
}
|
||||
@@ -2294,10 +2427,10 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedDateTimeFormatOptions;
|
||||
}
|
||||
var DateTimeFormat: {
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
(locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
|
||||
}
|
||||
|
||||
+4894
-3057
File diff suppressed because it is too large
Load Diff
+6091
-3943
File diff suppressed because it is too large
Load Diff
Vendored
+329
-136
@@ -140,132 +140,155 @@ declare module "typescript" {
|
||||
DeclareKeyword = 115,
|
||||
GetKeyword = 116,
|
||||
ModuleKeyword = 117,
|
||||
RequireKeyword = 118,
|
||||
NumberKeyword = 119,
|
||||
SetKeyword = 120,
|
||||
StringKeyword = 121,
|
||||
SymbolKeyword = 122,
|
||||
TypeKeyword = 123,
|
||||
FromKeyword = 124,
|
||||
OfKeyword = 125,
|
||||
QualifiedName = 126,
|
||||
ComputedPropertyName = 127,
|
||||
TypeParameter = 128,
|
||||
Parameter = 129,
|
||||
Decorator = 130,
|
||||
PropertySignature = 131,
|
||||
PropertyDeclaration = 132,
|
||||
MethodSignature = 133,
|
||||
MethodDeclaration = 134,
|
||||
Constructor = 135,
|
||||
GetAccessor = 136,
|
||||
SetAccessor = 137,
|
||||
CallSignature = 138,
|
||||
ConstructSignature = 139,
|
||||
IndexSignature = 140,
|
||||
TypeReference = 141,
|
||||
FunctionType = 142,
|
||||
ConstructorType = 143,
|
||||
TypeQuery = 144,
|
||||
TypeLiteral = 145,
|
||||
ArrayType = 146,
|
||||
TupleType = 147,
|
||||
UnionType = 148,
|
||||
ParenthesizedType = 149,
|
||||
ObjectBindingPattern = 150,
|
||||
ArrayBindingPattern = 151,
|
||||
BindingElement = 152,
|
||||
ArrayLiteralExpression = 153,
|
||||
ObjectLiteralExpression = 154,
|
||||
PropertyAccessExpression = 155,
|
||||
ElementAccessExpression = 156,
|
||||
CallExpression = 157,
|
||||
NewExpression = 158,
|
||||
TaggedTemplateExpression = 159,
|
||||
TypeAssertionExpression = 160,
|
||||
ParenthesizedExpression = 161,
|
||||
FunctionExpression = 162,
|
||||
ArrowFunction = 163,
|
||||
DeleteExpression = 164,
|
||||
TypeOfExpression = 165,
|
||||
VoidExpression = 166,
|
||||
PrefixUnaryExpression = 167,
|
||||
PostfixUnaryExpression = 168,
|
||||
BinaryExpression = 169,
|
||||
ConditionalExpression = 170,
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
ClassExpression = 174,
|
||||
OmittedExpression = 175,
|
||||
TemplateSpan = 176,
|
||||
HeritageClauseElement = 177,
|
||||
SemicolonClassElement = 178,
|
||||
Block = 179,
|
||||
VariableStatement = 180,
|
||||
EmptyStatement = 181,
|
||||
ExpressionStatement = 182,
|
||||
IfStatement = 183,
|
||||
DoStatement = 184,
|
||||
WhileStatement = 185,
|
||||
ForStatement = 186,
|
||||
ForInStatement = 187,
|
||||
ForOfStatement = 188,
|
||||
ContinueStatement = 189,
|
||||
BreakStatement = 190,
|
||||
ReturnStatement = 191,
|
||||
WithStatement = 192,
|
||||
SwitchStatement = 193,
|
||||
LabeledStatement = 194,
|
||||
ThrowStatement = 195,
|
||||
TryStatement = 196,
|
||||
DebuggerStatement = 197,
|
||||
VariableDeclaration = 198,
|
||||
VariableDeclarationList = 199,
|
||||
FunctionDeclaration = 200,
|
||||
ClassDeclaration = 201,
|
||||
InterfaceDeclaration = 202,
|
||||
TypeAliasDeclaration = 203,
|
||||
EnumDeclaration = 204,
|
||||
ModuleDeclaration = 205,
|
||||
ModuleBlock = 206,
|
||||
CaseBlock = 207,
|
||||
ImportEqualsDeclaration = 208,
|
||||
ImportDeclaration = 209,
|
||||
ImportClause = 210,
|
||||
NamespaceImport = 211,
|
||||
NamedImports = 212,
|
||||
ImportSpecifier = 213,
|
||||
ExportAssignment = 214,
|
||||
ExportDeclaration = 215,
|
||||
NamedExports = 216,
|
||||
ExportSpecifier = 217,
|
||||
MissingDeclaration = 218,
|
||||
ExternalModuleReference = 219,
|
||||
CaseClause = 220,
|
||||
DefaultClause = 221,
|
||||
HeritageClause = 222,
|
||||
CatchClause = 223,
|
||||
PropertyAssignment = 224,
|
||||
ShorthandPropertyAssignment = 225,
|
||||
EnumMember = 226,
|
||||
SourceFile = 227,
|
||||
SyntaxList = 228,
|
||||
Count = 229,
|
||||
NamespaceKeyword = 118,
|
||||
RequireKeyword = 119,
|
||||
NumberKeyword = 120,
|
||||
SetKeyword = 121,
|
||||
StringKeyword = 122,
|
||||
SymbolKeyword = 123,
|
||||
TypeKeyword = 124,
|
||||
FromKeyword = 125,
|
||||
OfKeyword = 126,
|
||||
QualifiedName = 127,
|
||||
ComputedPropertyName = 128,
|
||||
TypeParameter = 129,
|
||||
Parameter = 130,
|
||||
Decorator = 131,
|
||||
PropertySignature = 132,
|
||||
PropertyDeclaration = 133,
|
||||
MethodSignature = 134,
|
||||
MethodDeclaration = 135,
|
||||
Constructor = 136,
|
||||
GetAccessor = 137,
|
||||
SetAccessor = 138,
|
||||
CallSignature = 139,
|
||||
ConstructSignature = 140,
|
||||
IndexSignature = 141,
|
||||
TypeReference = 142,
|
||||
FunctionType = 143,
|
||||
ConstructorType = 144,
|
||||
TypeQuery = 145,
|
||||
TypeLiteral = 146,
|
||||
ArrayType = 147,
|
||||
TupleType = 148,
|
||||
UnionType = 149,
|
||||
ParenthesizedType = 150,
|
||||
ObjectBindingPattern = 151,
|
||||
ArrayBindingPattern = 152,
|
||||
BindingElement = 153,
|
||||
ArrayLiteralExpression = 154,
|
||||
ObjectLiteralExpression = 155,
|
||||
PropertyAccessExpression = 156,
|
||||
ElementAccessExpression = 157,
|
||||
CallExpression = 158,
|
||||
NewExpression = 159,
|
||||
TaggedTemplateExpression = 160,
|
||||
TypeAssertionExpression = 161,
|
||||
ParenthesizedExpression = 162,
|
||||
FunctionExpression = 163,
|
||||
ArrowFunction = 164,
|
||||
DeleteExpression = 165,
|
||||
TypeOfExpression = 166,
|
||||
VoidExpression = 167,
|
||||
PrefixUnaryExpression = 168,
|
||||
PostfixUnaryExpression = 169,
|
||||
BinaryExpression = 170,
|
||||
ConditionalExpression = 171,
|
||||
TemplateExpression = 172,
|
||||
YieldExpression = 173,
|
||||
SpreadElementExpression = 174,
|
||||
ClassExpression = 175,
|
||||
OmittedExpression = 176,
|
||||
ExpressionWithTypeArguments = 177,
|
||||
TemplateSpan = 178,
|
||||
SemicolonClassElement = 179,
|
||||
Block = 180,
|
||||
VariableStatement = 181,
|
||||
EmptyStatement = 182,
|
||||
ExpressionStatement = 183,
|
||||
IfStatement = 184,
|
||||
DoStatement = 185,
|
||||
WhileStatement = 186,
|
||||
ForStatement = 187,
|
||||
ForInStatement = 188,
|
||||
ForOfStatement = 189,
|
||||
ContinueStatement = 190,
|
||||
BreakStatement = 191,
|
||||
ReturnStatement = 192,
|
||||
WithStatement = 193,
|
||||
SwitchStatement = 194,
|
||||
LabeledStatement = 195,
|
||||
ThrowStatement = 196,
|
||||
TryStatement = 197,
|
||||
DebuggerStatement = 198,
|
||||
VariableDeclaration = 199,
|
||||
VariableDeclarationList = 200,
|
||||
FunctionDeclaration = 201,
|
||||
ClassDeclaration = 202,
|
||||
InterfaceDeclaration = 203,
|
||||
TypeAliasDeclaration = 204,
|
||||
EnumDeclaration = 205,
|
||||
ModuleDeclaration = 206,
|
||||
ModuleBlock = 207,
|
||||
CaseBlock = 208,
|
||||
ImportEqualsDeclaration = 209,
|
||||
ImportDeclaration = 210,
|
||||
ImportClause = 211,
|
||||
NamespaceImport = 212,
|
||||
NamedImports = 213,
|
||||
ImportSpecifier = 214,
|
||||
ExportAssignment = 215,
|
||||
ExportDeclaration = 216,
|
||||
NamedExports = 217,
|
||||
ExportSpecifier = 218,
|
||||
MissingDeclaration = 219,
|
||||
ExternalModuleReference = 220,
|
||||
CaseClause = 221,
|
||||
DefaultClause = 222,
|
||||
HeritageClause = 223,
|
||||
CatchClause = 224,
|
||||
PropertyAssignment = 225,
|
||||
ShorthandPropertyAssignment = 226,
|
||||
EnumMember = 227,
|
||||
SourceFile = 228,
|
||||
JSDocTypeExpression = 229,
|
||||
JSDocAllType = 230,
|
||||
JSDocUnknownType = 231,
|
||||
JSDocArrayType = 232,
|
||||
JSDocUnionType = 233,
|
||||
JSDocTupleType = 234,
|
||||
JSDocNullableType = 235,
|
||||
JSDocNonNullableType = 236,
|
||||
JSDocRecordType = 237,
|
||||
JSDocRecordMember = 238,
|
||||
JSDocTypeReference = 239,
|
||||
JSDocOptionalType = 240,
|
||||
JSDocFunctionType = 241,
|
||||
JSDocVariadicType = 242,
|
||||
JSDocConstructorType = 243,
|
||||
JSDocThisType = 244,
|
||||
JSDocComment = 245,
|
||||
JSDocTag = 246,
|
||||
JSDocParameterTag = 247,
|
||||
JSDocReturnTag = 248,
|
||||
JSDocTypeTag = 249,
|
||||
JSDocTemplateTag = 250,
|
||||
SyntaxList = 251,
|
||||
Count = 252,
|
||||
FirstAssignment = 53,
|
||||
LastAssignment = 64,
|
||||
FirstReservedWord = 66,
|
||||
LastReservedWord = 101,
|
||||
FirstKeyword = 66,
|
||||
LastKeyword = 125,
|
||||
LastKeyword = 126,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 141,
|
||||
LastTypeNode = 149,
|
||||
FirstTypeNode = 142,
|
||||
LastTypeNode = 150,
|
||||
FirstPunctuation = 14,
|
||||
LastPunctuation = 64,
|
||||
FirstToken = 0,
|
||||
LastToken = 125,
|
||||
LastToken = 126,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 6,
|
||||
FirstLiteralToken = 7,
|
||||
@@ -274,7 +297,7 @@ declare module "typescript" {
|
||||
LastTemplateToken = 13,
|
||||
FirstBinaryOperator = 24,
|
||||
LastBinaryOperator = 64,
|
||||
FirstNode = 126,
|
||||
FirstNode = 127,
|
||||
}
|
||||
const enum NodeFlags {
|
||||
Export = 1,
|
||||
@@ -290,7 +313,8 @@ declare module "typescript" {
|
||||
Let = 4096,
|
||||
Const = 8192,
|
||||
OctalLiteral = 16384,
|
||||
ExportContext = 32768,
|
||||
Namespace = 32768,
|
||||
ExportContext = 65536,
|
||||
Modifier = 499,
|
||||
AccessibilityModifier = 112,
|
||||
BlockScoped = 12288,
|
||||
@@ -493,7 +517,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface YieldExpression extends Expression {
|
||||
asteriskToken?: Node;
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
}
|
||||
interface BinaryExpression extends Expression {
|
||||
left: Expression;
|
||||
@@ -553,7 +577,7 @@ declare module "typescript" {
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
interface HeritageClauseElement extends TypeNode {
|
||||
interface ExpressionWithTypeArguments extends TypeNode {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
@@ -664,7 +688,7 @@ declare module "typescript" {
|
||||
interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
interface InterfaceDeclaration extends Declaration, ModuleElement {
|
||||
interface InterfaceDeclaration extends Declaration, Statement {
|
||||
name: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
@@ -672,9 +696,9 @@ declare module "typescript" {
|
||||
}
|
||||
interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
types?: NodeArray<ExpressionWithTypeArguments>;
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
interface TypeAliasDeclaration extends Declaration, Statement {
|
||||
name: Identifier;
|
||||
type: TypeNode;
|
||||
}
|
||||
@@ -682,7 +706,7 @@ declare module "typescript" {
|
||||
name: DeclarationName;
|
||||
initializer?: Expression;
|
||||
}
|
||||
interface EnumDeclaration extends Declaration, ModuleElement {
|
||||
interface EnumDeclaration extends Declaration, Statement {
|
||||
name: Identifier;
|
||||
members: NodeArray<EnumMember>;
|
||||
}
|
||||
@@ -737,6 +761,82 @@ declare module "typescript" {
|
||||
hasTrailingNewLine?: boolean;
|
||||
kind: SyntaxKind;
|
||||
}
|
||||
interface JSDocTypeExpression extends Node {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocType extends TypeNode {
|
||||
_jsDocTypeBrand: any;
|
||||
}
|
||||
interface JSDocAllType extends JSDocType {
|
||||
_JSDocAllTypeBrand: any;
|
||||
}
|
||||
interface JSDocUnknownType extends JSDocType {
|
||||
_JSDocUnknownTypeBrand: any;
|
||||
}
|
||||
interface JSDocArrayType extends JSDocType {
|
||||
elementType: JSDocType;
|
||||
}
|
||||
interface JSDocUnionType extends JSDocType {
|
||||
types: NodeArray<JSDocType>;
|
||||
}
|
||||
interface JSDocTupleType extends JSDocType {
|
||||
types: NodeArray<JSDocType>;
|
||||
}
|
||||
interface JSDocNonNullableType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocNullableType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocRecordType extends JSDocType, TypeLiteralNode {
|
||||
members: NodeArray<JSDocRecordMember>;
|
||||
}
|
||||
interface JSDocTypeReference extends JSDocType {
|
||||
name: EntityName;
|
||||
typeArguments: NodeArray<JSDocType>;
|
||||
}
|
||||
interface JSDocOptionalType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocFunctionType extends JSDocType, SignatureDeclaration {
|
||||
parameters: NodeArray<ParameterDeclaration>;
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocVariadicType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocConstructorType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocThisType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocRecordMember extends PropertyDeclaration {
|
||||
name: Identifier | LiteralExpression;
|
||||
type?: JSDocType;
|
||||
}
|
||||
interface JSDocComment extends Node {
|
||||
tags: NodeArray<JSDocTag>;
|
||||
}
|
||||
interface JSDocTag extends Node {
|
||||
atToken: Node;
|
||||
tagName: Identifier;
|
||||
}
|
||||
interface JSDocTemplateTag extends JSDocTag {
|
||||
typeParameters: NodeArray<TypeParameterDeclaration>;
|
||||
}
|
||||
interface JSDocReturnTag extends JSDocTag {
|
||||
typeExpression: JSDocTypeExpression;
|
||||
}
|
||||
interface JSDocTypeTag extends JSDocTag {
|
||||
typeExpression: JSDocTypeExpression;
|
||||
}
|
||||
interface JSDocParameterTag extends JSDocTag {
|
||||
preParameterName?: Identifier;
|
||||
typeExpression?: JSDocTypeExpression;
|
||||
postParameterName?: Identifier;
|
||||
isBracketed: boolean;
|
||||
}
|
||||
interface SourceFile extends Declaration {
|
||||
statements: NodeArray<ModuleElement>;
|
||||
endOfFileToken: Node;
|
||||
@@ -756,6 +856,9 @@ declare module "typescript" {
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
getCurrentDirectory(): string;
|
||||
}
|
||||
interface ParseConfigHost {
|
||||
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
|
||||
}
|
||||
interface WriteFileCallback {
|
||||
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
|
||||
}
|
||||
@@ -804,6 +907,7 @@ declare module "typescript" {
|
||||
sourceMapFile: string;
|
||||
sourceMapSourceRoot: string;
|
||||
sourceMapSources: string[];
|
||||
sourceMapSourcesContent?: string[];
|
||||
inputSourceFileNames: string[];
|
||||
sourceMapNames?: string[];
|
||||
sourceMapMappings: string;
|
||||
@@ -895,6 +999,7 @@ declare module "typescript" {
|
||||
UseOnlyExternalAliasing = 2,
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
None = 0,
|
||||
FunctionScopedVariable = 1,
|
||||
BlockScopedVariable = 2,
|
||||
Property = 4,
|
||||
@@ -953,10 +1058,8 @@ declare module "typescript" {
|
||||
AliasExcludes = 8388608,
|
||||
ModuleMember = 8914931,
|
||||
ExportHasLocal = 944,
|
||||
HasLocals = 255504,
|
||||
HasExports = 1952,
|
||||
HasMembers = 6240,
|
||||
IsContainer = 262128,
|
||||
PropertyOrAccessor = 98308,
|
||||
Export = 7340032,
|
||||
}
|
||||
@@ -964,9 +1067,9 @@ declare module "typescript" {
|
||||
flags: SymbolFlags;
|
||||
name: string;
|
||||
declarations?: Declaration[];
|
||||
valueDeclaration?: Declaration;
|
||||
members?: SymbolTable;
|
||||
exports?: SymbolTable;
|
||||
valueDeclaration?: Declaration;
|
||||
}
|
||||
interface SymbolTable {
|
||||
[index: string]: Symbol;
|
||||
@@ -988,8 +1091,9 @@ declare module "typescript" {
|
||||
Tuple = 8192,
|
||||
Union = 16384,
|
||||
Anonymous = 32768,
|
||||
ObjectLiteral = 131072,
|
||||
ESSymbol = 1048576,
|
||||
Instantiated = 65536,
|
||||
ObjectLiteral = 262144,
|
||||
ESSymbol = 2097152,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 48128,
|
||||
@@ -1005,6 +1109,8 @@ declare module "typescript" {
|
||||
}
|
||||
interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[];
|
||||
outerTypeParameters: TypeParameter[];
|
||||
localTypeParameters: TypeParameter[];
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
@@ -1082,11 +1188,15 @@ declare module "typescript" {
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
help?: boolean;
|
||||
inlineSourceMap?: boolean;
|
||||
inlineSources?: boolean;
|
||||
listFiles?: boolean;
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
module?: ModuleKind;
|
||||
newLine?: NewLineKind;
|
||||
noEmit?: boolean;
|
||||
noEmitHelpers?: boolean;
|
||||
noEmitOnError?: boolean;
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
@@ -1104,7 +1214,8 @@ declare module "typescript" {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
separateCompilation?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
@@ -1113,6 +1224,11 @@ declare module "typescript" {
|
||||
CommonJS = 1,
|
||||
AMD = 2,
|
||||
UMD = 3,
|
||||
System = 4,
|
||||
}
|
||||
const enum NewLineKind {
|
||||
CarriageReturnLineFeed = 0,
|
||||
LineFeed = 1,
|
||||
}
|
||||
interface LineAndCharacter {
|
||||
line: number;
|
||||
@@ -1166,7 +1282,7 @@ declare module "typescript" {
|
||||
createDirectory(path: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
readDirectory(path: string, extension?: string): string[];
|
||||
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
@@ -1176,6 +1292,32 @@ declare module "typescript" {
|
||||
var sys: System;
|
||||
}
|
||||
declare module "typescript" {
|
||||
interface ErrorCallback {
|
||||
(message: DiagnosticMessage, length: 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, start?: number, length?: number): void;
|
||||
setOnError(onError: ErrorCallback): void;
|
||||
setScriptTarget(scriptTarget: ScriptTarget): void;
|
||||
setTextPos(textPos: number): void;
|
||||
lookAhead<T>(callback: () => T): T;
|
||||
tryScan<T>(callback: () => T): T;
|
||||
}
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
@@ -1213,6 +1355,7 @@ declare module "typescript" {
|
||||
* Vn.
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
}
|
||||
declare module "typescript" {
|
||||
function getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
@@ -1226,7 +1369,7 @@ declare module "typescript" {
|
||||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
}
|
||||
@@ -1236,14 +1379,26 @@ declare module "typescript" {
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
function readConfigFile(fileName: string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
/**
|
||||
* Parse the text of the tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
* @param jsonText The text of the config file
|
||||
*/
|
||||
function parseConfigFileText(fileName: string, jsonText: string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
/**
|
||||
* Parse the contents of a config file (tsconfig.json).
|
||||
* @param json The contents of the config file to parse
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
|
||||
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the language service API */
|
||||
@@ -1324,6 +1479,7 @@ declare module "typescript" {
|
||||
interface LanguageServiceHost {
|
||||
getCompilationSettings(): CompilerOptions;
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
getScriptFileNames(): string[];
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot;
|
||||
@@ -1340,8 +1496,16 @@ declare module "typescript" {
|
||||
getSyntacticDiagnostics(fileName: string): Diagnostic[];
|
||||
getSemanticDiagnostics(fileName: string): Diagnostic[];
|
||||
getCompilerOptionsDiagnostics(): Diagnostic[];
|
||||
/**
|
||||
* @deprecated Use getEncodedSyntacticClassifications instead.
|
||||
*/
|
||||
getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
/**
|
||||
* @deprecated Use getEncodedSemanticClassifications instead.
|
||||
*/
|
||||
getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
|
||||
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
|
||||
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
|
||||
getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails;
|
||||
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
|
||||
@@ -1351,6 +1515,7 @@ declare module "typescript" {
|
||||
getRenameInfo(fileName: string, position: number): RenameInfo;
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
findReferences(fileName: string, position: number): ReferencedSymbol[];
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
|
||||
@@ -1370,6 +1535,10 @@ declare module "typescript" {
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
dispose(): void;
|
||||
}
|
||||
interface Classifications {
|
||||
spans: number[];
|
||||
endOfLineState: EndOfLineState;
|
||||
}
|
||||
interface ClassifiedSpan {
|
||||
textSpan: TextSpan;
|
||||
classificationType: string;
|
||||
@@ -1581,7 +1750,7 @@ declare module "typescript" {
|
||||
text: string;
|
||||
}
|
||||
const enum EndOfLineState {
|
||||
Start = 0,
|
||||
None = 0,
|
||||
InMultiLineCommentTrivia = 1,
|
||||
InSingleQuoteStringLiteral = 2,
|
||||
InDoubleQuoteStringLiteral = 3,
|
||||
@@ -1627,8 +1796,10 @@ declare module "typescript" {
|
||||
* classifications which may be incorrectly categorized will be given
|
||||
* back as Identifiers in order to allow the syntactic classifier to
|
||||
* subsume the classification.
|
||||
* @deprecated Use getLexicalClassifications instead.
|
||||
*/
|
||||
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
|
||||
getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
|
||||
}
|
||||
/**
|
||||
* The document registry represents a store of SourceFile objects that can be shared between
|
||||
@@ -1739,7 +1910,29 @@ declare module "typescript" {
|
||||
static interfaceName: string;
|
||||
static moduleName: string;
|
||||
static typeParameterName: string;
|
||||
static typeAlias: string;
|
||||
static typeAliasName: string;
|
||||
static parameterName: string;
|
||||
static docCommentTagName: string;
|
||||
}
|
||||
const enum ClassificationType {
|
||||
comment = 1,
|
||||
identifier = 2,
|
||||
keyword = 3,
|
||||
numericLiteral = 4,
|
||||
operator = 5,
|
||||
stringLiteral = 6,
|
||||
regularExpressionLiteral = 7,
|
||||
whiteSpace = 8,
|
||||
text = 9,
|
||||
punctuation = 10,
|
||||
className = 11,
|
||||
enumName = 12,
|
||||
interfaceName = 13,
|
||||
moduleName = 14,
|
||||
typeParameterName = 15,
|
||||
typeAliasName = 16,
|
||||
parameterName = 17,
|
||||
docCommentTagName = 18,
|
||||
}
|
||||
interface DisplayPartsSymbolWriter extends SymbolWriter {
|
||||
displayParts(): SymbolDisplayPart[];
|
||||
|
||||
+7225
-4474
File diff suppressed because it is too large
Load Diff
Vendored
+329
-136
@@ -140,132 +140,155 @@ declare module ts {
|
||||
DeclareKeyword = 115,
|
||||
GetKeyword = 116,
|
||||
ModuleKeyword = 117,
|
||||
RequireKeyword = 118,
|
||||
NumberKeyword = 119,
|
||||
SetKeyword = 120,
|
||||
StringKeyword = 121,
|
||||
SymbolKeyword = 122,
|
||||
TypeKeyword = 123,
|
||||
FromKeyword = 124,
|
||||
OfKeyword = 125,
|
||||
QualifiedName = 126,
|
||||
ComputedPropertyName = 127,
|
||||
TypeParameter = 128,
|
||||
Parameter = 129,
|
||||
Decorator = 130,
|
||||
PropertySignature = 131,
|
||||
PropertyDeclaration = 132,
|
||||
MethodSignature = 133,
|
||||
MethodDeclaration = 134,
|
||||
Constructor = 135,
|
||||
GetAccessor = 136,
|
||||
SetAccessor = 137,
|
||||
CallSignature = 138,
|
||||
ConstructSignature = 139,
|
||||
IndexSignature = 140,
|
||||
TypeReference = 141,
|
||||
FunctionType = 142,
|
||||
ConstructorType = 143,
|
||||
TypeQuery = 144,
|
||||
TypeLiteral = 145,
|
||||
ArrayType = 146,
|
||||
TupleType = 147,
|
||||
UnionType = 148,
|
||||
ParenthesizedType = 149,
|
||||
ObjectBindingPattern = 150,
|
||||
ArrayBindingPattern = 151,
|
||||
BindingElement = 152,
|
||||
ArrayLiteralExpression = 153,
|
||||
ObjectLiteralExpression = 154,
|
||||
PropertyAccessExpression = 155,
|
||||
ElementAccessExpression = 156,
|
||||
CallExpression = 157,
|
||||
NewExpression = 158,
|
||||
TaggedTemplateExpression = 159,
|
||||
TypeAssertionExpression = 160,
|
||||
ParenthesizedExpression = 161,
|
||||
FunctionExpression = 162,
|
||||
ArrowFunction = 163,
|
||||
DeleteExpression = 164,
|
||||
TypeOfExpression = 165,
|
||||
VoidExpression = 166,
|
||||
PrefixUnaryExpression = 167,
|
||||
PostfixUnaryExpression = 168,
|
||||
BinaryExpression = 169,
|
||||
ConditionalExpression = 170,
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
ClassExpression = 174,
|
||||
OmittedExpression = 175,
|
||||
TemplateSpan = 176,
|
||||
HeritageClauseElement = 177,
|
||||
SemicolonClassElement = 178,
|
||||
Block = 179,
|
||||
VariableStatement = 180,
|
||||
EmptyStatement = 181,
|
||||
ExpressionStatement = 182,
|
||||
IfStatement = 183,
|
||||
DoStatement = 184,
|
||||
WhileStatement = 185,
|
||||
ForStatement = 186,
|
||||
ForInStatement = 187,
|
||||
ForOfStatement = 188,
|
||||
ContinueStatement = 189,
|
||||
BreakStatement = 190,
|
||||
ReturnStatement = 191,
|
||||
WithStatement = 192,
|
||||
SwitchStatement = 193,
|
||||
LabeledStatement = 194,
|
||||
ThrowStatement = 195,
|
||||
TryStatement = 196,
|
||||
DebuggerStatement = 197,
|
||||
VariableDeclaration = 198,
|
||||
VariableDeclarationList = 199,
|
||||
FunctionDeclaration = 200,
|
||||
ClassDeclaration = 201,
|
||||
InterfaceDeclaration = 202,
|
||||
TypeAliasDeclaration = 203,
|
||||
EnumDeclaration = 204,
|
||||
ModuleDeclaration = 205,
|
||||
ModuleBlock = 206,
|
||||
CaseBlock = 207,
|
||||
ImportEqualsDeclaration = 208,
|
||||
ImportDeclaration = 209,
|
||||
ImportClause = 210,
|
||||
NamespaceImport = 211,
|
||||
NamedImports = 212,
|
||||
ImportSpecifier = 213,
|
||||
ExportAssignment = 214,
|
||||
ExportDeclaration = 215,
|
||||
NamedExports = 216,
|
||||
ExportSpecifier = 217,
|
||||
MissingDeclaration = 218,
|
||||
ExternalModuleReference = 219,
|
||||
CaseClause = 220,
|
||||
DefaultClause = 221,
|
||||
HeritageClause = 222,
|
||||
CatchClause = 223,
|
||||
PropertyAssignment = 224,
|
||||
ShorthandPropertyAssignment = 225,
|
||||
EnumMember = 226,
|
||||
SourceFile = 227,
|
||||
SyntaxList = 228,
|
||||
Count = 229,
|
||||
NamespaceKeyword = 118,
|
||||
RequireKeyword = 119,
|
||||
NumberKeyword = 120,
|
||||
SetKeyword = 121,
|
||||
StringKeyword = 122,
|
||||
SymbolKeyword = 123,
|
||||
TypeKeyword = 124,
|
||||
FromKeyword = 125,
|
||||
OfKeyword = 126,
|
||||
QualifiedName = 127,
|
||||
ComputedPropertyName = 128,
|
||||
TypeParameter = 129,
|
||||
Parameter = 130,
|
||||
Decorator = 131,
|
||||
PropertySignature = 132,
|
||||
PropertyDeclaration = 133,
|
||||
MethodSignature = 134,
|
||||
MethodDeclaration = 135,
|
||||
Constructor = 136,
|
||||
GetAccessor = 137,
|
||||
SetAccessor = 138,
|
||||
CallSignature = 139,
|
||||
ConstructSignature = 140,
|
||||
IndexSignature = 141,
|
||||
TypeReference = 142,
|
||||
FunctionType = 143,
|
||||
ConstructorType = 144,
|
||||
TypeQuery = 145,
|
||||
TypeLiteral = 146,
|
||||
ArrayType = 147,
|
||||
TupleType = 148,
|
||||
UnionType = 149,
|
||||
ParenthesizedType = 150,
|
||||
ObjectBindingPattern = 151,
|
||||
ArrayBindingPattern = 152,
|
||||
BindingElement = 153,
|
||||
ArrayLiteralExpression = 154,
|
||||
ObjectLiteralExpression = 155,
|
||||
PropertyAccessExpression = 156,
|
||||
ElementAccessExpression = 157,
|
||||
CallExpression = 158,
|
||||
NewExpression = 159,
|
||||
TaggedTemplateExpression = 160,
|
||||
TypeAssertionExpression = 161,
|
||||
ParenthesizedExpression = 162,
|
||||
FunctionExpression = 163,
|
||||
ArrowFunction = 164,
|
||||
DeleteExpression = 165,
|
||||
TypeOfExpression = 166,
|
||||
VoidExpression = 167,
|
||||
PrefixUnaryExpression = 168,
|
||||
PostfixUnaryExpression = 169,
|
||||
BinaryExpression = 170,
|
||||
ConditionalExpression = 171,
|
||||
TemplateExpression = 172,
|
||||
YieldExpression = 173,
|
||||
SpreadElementExpression = 174,
|
||||
ClassExpression = 175,
|
||||
OmittedExpression = 176,
|
||||
ExpressionWithTypeArguments = 177,
|
||||
TemplateSpan = 178,
|
||||
SemicolonClassElement = 179,
|
||||
Block = 180,
|
||||
VariableStatement = 181,
|
||||
EmptyStatement = 182,
|
||||
ExpressionStatement = 183,
|
||||
IfStatement = 184,
|
||||
DoStatement = 185,
|
||||
WhileStatement = 186,
|
||||
ForStatement = 187,
|
||||
ForInStatement = 188,
|
||||
ForOfStatement = 189,
|
||||
ContinueStatement = 190,
|
||||
BreakStatement = 191,
|
||||
ReturnStatement = 192,
|
||||
WithStatement = 193,
|
||||
SwitchStatement = 194,
|
||||
LabeledStatement = 195,
|
||||
ThrowStatement = 196,
|
||||
TryStatement = 197,
|
||||
DebuggerStatement = 198,
|
||||
VariableDeclaration = 199,
|
||||
VariableDeclarationList = 200,
|
||||
FunctionDeclaration = 201,
|
||||
ClassDeclaration = 202,
|
||||
InterfaceDeclaration = 203,
|
||||
TypeAliasDeclaration = 204,
|
||||
EnumDeclaration = 205,
|
||||
ModuleDeclaration = 206,
|
||||
ModuleBlock = 207,
|
||||
CaseBlock = 208,
|
||||
ImportEqualsDeclaration = 209,
|
||||
ImportDeclaration = 210,
|
||||
ImportClause = 211,
|
||||
NamespaceImport = 212,
|
||||
NamedImports = 213,
|
||||
ImportSpecifier = 214,
|
||||
ExportAssignment = 215,
|
||||
ExportDeclaration = 216,
|
||||
NamedExports = 217,
|
||||
ExportSpecifier = 218,
|
||||
MissingDeclaration = 219,
|
||||
ExternalModuleReference = 220,
|
||||
CaseClause = 221,
|
||||
DefaultClause = 222,
|
||||
HeritageClause = 223,
|
||||
CatchClause = 224,
|
||||
PropertyAssignment = 225,
|
||||
ShorthandPropertyAssignment = 226,
|
||||
EnumMember = 227,
|
||||
SourceFile = 228,
|
||||
JSDocTypeExpression = 229,
|
||||
JSDocAllType = 230,
|
||||
JSDocUnknownType = 231,
|
||||
JSDocArrayType = 232,
|
||||
JSDocUnionType = 233,
|
||||
JSDocTupleType = 234,
|
||||
JSDocNullableType = 235,
|
||||
JSDocNonNullableType = 236,
|
||||
JSDocRecordType = 237,
|
||||
JSDocRecordMember = 238,
|
||||
JSDocTypeReference = 239,
|
||||
JSDocOptionalType = 240,
|
||||
JSDocFunctionType = 241,
|
||||
JSDocVariadicType = 242,
|
||||
JSDocConstructorType = 243,
|
||||
JSDocThisType = 244,
|
||||
JSDocComment = 245,
|
||||
JSDocTag = 246,
|
||||
JSDocParameterTag = 247,
|
||||
JSDocReturnTag = 248,
|
||||
JSDocTypeTag = 249,
|
||||
JSDocTemplateTag = 250,
|
||||
SyntaxList = 251,
|
||||
Count = 252,
|
||||
FirstAssignment = 53,
|
||||
LastAssignment = 64,
|
||||
FirstReservedWord = 66,
|
||||
LastReservedWord = 101,
|
||||
FirstKeyword = 66,
|
||||
LastKeyword = 125,
|
||||
LastKeyword = 126,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 141,
|
||||
LastTypeNode = 149,
|
||||
FirstTypeNode = 142,
|
||||
LastTypeNode = 150,
|
||||
FirstPunctuation = 14,
|
||||
LastPunctuation = 64,
|
||||
FirstToken = 0,
|
||||
LastToken = 125,
|
||||
LastToken = 126,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 6,
|
||||
FirstLiteralToken = 7,
|
||||
@@ -274,7 +297,7 @@ declare module ts {
|
||||
LastTemplateToken = 13,
|
||||
FirstBinaryOperator = 24,
|
||||
LastBinaryOperator = 64,
|
||||
FirstNode = 126,
|
||||
FirstNode = 127,
|
||||
}
|
||||
const enum NodeFlags {
|
||||
Export = 1,
|
||||
@@ -290,7 +313,8 @@ declare module ts {
|
||||
Let = 4096,
|
||||
Const = 8192,
|
||||
OctalLiteral = 16384,
|
||||
ExportContext = 32768,
|
||||
Namespace = 32768,
|
||||
ExportContext = 65536,
|
||||
Modifier = 499,
|
||||
AccessibilityModifier = 112,
|
||||
BlockScoped = 12288,
|
||||
@@ -493,7 +517,7 @@ declare module ts {
|
||||
}
|
||||
interface YieldExpression extends Expression {
|
||||
asteriskToken?: Node;
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
}
|
||||
interface BinaryExpression extends Expression {
|
||||
left: Expression;
|
||||
@@ -553,7 +577,7 @@ declare module ts {
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
interface HeritageClauseElement extends TypeNode {
|
||||
interface ExpressionWithTypeArguments extends TypeNode {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
@@ -664,7 +688,7 @@ declare module ts {
|
||||
interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
interface InterfaceDeclaration extends Declaration, ModuleElement {
|
||||
interface InterfaceDeclaration extends Declaration, Statement {
|
||||
name: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
@@ -672,9 +696,9 @@ declare module ts {
|
||||
}
|
||||
interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
types?: NodeArray<ExpressionWithTypeArguments>;
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
interface TypeAliasDeclaration extends Declaration, Statement {
|
||||
name: Identifier;
|
||||
type: TypeNode;
|
||||
}
|
||||
@@ -682,7 +706,7 @@ declare module ts {
|
||||
name: DeclarationName;
|
||||
initializer?: Expression;
|
||||
}
|
||||
interface EnumDeclaration extends Declaration, ModuleElement {
|
||||
interface EnumDeclaration extends Declaration, Statement {
|
||||
name: Identifier;
|
||||
members: NodeArray<EnumMember>;
|
||||
}
|
||||
@@ -737,6 +761,82 @@ declare module ts {
|
||||
hasTrailingNewLine?: boolean;
|
||||
kind: SyntaxKind;
|
||||
}
|
||||
interface JSDocTypeExpression extends Node {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocType extends TypeNode {
|
||||
_jsDocTypeBrand: any;
|
||||
}
|
||||
interface JSDocAllType extends JSDocType {
|
||||
_JSDocAllTypeBrand: any;
|
||||
}
|
||||
interface JSDocUnknownType extends JSDocType {
|
||||
_JSDocUnknownTypeBrand: any;
|
||||
}
|
||||
interface JSDocArrayType extends JSDocType {
|
||||
elementType: JSDocType;
|
||||
}
|
||||
interface JSDocUnionType extends JSDocType {
|
||||
types: NodeArray<JSDocType>;
|
||||
}
|
||||
interface JSDocTupleType extends JSDocType {
|
||||
types: NodeArray<JSDocType>;
|
||||
}
|
||||
interface JSDocNonNullableType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocNullableType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocRecordType extends JSDocType, TypeLiteralNode {
|
||||
members: NodeArray<JSDocRecordMember>;
|
||||
}
|
||||
interface JSDocTypeReference extends JSDocType {
|
||||
name: EntityName;
|
||||
typeArguments: NodeArray<JSDocType>;
|
||||
}
|
||||
interface JSDocOptionalType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocFunctionType extends JSDocType, SignatureDeclaration {
|
||||
parameters: NodeArray<ParameterDeclaration>;
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocVariadicType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocConstructorType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocThisType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
interface JSDocRecordMember extends PropertyDeclaration {
|
||||
name: Identifier | LiteralExpression;
|
||||
type?: JSDocType;
|
||||
}
|
||||
interface JSDocComment extends Node {
|
||||
tags: NodeArray<JSDocTag>;
|
||||
}
|
||||
interface JSDocTag extends Node {
|
||||
atToken: Node;
|
||||
tagName: Identifier;
|
||||
}
|
||||
interface JSDocTemplateTag extends JSDocTag {
|
||||
typeParameters: NodeArray<TypeParameterDeclaration>;
|
||||
}
|
||||
interface JSDocReturnTag extends JSDocTag {
|
||||
typeExpression: JSDocTypeExpression;
|
||||
}
|
||||
interface JSDocTypeTag extends JSDocTag {
|
||||
typeExpression: JSDocTypeExpression;
|
||||
}
|
||||
interface JSDocParameterTag extends JSDocTag {
|
||||
preParameterName?: Identifier;
|
||||
typeExpression?: JSDocTypeExpression;
|
||||
postParameterName?: Identifier;
|
||||
isBracketed: boolean;
|
||||
}
|
||||
interface SourceFile extends Declaration {
|
||||
statements: NodeArray<ModuleElement>;
|
||||
endOfFileToken: Node;
|
||||
@@ -756,6 +856,9 @@ declare module ts {
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
getCurrentDirectory(): string;
|
||||
}
|
||||
interface ParseConfigHost {
|
||||
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
|
||||
}
|
||||
interface WriteFileCallback {
|
||||
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
|
||||
}
|
||||
@@ -804,6 +907,7 @@ declare module ts {
|
||||
sourceMapFile: string;
|
||||
sourceMapSourceRoot: string;
|
||||
sourceMapSources: string[];
|
||||
sourceMapSourcesContent?: string[];
|
||||
inputSourceFileNames: string[];
|
||||
sourceMapNames?: string[];
|
||||
sourceMapMappings: string;
|
||||
@@ -895,6 +999,7 @@ declare module ts {
|
||||
UseOnlyExternalAliasing = 2,
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
None = 0,
|
||||
FunctionScopedVariable = 1,
|
||||
BlockScopedVariable = 2,
|
||||
Property = 4,
|
||||
@@ -953,10 +1058,8 @@ declare module ts {
|
||||
AliasExcludes = 8388608,
|
||||
ModuleMember = 8914931,
|
||||
ExportHasLocal = 944,
|
||||
HasLocals = 255504,
|
||||
HasExports = 1952,
|
||||
HasMembers = 6240,
|
||||
IsContainer = 262128,
|
||||
PropertyOrAccessor = 98308,
|
||||
Export = 7340032,
|
||||
}
|
||||
@@ -964,9 +1067,9 @@ declare module ts {
|
||||
flags: SymbolFlags;
|
||||
name: string;
|
||||
declarations?: Declaration[];
|
||||
valueDeclaration?: Declaration;
|
||||
members?: SymbolTable;
|
||||
exports?: SymbolTable;
|
||||
valueDeclaration?: Declaration;
|
||||
}
|
||||
interface SymbolTable {
|
||||
[index: string]: Symbol;
|
||||
@@ -988,8 +1091,9 @@ declare module ts {
|
||||
Tuple = 8192,
|
||||
Union = 16384,
|
||||
Anonymous = 32768,
|
||||
ObjectLiteral = 131072,
|
||||
ESSymbol = 1048576,
|
||||
Instantiated = 65536,
|
||||
ObjectLiteral = 262144,
|
||||
ESSymbol = 2097152,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 48128,
|
||||
@@ -1005,6 +1109,8 @@ declare module ts {
|
||||
}
|
||||
interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[];
|
||||
outerTypeParameters: TypeParameter[];
|
||||
localTypeParameters: TypeParameter[];
|
||||
}
|
||||
interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
baseTypes: ObjectType[];
|
||||
@@ -1082,11 +1188,15 @@ declare module ts {
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
help?: boolean;
|
||||
inlineSourceMap?: boolean;
|
||||
inlineSources?: boolean;
|
||||
listFiles?: boolean;
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
module?: ModuleKind;
|
||||
newLine?: NewLineKind;
|
||||
noEmit?: boolean;
|
||||
noEmitHelpers?: boolean;
|
||||
noEmitOnError?: boolean;
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
@@ -1104,7 +1214,8 @@ declare module ts {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
separateCompilation?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
@@ -1113,6 +1224,11 @@ declare module ts {
|
||||
CommonJS = 1,
|
||||
AMD = 2,
|
||||
UMD = 3,
|
||||
System = 4,
|
||||
}
|
||||
const enum NewLineKind {
|
||||
CarriageReturnLineFeed = 0,
|
||||
LineFeed = 1,
|
||||
}
|
||||
interface LineAndCharacter {
|
||||
line: number;
|
||||
@@ -1166,7 +1282,7 @@ declare module ts {
|
||||
createDirectory(path: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
readDirectory(path: string, extension?: string): string[];
|
||||
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
@@ -1176,6 +1292,32 @@ declare module ts {
|
||||
var sys: System;
|
||||
}
|
||||
declare module ts {
|
||||
interface ErrorCallback {
|
||||
(message: DiagnosticMessage, length: 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, start?: number, length?: number): void;
|
||||
setOnError(onError: ErrorCallback): void;
|
||||
setScriptTarget(scriptTarget: ScriptTarget): void;
|
||||
setTextPos(textPos: number): void;
|
||||
lookAhead<T>(callback: () => T): T;
|
||||
tryScan<T>(callback: () => T): T;
|
||||
}
|
||||
function tokenToString(t: SyntaxKind): string;
|
||||
function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number;
|
||||
function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter;
|
||||
@@ -1213,6 +1355,7 @@ declare module ts {
|
||||
* Vn.
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
}
|
||||
declare module ts {
|
||||
function getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
@@ -1226,7 +1369,7 @@ declare module ts {
|
||||
const version: string;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
}
|
||||
@@ -1236,14 +1379,26 @@ declare module ts {
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
function readConfigFile(fileName: string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
/**
|
||||
* Parse the text of the tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
* @param jsonText The text of the config file
|
||||
*/
|
||||
function parseConfigFileText(fileName: string, jsonText: string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
/**
|
||||
* Parse the contents of a config file (tsconfig.json).
|
||||
* @param json The contents of the config file to parse
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
|
||||
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
|
||||
}
|
||||
declare module ts {
|
||||
/** The version of the language service API */
|
||||
@@ -1324,6 +1479,7 @@ declare module ts {
|
||||
interface LanguageServiceHost {
|
||||
getCompilationSettings(): CompilerOptions;
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
getScriptFileNames(): string[];
|
||||
getScriptVersion(fileName: string): string;
|
||||
getScriptSnapshot(fileName: string): IScriptSnapshot;
|
||||
@@ -1340,8 +1496,16 @@ declare module ts {
|
||||
getSyntacticDiagnostics(fileName: string): Diagnostic[];
|
||||
getSemanticDiagnostics(fileName: string): Diagnostic[];
|
||||
getCompilerOptionsDiagnostics(): Diagnostic[];
|
||||
/**
|
||||
* @deprecated Use getEncodedSyntacticClassifications instead.
|
||||
*/
|
||||
getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
/**
|
||||
* @deprecated Use getEncodedSemanticClassifications instead.
|
||||
*/
|
||||
getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
|
||||
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
|
||||
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
|
||||
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
|
||||
getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails;
|
||||
getQuickInfoAtPosition(fileName: string, position: number): QuickInfo;
|
||||
@@ -1351,6 +1515,7 @@ declare module ts {
|
||||
getRenameInfo(fileName: string, position: number): RenameInfo;
|
||||
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[];
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
findReferences(fileName: string, position: number): ReferencedSymbol[];
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): DocumentHighlights[];
|
||||
@@ -1370,6 +1535,10 @@ declare module ts {
|
||||
getSourceFile(fileName: string): SourceFile;
|
||||
dispose(): void;
|
||||
}
|
||||
interface Classifications {
|
||||
spans: number[];
|
||||
endOfLineState: EndOfLineState;
|
||||
}
|
||||
interface ClassifiedSpan {
|
||||
textSpan: TextSpan;
|
||||
classificationType: string;
|
||||
@@ -1581,7 +1750,7 @@ declare module ts {
|
||||
text: string;
|
||||
}
|
||||
const enum EndOfLineState {
|
||||
Start = 0,
|
||||
None = 0,
|
||||
InMultiLineCommentTrivia = 1,
|
||||
InSingleQuoteStringLiteral = 2,
|
||||
InDoubleQuoteStringLiteral = 3,
|
||||
@@ -1627,8 +1796,10 @@ declare module ts {
|
||||
* classifications which may be incorrectly categorized will be given
|
||||
* back as Identifiers in order to allow the syntactic classifier to
|
||||
* subsume the classification.
|
||||
* @deprecated Use getLexicalClassifications instead.
|
||||
*/
|
||||
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
|
||||
getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
|
||||
}
|
||||
/**
|
||||
* The document registry represents a store of SourceFile objects that can be shared between
|
||||
@@ -1739,7 +1910,29 @@ declare module ts {
|
||||
static interfaceName: string;
|
||||
static moduleName: string;
|
||||
static typeParameterName: string;
|
||||
static typeAlias: string;
|
||||
static typeAliasName: string;
|
||||
static parameterName: string;
|
||||
static docCommentTagName: string;
|
||||
}
|
||||
const enum ClassificationType {
|
||||
comment = 1,
|
||||
identifier = 2,
|
||||
keyword = 3,
|
||||
numericLiteral = 4,
|
||||
operator = 5,
|
||||
stringLiteral = 6,
|
||||
regularExpressionLiteral = 7,
|
||||
whiteSpace = 8,
|
||||
text = 9,
|
||||
punctuation = 10,
|
||||
className = 11,
|
||||
enumName = 12,
|
||||
interfaceName = 13,
|
||||
moduleName = 14,
|
||||
typeParameterName = 15,
|
||||
typeAliasName = 16,
|
||||
parameterName = 17,
|
||||
docCommentTagName = 18,
|
||||
}
|
||||
interface DisplayPartsSymbolWriter extends SymbolWriter {
|
||||
displayParts(): SymbolDisplayPart[];
|
||||
|
||||
+7225
-4474
File diff suppressed because it is too large
Load Diff
+2
-7
@@ -2,13 +2,8 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.5.0",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "Apache License 2.0",
|
||||
"url": "https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt"
|
||||
}
|
||||
],
|
||||
"version": "1.5.3",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
|
||||
+398
-244
@@ -52,13 +52,38 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function bindSourceFile(file: SourceFile): void {
|
||||
const enum ContainerFlags {
|
||||
// The current node is not a container, and no container manipulation should happen before
|
||||
// recursing into it.
|
||||
None = 0,
|
||||
|
||||
// The current node is a container. It should be set as the current container (and block-
|
||||
// container) before recursing into it. The current node does not have locals. Examples:
|
||||
//
|
||||
// Classes, ObjectLiterals, TypeLiterals, Interfaces...
|
||||
IsContainer = 1 << 0,
|
||||
|
||||
// The current node is a block-scoped-container. It should be set as the current block-
|
||||
// container before recursing into it. Examples:
|
||||
//
|
||||
// Blocks (when not parented by functions), Catch clauses, For/For-in/For-of statements...
|
||||
IsBlockScopedContainer = 1 << 1,
|
||||
|
||||
HasLocals = 1 << 2,
|
||||
|
||||
// If the current node is a container that also container that also contains locals. Examples:
|
||||
//
|
||||
// Functions, Methods, Modules, Source-files.
|
||||
IsContainerWithLocals = IsContainer | HasLocals
|
||||
}
|
||||
|
||||
export function bindSourceFile(file: SourceFile) {
|
||||
let start = new Date().getTime();
|
||||
bindSourceFileWorker(file);
|
||||
bindTime += new Date().getTime() - start;
|
||||
}
|
||||
|
||||
function bindSourceFileWorker(file: SourceFile): void {
|
||||
function bindSourceFileWorker(file: SourceFile) {
|
||||
let parent: Node;
|
||||
let container: Node;
|
||||
let blockScopeContainer: Node;
|
||||
@@ -67,33 +92,38 @@ module ts {
|
||||
let Symbol = objectAllocator.getSymbolConstructor();
|
||||
|
||||
if (!file.locals) {
|
||||
file.locals = {};
|
||||
container = file;
|
||||
setBlockScopeContainer(file, /*cleanLocals*/ false);
|
||||
bind(file);
|
||||
file.symbolCount = symbolCount;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
function createSymbol(flags: SymbolFlags, name: string): Symbol {
|
||||
symbolCount++;
|
||||
return new Symbol(flags, name);
|
||||
}
|
||||
|
||||
function setBlockScopeContainer(node: Node, cleanLocals: boolean) {
|
||||
blockScopeContainer = node;
|
||||
if (cleanLocals) {
|
||||
blockScopeContainer.locals = undefined;
|
||||
}
|
||||
}
|
||||
function addDeclarationToSymbol(symbol: Symbol, node: Declaration, symbolFlags: SymbolFlags) {
|
||||
symbol.flags |= symbolFlags;
|
||||
|
||||
function addDeclarationToSymbol(symbol: Symbol, node: Declaration, symbolKind: SymbolFlags) {
|
||||
symbol.flags |= symbolKind;
|
||||
if (!symbol.declarations) symbol.declarations = [];
|
||||
symbol.declarations.push(node);
|
||||
if (symbolKind & SymbolFlags.HasExports && !symbol.exports) symbol.exports = {};
|
||||
if (symbolKind & SymbolFlags.HasMembers && !symbol.members) symbol.members = {};
|
||||
node.symbol = symbol;
|
||||
if (symbolKind & SymbolFlags.Value && !symbol.valueDeclaration) symbol.valueDeclaration = node;
|
||||
|
||||
if (!symbol.declarations) {
|
||||
symbol.declarations = [];
|
||||
}
|
||||
symbol.declarations.push(node);
|
||||
|
||||
if (symbolFlags & SymbolFlags.HasExports && !symbol.exports) {
|
||||
symbol.exports = {};
|
||||
}
|
||||
|
||||
if (symbolFlags & SymbolFlags.HasMembers && !symbol.members) {
|
||||
symbol.members = {};
|
||||
}
|
||||
|
||||
if (symbolFlags & SymbolFlags.Value && !symbol.valueDeclaration) {
|
||||
symbol.valueDeclaration = node;
|
||||
}
|
||||
}
|
||||
|
||||
// Should not be called on a declaration with a computed property name,
|
||||
@@ -111,12 +141,12 @@ module ts {
|
||||
return (<Identifier | LiteralExpression>node.name).text;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.Constructor:
|
||||
return "__constructor";
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.CallSignature:
|
||||
return "__call";
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
return "__new";
|
||||
case SyntaxKind.IndexSignature:
|
||||
@@ -135,7 +165,7 @@ module ts {
|
||||
return node.name ? declarationNameToString(node.name) : getDeclarationName(node);
|
||||
}
|
||||
|
||||
function declareSymbol(symbols: SymbolTable, parent: Symbol, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags): Symbol {
|
||||
function declareSymbol(symbolTable: SymbolTable, parent: Symbol, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags): Symbol {
|
||||
Debug.assert(!hasDynamicName(node));
|
||||
|
||||
// The exported symbol for an export default function/class node is always named "default"
|
||||
@@ -143,7 +173,27 @@ module ts {
|
||||
|
||||
let symbol: Symbol;
|
||||
if (name !== undefined) {
|
||||
symbol = hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name));
|
||||
// Check and see if the symbol table already has a symbol with this name. If not,
|
||||
// create a new symbol with this name and add it to the table. Note that we don't
|
||||
// give the new symbol any flags *yet*. This ensures that it will not conflict
|
||||
// witht he 'excludes' flags we pass in.
|
||||
//
|
||||
// If we do get an existing symbol, see if it conflicts with the new symbol we're
|
||||
// creating. For example, a 'var' symbol and a 'class' symbol will conflict within
|
||||
// the same symbol table. If we have a conflict, report the issue on each
|
||||
// declaration we have for this symbol, and then create a new symbol for this
|
||||
// declaration.
|
||||
//
|
||||
// If we created a new symbol, either because we didn't have a symbol with this name
|
||||
// in the symbol table, or we conflicted with an existing symbol, then just add this
|
||||
// node as the sole declaration of the new symbol.
|
||||
//
|
||||
// Otherwise, we'll be merging into a compatible existing symbol (for example when
|
||||
// you have multiple 'vars' with the same name in the same container). In this case
|
||||
// just add this node into the declarations list of the symbol.
|
||||
symbol = hasProperty(symbolTable, name)
|
||||
? symbolTable[name]
|
||||
: (symbolTable[name] = createSymbol(SymbolFlags.None, name));
|
||||
if (symbol.flags & excludes) {
|
||||
if (node.name) {
|
||||
node.name.parent = node;
|
||||
@@ -152,51 +202,34 @@ module ts {
|
||||
// Report errors every position with duplicate declaration
|
||||
// Report errors on previous encountered declarations
|
||||
let message = symbol.flags & SymbolFlags.BlockScopedVariable
|
||||
? Diagnostics.Cannot_redeclare_block_scoped_variable_0
|
||||
? Diagnostics.Cannot_redeclare_block_scoped_variable_0
|
||||
: Diagnostics.Duplicate_identifier_0;
|
||||
|
||||
forEach(symbol.declarations, declaration => {
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration)));
|
||||
});
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(node.name || node, message, getDisplayName(node)));
|
||||
|
||||
symbol = createSymbol(0, name);
|
||||
symbol = createSymbol(SymbolFlags.None, name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
symbol = createSymbol(0, "__missing");
|
||||
symbol = createSymbol(SymbolFlags.None, "__missing");
|
||||
}
|
||||
|
||||
addDeclarationToSymbol(symbol, node, includes);
|
||||
symbol.parent = parent;
|
||||
|
||||
if ((node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression) && symbol.exports) {
|
||||
// TypeScript 1.0 spec (April 2014): 8.4
|
||||
// Every class automatically contains a static property member named 'prototype',
|
||||
// the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter.
|
||||
// It is an error to explicitly declare a static property member with the name 'prototype'.
|
||||
let prototypeSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Prototype, "prototype");
|
||||
if (hasProperty(symbol.exports, prototypeSymbol.name)) {
|
||||
if (node.name) {
|
||||
node.name.parent = node;
|
||||
}
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0],
|
||||
Diagnostics.Duplicate_identifier_0, prototypeSymbol.name));
|
||||
}
|
||||
symbol.exports[prototypeSymbol.name] = prototypeSymbol;
|
||||
prototypeSymbol.parent = symbol;
|
||||
}
|
||||
|
||||
return symbol;
|
||||
}
|
||||
|
||||
function declareModuleMember(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags) {
|
||||
function declareModuleMember(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags): Symbol {
|
||||
let hasExportModifier = getCombinedNodeFlags(node) & NodeFlags.Export;
|
||||
if (symbolKind & SymbolFlags.Alias) {
|
||||
if (symbolFlags & SymbolFlags.Alias) {
|
||||
if (node.kind === SyntaxKind.ExportSpecifier || (node.kind === SyntaxKind.ImportEqualsDeclaration && hasExportModifier)) {
|
||||
declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
|
||||
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
else {
|
||||
declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -212,70 +245,174 @@ module ts {
|
||||
// but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way
|
||||
// when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope.
|
||||
if (hasExportModifier || container.flags & NodeFlags.ExportContext) {
|
||||
let exportKind = (symbolKind & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) |
|
||||
(symbolKind & SymbolFlags.Type ? SymbolFlags.ExportType : 0) |
|
||||
(symbolKind & SymbolFlags.Namespace ? SymbolFlags.ExportNamespace : 0);
|
||||
let exportKind =
|
||||
(symbolFlags & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) |
|
||||
(symbolFlags & SymbolFlags.Type ? SymbolFlags.ExportType : 0) |
|
||||
(symbolFlags & SymbolFlags.Namespace ? SymbolFlags.ExportNamespace : 0);
|
||||
let local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes);
|
||||
local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
|
||||
local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
|
||||
node.localSymbol = local;
|
||||
return local;
|
||||
}
|
||||
else {
|
||||
declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// All container nodes are kept on a linked list in declaration order. This list is used by the getLocalNameOfContainer function
|
||||
// in the type checker to validate that the local name used for a container is unique.
|
||||
function bindChildren(node: Node, symbolKind: SymbolFlags, isBlockScopeContainer: boolean) {
|
||||
if (symbolKind & SymbolFlags.HasLocals) {
|
||||
node.locals = {};
|
||||
}
|
||||
|
||||
// All container nodes are kept on a linked list in declaration order. This list is used by
|
||||
// the getLocalNameOfContainer function in the type checker to validate that the local name
|
||||
// used for a container is unique.
|
||||
function bindChildren(node: Node) {
|
||||
// Before we recurse into a node's chilren, we first save the existing parent, container
|
||||
// and block-container. Then after we pop out of processing the children, we restore
|
||||
// these saved values.
|
||||
let saveParent = parent;
|
||||
let saveContainer = container;
|
||||
let savedBlockScopeContainer = blockScopeContainer;
|
||||
|
||||
// This node will now be set as the parent of all of its children as we recurse into them.
|
||||
parent = node;
|
||||
if (symbolKind & SymbolFlags.IsContainer) {
|
||||
container = node;
|
||||
|
||||
// Depending on what kind of node this is, we may have to adjust the current container
|
||||
// and block-container. If the current node is a container, then it is automatically
|
||||
// considered the current block-container as well. Also, for containers that we know
|
||||
// may contain locals, we proactively initialize the .locals field. We do this because
|
||||
// it's highly likely that the .locals will be needed to place some child in (for example,
|
||||
// a parameter, or variable declaration).
|
||||
//
|
||||
// However, we do not proactively create the .locals for block-containers because it's
|
||||
// totally normal and common for block-containers to never actually have a block-scoped
|
||||
// variable in them. We don't want to end up allocating an object for every 'block' we
|
||||
// run into when most of them won't be necessary.
|
||||
//
|
||||
// Finally, if this is a block-container, then we clear out any existing .locals object
|
||||
// it may contain within it. This happens in incremental scenarios. Because we can be
|
||||
// reusing a node from a previous compilation, that node may have had 'locals' created
|
||||
// for it. We must clear this so we don't accidently move any stale data forward from
|
||||
// a previous compilation.
|
||||
let containerFlags = getContainerFlags(node);
|
||||
if (containerFlags & ContainerFlags.IsContainer) {
|
||||
container = blockScopeContainer = node;
|
||||
|
||||
if (containerFlags & ContainerFlags.HasLocals) {
|
||||
container.locals = {};
|
||||
}
|
||||
|
||||
addToContainerChain(container);
|
||||
}
|
||||
|
||||
if (isBlockScopeContainer) {
|
||||
// in incremental scenarios we might reuse nodes that already have locals being allocated
|
||||
// during the bind step these locals should be dropped to prevent using stale data.
|
||||
// locals should always be dropped unless they were previously initialized by the binder
|
||||
// these cases are:
|
||||
// - node has locals (symbolKind & HasLocals) !== 0
|
||||
// - node is a source file
|
||||
setBlockScopeContainer(node, /*cleanLocals*/ (symbolKind & SymbolFlags.HasLocals) === 0 && node.kind !== SyntaxKind.SourceFile);
|
||||
else if (containerFlags & ContainerFlags.IsBlockScopedContainer) {
|
||||
blockScopeContainer = node;
|
||||
blockScopeContainer.locals = undefined;
|
||||
}
|
||||
|
||||
forEachChild(node, bind);
|
||||
|
||||
container = saveContainer;
|
||||
parent = saveParent;
|
||||
blockScopeContainer = savedBlockScopeContainer;
|
||||
}
|
||||
|
||||
function addToContainerChain(node: Node) {
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = node;
|
||||
function getContainerFlags(node: Node): ContainerFlags {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return ContainerFlags.IsContainer;
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.SourceFile:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
return ContainerFlags.IsContainerWithLocals;
|
||||
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.ForOfStatement:
|
||||
case SyntaxKind.CaseBlock:
|
||||
return ContainerFlags.IsBlockScopedContainer;
|
||||
|
||||
case SyntaxKind.Block:
|
||||
// do not treat blocks directly inside a function as a block-scoped-container.
|
||||
// Locals that reside in this block should go to the function locals. Othewise 'x'
|
||||
// would not appear to be a redeclaration of a block scoped local in the following
|
||||
// example:
|
||||
//
|
||||
// function foo() {
|
||||
// var x;
|
||||
// let x;
|
||||
// }
|
||||
//
|
||||
// If we placed 'var x' into the function locals and 'let x' into the locals of
|
||||
// the block, then there would be no collision.
|
||||
//
|
||||
// By not creating a new block-scoped-container here, we ensure that both 'var x'
|
||||
// and 'let x' go into the Function-container's locals, and we do get a collision
|
||||
// conflict.
|
||||
return isFunctionLike(node.parent) ? ContainerFlags.None : ContainerFlags.IsBlockScopedContainer;
|
||||
}
|
||||
|
||||
lastContainer = node;
|
||||
return ContainerFlags.None;
|
||||
}
|
||||
|
||||
function bindDeclaration(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags, isBlockScopeContainer: boolean) {
|
||||
function addToContainerChain(next: Node) {
|
||||
if (lastContainer) {
|
||||
lastContainer.nextContainer = next;
|
||||
}
|
||||
|
||||
lastContainer = next;
|
||||
}
|
||||
|
||||
function declareSymbolAndAddToSymbolTable(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags): void {
|
||||
// Just call this directly so that the return type of this function stays "void".
|
||||
declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
|
||||
function declareSymbolAndAddToSymbolTableWorker(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags): Symbol {
|
||||
switch (container.kind) {
|
||||
// Modules, source files, and classes need specialized handling for how their
|
||||
// members are declared (for example, a member of a class will go into a specific
|
||||
// symbol table depending on if it is static or not). We defer to specialized
|
||||
// handlers to take care of declaring these child members.
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
declareModuleMember(node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
return declareModuleMember(node, symbolFlags, symbolExcludes);
|
||||
|
||||
case SyntaxKind.SourceFile:
|
||||
if (isExternalModule(<SourceFile>container)) {
|
||||
declareModuleMember(node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
}
|
||||
return declareSourceFileMember(node, symbolFlags, symbolExcludes);
|
||||
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return declareClassMember(node, symbolFlags, symbolExcludes);
|
||||
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
|
||||
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
// Interface/Object-types always have their children added to the 'members' of
|
||||
// their container. They are only accessible through an instance of their
|
||||
// container, and are never in scope otherwise (even inside the body of the
|
||||
// object / type / interface declaring them). An exception is type parameters,
|
||||
// which are in scope without qualification (similar to 'locals').
|
||||
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
|
||||
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.CallSignature:
|
||||
@@ -289,29 +426,35 @@ module ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
// All the children of these container types are never visible through another
|
||||
// symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
|
||||
// they're only accessed 'lexically' (i.e. from code that exists underneath
|
||||
// their container in the tree. To accomplish this, we simply add their declared
|
||||
// symbol to the 'locals' of the container. These symbols can then be found as
|
||||
// the type checker walks up the containers, checking them for matching names.
|
||||
return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
bindChildren(node, symbolKind, isBlockScopeContainer);
|
||||
}
|
||||
|
||||
function declareClassMember(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) {
|
||||
return node.flags & NodeFlags.Static
|
||||
? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes)
|
||||
: declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
|
||||
function declareSourceFileMember(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) {
|
||||
return isExternalModule(file)
|
||||
? declareModuleMember(node, symbolFlags, symbolExcludes)
|
||||
: declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
|
||||
function isAmbientContext(node: Node): boolean {
|
||||
while (node) {
|
||||
if (node.flags & NodeFlags.Ambient) return true;
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return true;
|
||||
}
|
||||
|
||||
node = node.parent;
|
||||
}
|
||||
return false;
|
||||
@@ -343,15 +486,16 @@ module ts {
|
||||
function bindModuleDeclaration(node: ModuleDeclaration) {
|
||||
setExportContextFlag(node);
|
||||
if (node.name.kind === SyntaxKind.StringLiteral) {
|
||||
bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes, /*isBlockScopeContainer*/ true);
|
||||
declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
|
||||
}
|
||||
else {
|
||||
let state = getModuleInstanceState(node);
|
||||
if (state === ModuleInstanceState.NonInstantiated) {
|
||||
bindDeclaration(node, SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes, /*isBlockScopeContainer*/ true);
|
||||
declareSymbolAndAddToSymbolTable(node, SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes, /*isBlockScopeContainer*/ true);
|
||||
declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
|
||||
|
||||
let currentModuleIsConstEnumOnly = state === ModuleInstanceState.ConstEnumOnly;
|
||||
if (node.symbol.constEnumOnlyModule === undefined) {
|
||||
// non-merged case - use the current state
|
||||
@@ -372,35 +516,27 @@ module ts {
|
||||
// We do that by making an anonymous type literal symbol, and then setting the function
|
||||
// symbol as its sole member. To the rest of the system, this symbol will be indistinguishable
|
||||
// from an actual type literal symbol you would have gotten had you used the long form.
|
||||
|
||||
let symbol = createSymbol(SymbolFlags.Signature, getDeclarationName(node));
|
||||
addDeclarationToSymbol(symbol, node, SymbolFlags.Signature);
|
||||
bindChildren(node, SymbolFlags.Signature, /*isBlockScopeContainer:*/ false);
|
||||
|
||||
let typeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral, "__type");
|
||||
addDeclarationToSymbol(typeLiteralSymbol, node, SymbolFlags.TypeLiteral);
|
||||
typeLiteralSymbol.members = {};
|
||||
typeLiteralSymbol.members[node.kind === SyntaxKind.FunctionType ? "__call" : "__new"] = symbol
|
||||
typeLiteralSymbol.members = { [symbol.name]: symbol };
|
||||
}
|
||||
|
||||
function bindAnonymousDeclaration(node: Declaration, symbolKind: SymbolFlags, name: string, isBlockScopeContainer: boolean) {
|
||||
let symbol = createSymbol(symbolKind, name);
|
||||
addDeclarationToSymbol(symbol, node, symbolKind);
|
||||
bindChildren(node, symbolKind, isBlockScopeContainer);
|
||||
function bindAnonymousDeclaration(node: Declaration, symbolFlags: SymbolFlags, name: string) {
|
||||
let symbol = createSymbol(symbolFlags, name);
|
||||
addDeclarationToSymbol(symbol, node, symbolFlags);
|
||||
}
|
||||
|
||||
function bindCatchVariableDeclaration(node: CatchClause) {
|
||||
bindChildren(node, /*symbolKind:*/ 0, /*isBlockScopeContainer:*/ true);
|
||||
}
|
||||
|
||||
function bindBlockScopedDeclaration(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags) {
|
||||
function bindBlockScopedDeclaration(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) {
|
||||
switch (blockScopeContainer.kind) {
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
declareModuleMember(node, symbolKind, symbolExcludes);
|
||||
declareModuleMember(node, symbolFlags, symbolExcludes);
|
||||
break;
|
||||
case SyntaxKind.SourceFile:
|
||||
if (isExternalModule(<SourceFile>container)) {
|
||||
declareModuleMember(node, symbolKind, symbolExcludes);
|
||||
declareModuleMember(node, symbolFlags, symbolExcludes);
|
||||
break;
|
||||
}
|
||||
// fall through.
|
||||
@@ -409,9 +545,8 @@ module ts {
|
||||
blockScopeContainer.locals = {};
|
||||
addToContainerChain(blockScopeContainer);
|
||||
}
|
||||
declareSymbol(blockScopeContainer.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
bindChildren(node, symbolKind, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
|
||||
function bindBlockScopedVariableDeclaration(node: Declaration) {
|
||||
@@ -424,175 +559,197 @@ module ts {
|
||||
|
||||
function bind(node: Node) {
|
||||
node.parent = parent;
|
||||
|
||||
|
||||
// First we bind declaration nodes to a symbol if possible. We'll both create a symbol
|
||||
// and then potentially add the symbol to an appropriate symbol table. Possible
|
||||
// destination symbol tables are:
|
||||
//
|
||||
// 1) The 'exports' table of the current container's symbol.
|
||||
// 2) The 'members' table of the current container's symbol.
|
||||
// 3) The 'locals' table of the current container.
|
||||
//
|
||||
// However, not all symbols will end up in any of these tables. 'Anonymous' symbols
|
||||
// (like TypeLiterals for example) will not be put in any table.
|
||||
bindWorker(node);
|
||||
|
||||
// Then we recurse into the children of the node to bind them as well. For certain
|
||||
// symbols we do specialized work when we recurse. For example, we'll keep track of
|
||||
// the current 'container' node when it changes. This helps us know which symbol table
|
||||
// a local should go into for example.
|
||||
bindChildren(node);
|
||||
}
|
||||
|
||||
function bindWorker(node: Node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.TypeParameter:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes);
|
||||
case SyntaxKind.Parameter:
|
||||
bindParameter(<ParameterDeclaration>node);
|
||||
break;
|
||||
return bindParameter(<ParameterDeclaration>node);
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
if (isBindingPattern((<Declaration>node).name)) {
|
||||
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
else if (isBlockOrCatchScoped(<Declaration>node)) {
|
||||
bindBlockScopedVariableDeclaration(<Declaration>node);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.FunctionScopedVariable, SymbolFlags.FunctionScopedVariableExcludes, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
break;
|
||||
return bindVariableDeclarationOrBindingElement(<VariableDeclaration | BindingElement>node);
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Property | ((<PropertyDeclaration>node).questionToken ? SymbolFlags.Optional : 0), SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Property | ((<PropertyDeclaration>node).questionToken ? SymbolFlags.Optional : SymbolFlags.None), SymbolFlags.PropertyExcludes);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
||||
case SyntaxKind.EnumMember:
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes);
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Signature, 0, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Signature, SymbolFlags.None);
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
// If this is an ObjectLiteralExpression method, then it sits in the same space
|
||||
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
|
||||
// so that it will conflict with any other object literal members with the same
|
||||
// name.
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Method | ((<MethodDeclaration>node).questionToken ? SymbolFlags.Optional : 0),
|
||||
isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Method | ((<MethodDeclaration>node).questionToken ? SymbolFlags.Optional : SymbolFlags.None),
|
||||
isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes);
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Function, SymbolFlags.FunctionExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Function, SymbolFlags.FunctionExcludes);
|
||||
case SyntaxKind.Constructor:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Constructor, /*symbolExcludes:*/ 0, /*isBlockScopeContainer:*/ true);
|
||||
break;
|
||||
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Constructor, /*symbolExcludes:*/ SymbolFlags.None);
|
||||
case SyntaxKind.GetAccessor:
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.GetAccessor, SymbolFlags.GetAccessorExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.GetAccessor, SymbolFlags.GetAccessorExcludes);
|
||||
case SyntaxKind.SetAccessor:
|
||||
bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes);
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
bindFunctionOrConstructorType(<SignatureDeclaration>node);
|
||||
break;
|
||||
|
||||
return bindFunctionOrConstructorType(<SignatureDeclaration>node);
|
||||
case SyntaxKind.TypeLiteral:
|
||||
bindAnonymousDeclaration(<TypeLiteralNode>node, SymbolFlags.TypeLiteral, "__type", /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return bindAnonymousDeclaration(<TypeLiteralNode>node, SymbolFlags.TypeLiteral, "__type");
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
bindAnonymousDeclaration(<ObjectLiteralExpression>node, SymbolFlags.ObjectLiteral, "__object", /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return bindAnonymousDeclaration(<ObjectLiteralExpression>node, SymbolFlags.ObjectLiteral, "__object");
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, "__function", /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
return bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, "__function");
|
||||
case SyntaxKind.ClassExpression:
|
||||
bindAnonymousDeclaration(<ClassExpression>node, SymbolFlags.Class, "__class", /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.CatchClause:
|
||||
bindCatchVariableDeclaration(<CatchClause>node);
|
||||
break;
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.Class, SymbolFlags.ClassExcludes);
|
||||
break;
|
||||
return bindClassLikeDeclaration(<ClassLikeDeclaration>node);
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes);
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes);
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
if (isConst(node)) {
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.ConstEnum, SymbolFlags.ConstEnumExcludes, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.RegularEnum, SymbolFlags.RegularEnumExcludes, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
break;
|
||||
return bindEnumDeclaration(<EnumDeclaration>node);
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
bindModuleDeclaration(<ModuleDeclaration>node);
|
||||
break;
|
||||
return bindModuleDeclaration(<ModuleDeclaration>node);
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.NamespaceImport:
|
||||
case SyntaxKind.ImportSpecifier:
|
||||
case SyntaxKind.ExportSpecifier:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Alias, SymbolFlags.AliasExcludes, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Alias, SymbolFlags.AliasExcludes);
|
||||
case SyntaxKind.ImportClause:
|
||||
if ((<ImportClause>node).name) {
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Alias, SymbolFlags.AliasExcludes, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
else {
|
||||
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
break;
|
||||
return bindImportClause(<ImportClause>node);
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
if (!(<ExportDeclaration>node).exportClause) {
|
||||
// All export * declarations are collected in an __export symbol
|
||||
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.ExportStar, 0);
|
||||
}
|
||||
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return bindExportDeclaration(<ExportDeclaration>node);
|
||||
case SyntaxKind.ExportAssignment:
|
||||
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);
|
||||
}
|
||||
else {
|
||||
// An export default clause with an expression exports a value
|
||||
declareSymbol(container.symbol.exports, container.symbol, <Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
|
||||
}
|
||||
bindChildren(node, 0, /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
return bindExportAssignment(<ExportAssignment>node);
|
||||
case SyntaxKind.SourceFile:
|
||||
setExportContextFlag(<SourceFile>node);
|
||||
if (isExternalModule(<SourceFile>node)) {
|
||||
bindAnonymousDeclaration(<SourceFile>node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).fileName) + '"', /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.Block:
|
||||
// do not treat function block a block-scope container
|
||||
// all block-scope locals that reside in this block should go to the function locals.
|
||||
// Otherwise this won't be considered as redeclaration of a block scoped local:
|
||||
// function foo() {
|
||||
// let x;
|
||||
// let x;
|
||||
// }
|
||||
// 'let x' will be placed into the function locals and 'let x' - into the locals of the block
|
||||
bindChildren(node, 0, /*isBlockScopeContainer*/ !isFunctionLike(node.parent));
|
||||
break;
|
||||
case SyntaxKind.CatchClause:
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.ForOfStatement:
|
||||
case SyntaxKind.CaseBlock:
|
||||
bindChildren(node, 0, /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
default:
|
||||
let saveParent = parent;
|
||||
parent = node;
|
||||
forEachChild(node, bind);
|
||||
parent = saveParent;
|
||||
return bindSourceFileIfExternalModule();
|
||||
}
|
||||
}
|
||||
|
||||
function bindSourceFileIfExternalModule() {
|
||||
setExportContextFlag(file);
|
||||
if (isExternalModule(file)) {
|
||||
bindAnonymousDeclaration(file, SymbolFlags.ValueModule, '"' + removeFileExtension(file.fileName) + '"');
|
||||
}
|
||||
}
|
||||
|
||||
function bindExportAssignment(node: ExportAssignment) {
|
||||
if (node.expression.kind === SyntaxKind.Identifier) {
|
||||
// An export default clause with an identifier exports all meanings of that identifier
|
||||
declareSymbol(container.symbol.exports, container.symbol, node, SymbolFlags.Alias, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
|
||||
}
|
||||
else {
|
||||
// An export default clause with an expression exports a value
|
||||
declareSymbol(container.symbol.exports, container.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes | SymbolFlags.AliasExcludes);
|
||||
}
|
||||
}
|
||||
|
||||
function bindExportDeclaration(node: ExportDeclaration) {
|
||||
if (!node.exportClause) {
|
||||
// All export * declarations are collected in an __export symbol
|
||||
declareSymbol(container.symbol.exports, container.symbol, node, SymbolFlags.ExportStar, SymbolFlags.None);
|
||||
}
|
||||
}
|
||||
|
||||
function bindImportClause(node: ImportClause) {
|
||||
if (node.name) {
|
||||
declareSymbolAndAddToSymbolTable(node, SymbolFlags.Alias, SymbolFlags.AliasExcludes);
|
||||
}
|
||||
}
|
||||
|
||||
function bindClassLikeDeclaration(node: ClassLikeDeclaration) {
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
bindBlockScopedDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes);
|
||||
}
|
||||
else {
|
||||
bindAnonymousDeclaration(node, SymbolFlags.Class, "__class");
|
||||
}
|
||||
|
||||
let symbol = node.symbol;
|
||||
|
||||
// TypeScript 1.0 spec (April 2014): 8.4
|
||||
// Every class automatically contains a static property member named 'prototype', the
|
||||
// type of which is an instantiation of the class type with type Any supplied as a type
|
||||
// argument for each type parameter. It is an error to explicitly declare a static
|
||||
// property member with the name 'prototype'.
|
||||
//
|
||||
// Note: we check for this here because this class may be merging into a module. The
|
||||
// module might have an exported variable called 'prototype'. We can't allow that as
|
||||
// that would clash with the built-in 'prototype' for the class.
|
||||
let prototypeSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Prototype, "prototype");
|
||||
if (hasProperty(symbol.exports, prototypeSymbol.name)) {
|
||||
if (node.name) {
|
||||
node.name.parent = node;
|
||||
}
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0],
|
||||
Diagnostics.Duplicate_identifier_0, prototypeSymbol.name));
|
||||
}
|
||||
symbol.exports[prototypeSymbol.name] = prototypeSymbol;
|
||||
prototypeSymbol.parent = symbol;
|
||||
}
|
||||
|
||||
function bindEnumDeclaration(node: EnumDeclaration) {
|
||||
return isConst(node)
|
||||
? bindBlockScopedDeclaration(node, SymbolFlags.ConstEnum, SymbolFlags.ConstEnumExcludes)
|
||||
: bindBlockScopedDeclaration(node, SymbolFlags.RegularEnum, SymbolFlags.RegularEnumExcludes);
|
||||
}
|
||||
|
||||
function bindVariableDeclarationOrBindingElement(node: VariableDeclaration | BindingElement) {
|
||||
if (!isBindingPattern(node.name)) {
|
||||
if (isBlockOrCatchScoped(node)) {
|
||||
bindBlockScopedVariableDeclaration(node);
|
||||
}
|
||||
else if (isParameterDeclaration(node)) {
|
||||
// It is safe to walk up parent chain to find whether the node is a destructing parameter declaration
|
||||
// because its parent chain has already been set up, since parents are set before descending into children.
|
||||
//
|
||||
// If node is a binding element in parameter declaration, we need to use ParameterExcludes.
|
||||
// Using ParameterExcludes flag allows the compiler to report an error on duplicate identifiers in Parameter Declaration
|
||||
// For example:
|
||||
// function foo([a,a]) {} // Duplicate Identifier error
|
||||
// function bar(a,a) {} // Duplicate Identifier error, parameter declaration in this case is handled in bindParameter
|
||||
// // which correctly set excluded symbols
|
||||
declareSymbolAndAddToSymbolTable(node, SymbolFlags.FunctionScopedVariable, SymbolFlags.ParameterExcludes);
|
||||
}
|
||||
else {
|
||||
declareSymbolAndAddToSymbolTable(node, SymbolFlags.FunctionScopedVariable, SymbolFlags.FunctionScopedVariableExcludes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function bindParameter(node: ParameterDeclaration) {
|
||||
if (isBindingPattern(node.name)) {
|
||||
bindAnonymousDeclaration(node, SymbolFlags.FunctionScopedVariable, getDestructuringParameterName(node), /*isBlockScopeContainer*/ false);
|
||||
bindAnonymousDeclaration(node, SymbolFlags.FunctionScopedVariable, getDestructuringParameterName(node));
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, SymbolFlags.FunctionScopedVariable, SymbolFlags.ParameterExcludes, /*isBlockScopeContainer*/ false);
|
||||
declareSymbolAndAddToSymbolTable(node, SymbolFlags.FunctionScopedVariable, SymbolFlags.ParameterExcludes);
|
||||
}
|
||||
|
||||
// If this is a property-parameter, then also declare the property symbol into the
|
||||
@@ -606,13 +763,10 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function bindPropertyOrMethodOrAccessor(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags, isBlockScopeContainer: boolean) {
|
||||
if (hasDynamicName(node)) {
|
||||
bindAnonymousDeclaration(node, symbolKind, "__computed", isBlockScopeContainer);
|
||||
}
|
||||
else {
|
||||
bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer);
|
||||
}
|
||||
function bindPropertyOrMethodOrAccessor(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) {
|
||||
return hasDynamicName(node)
|
||||
? bindAnonymousDeclaration(node, symbolFlags, "__computed")
|
||||
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1330
-731
File diff suppressed because it is too large
Load Diff
@@ -66,15 +66,29 @@ module ts {
|
||||
paramType: Diagnostics.KIND,
|
||||
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd
|
||||
},
|
||||
{
|
||||
name: "newLine",
|
||||
type: {
|
||||
"crlf": NewLineKind.CarriageReturnLineFeed,
|
||||
"lf": NewLineKind.LineFeed
|
||||
},
|
||||
description: Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
|
||||
paramType: Diagnostics.NEWLINE,
|
||||
error: Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF
|
||||
},
|
||||
{
|
||||
name: "noEmit",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Do_not_emit_outputs,
|
||||
},
|
||||
{
|
||||
name: "noEmitHelpers",
|
||||
type: "boolean"
|
||||
},
|
||||
{
|
||||
name: "noEmitOnError",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported,
|
||||
description: Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
|
||||
},
|
||||
{
|
||||
name: "noImplicitAny",
|
||||
@@ -89,6 +103,10 @@ module ts {
|
||||
name: "noResolve",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "skipDefaultLibCheck",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "out",
|
||||
type: "string",
|
||||
@@ -128,7 +146,7 @@ module ts {
|
||||
paramType: Diagnostics.LOCATION,
|
||||
},
|
||||
{
|
||||
name: "separateCompilation",
|
||||
name: "isolatedModules",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
@@ -174,10 +192,16 @@ module ts {
|
||||
type: "boolean",
|
||||
description: Diagnostics.Watch_input_files,
|
||||
},
|
||||
{
|
||||
name: "experimentalDecorators",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Enables_experimental_support_for_ES7_decorators
|
||||
},
|
||||
{
|
||||
name: "emitDecoratorMetadata",
|
||||
type: "boolean",
|
||||
experimental: true
|
||||
experimental: true,
|
||||
description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
|
||||
}
|
||||
];
|
||||
|
||||
@@ -329,7 +353,7 @@ module ts {
|
||||
|
||||
return {
|
||||
options: getCompilerOptions(),
|
||||
fileNames: getFiles(),
|
||||
fileNames: getFileNames(),
|
||||
errors
|
||||
};
|
||||
|
||||
@@ -375,23 +399,24 @@ module ts {
|
||||
return options;
|
||||
}
|
||||
|
||||
function getFiles(): string[] {
|
||||
var files: string[] = [];
|
||||
function getFileNames(): string[] {
|
||||
var fileNames: string[] = [];
|
||||
if (hasProperty(json, "files")) {
|
||||
if (json["files"] instanceof Array) {
|
||||
var files = map(<string[]>json["files"], s => combinePaths(basePath, s));
|
||||
fileNames = map(<string[]>json["files"], s => combinePaths(basePath, s));
|
||||
}
|
||||
}
|
||||
else {
|
||||
var sysFiles = host.readDirectory(basePath, ".ts");
|
||||
var exclude = json["exclude"] instanceof Array ? map(<string[]>json["exclude"], normalizeSlashes) : undefined;
|
||||
var sysFiles = host.readDirectory(basePath, ".ts", exclude);
|
||||
for (var i = 0; i < sysFiles.length; i++) {
|
||||
var name = sysFiles[i];
|
||||
if (!fileExtensionIs(name, ".d.ts") || !contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) {
|
||||
files.push(name);
|
||||
fileNames.push(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return files;
|
||||
return fileNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+70
-9
@@ -15,6 +15,42 @@ module ts {
|
||||
True = -1
|
||||
}
|
||||
|
||||
export function createFileMap<T>(getCanonicalFileName: (fileName: string) => string): FileMap<T> {
|
||||
let files: Map<T> = {};
|
||||
return {
|
||||
get,
|
||||
set,
|
||||
contains,
|
||||
remove,
|
||||
forEachValue: forEachValueInMap
|
||||
}
|
||||
|
||||
function set(fileName: string, value: T) {
|
||||
files[normalizeKey(fileName)] = value;
|
||||
}
|
||||
|
||||
function get(fileName: string) {
|
||||
return files[normalizeKey(fileName)];
|
||||
}
|
||||
|
||||
function contains(fileName: string) {
|
||||
return hasProperty(files, normalizeKey(fileName));
|
||||
}
|
||||
|
||||
function remove (fileName: string) {
|
||||
let key = normalizeKey(fileName);
|
||||
delete files[key];
|
||||
}
|
||||
|
||||
function forEachValueInMap(f: (value: T) => void) {
|
||||
forEachValue(files, f);
|
||||
}
|
||||
|
||||
function normalizeKey(key: string) {
|
||||
return getCanonicalFileName(normalizeSlashes(key));
|
||||
}
|
||||
}
|
||||
|
||||
export const enum Comparison {
|
||||
LessThan = -1,
|
||||
EqualTo = 0,
|
||||
@@ -129,6 +165,16 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function rangeEquals<T>(array1: T[], array2: T[], pos: number, end: number) {
|
||||
while (pos < end) {
|
||||
if (array1[pos] !== array2[pos]) {
|
||||
return false;
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last element of an array if non-empty, undefined otherwise.
|
||||
*/
|
||||
@@ -312,8 +358,11 @@ module ts {
|
||||
|
||||
Debug.assert(start >= 0, "start must be non-negative, is " + start);
|
||||
Debug.assert(length >= 0, "length must be non-negative, is " + length);
|
||||
Debug.assert(start <= file.text.length, `start must be within the bounds of the file. ${ start } > ${ file.text.length }`);
|
||||
Debug.assert(end <= file.text.length, `end must be the bounds of the file. ${ end } > ${ file.text.length }`);
|
||||
|
||||
if (file) {
|
||||
Debug.assert(start <= file.text.length, `start must be within the bounds of the file. ${ start } > ${ file.text.length }`);
|
||||
Debug.assert(end <= file.text.length, `end must be the bounds of the file. ${ end } > ${ file.text.length }`);
|
||||
}
|
||||
|
||||
let text = getLocaleSpecificMessage(message.key);
|
||||
|
||||
@@ -459,8 +508,18 @@ module ts {
|
||||
if (path.charCodeAt(2) === CharacterCodes.slash) return 3;
|
||||
return 2;
|
||||
}
|
||||
// Per RFC 1738 'file' URI schema has the shape file://<host>/<path>
|
||||
// if <host> is omitted then it is assumed that host value is 'localhost',
|
||||
// however slash after the omitted <host> is not removed.
|
||||
// file:///folder1/file1 - this is a correct URI
|
||||
// file://folder2/file2 - this is an incorrect URI
|
||||
if (path.lastIndexOf("file:///", 0) === 0) {
|
||||
return "file:///".length;
|
||||
}
|
||||
let idx = path.indexOf('://');
|
||||
if (idx !== -1) return idx + 3
|
||||
if (idx !== -1) {
|
||||
return idx + "://".length;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -470,7 +529,7 @@ module ts {
|
||||
let normalized: string[] = [];
|
||||
for (let part of parts) {
|
||||
if (part !== ".") {
|
||||
if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") {
|
||||
if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") {
|
||||
normalized.pop();
|
||||
}
|
||||
else {
|
||||
@@ -586,7 +645,7 @@ module ts {
|
||||
export function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean) {
|
||||
let pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory);
|
||||
let directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory);
|
||||
if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") {
|
||||
if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") {
|
||||
// If the directory path given was of type test/cases/ then we really need components of directory to be only till its name
|
||||
// that is ["test", "cases", ""] needs to be actually ["test", "cases"]
|
||||
directoryComponents.length--;
|
||||
@@ -640,16 +699,18 @@ module ts {
|
||||
return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension;
|
||||
}
|
||||
|
||||
let supportedExtensions = [".d.ts", ".ts", ".js"];
|
||||
/**
|
||||
* List of supported extensions in order of file resolution precedence.
|
||||
*/
|
||||
export const supportedExtensions = [".ts", ".d.ts"];
|
||||
|
||||
const extensionsToRemove = [".d.ts", ".ts", ".js"];
|
||||
export function removeFileExtension(path: string): string {
|
||||
for (let ext of supportedExtensions) {
|
||||
|
||||
for (let ext of extensionsToRemove) {
|
||||
if (fileExtensionIs(path, ext)) {
|
||||
return path.substr(0, path.length - ext.length);
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ module ts {
|
||||
Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." },
|
||||
Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." },
|
||||
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." },
|
||||
yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." },
|
||||
A_yield_expression_is_only_allowed_in_a_generator_body: { code: 1163, category: DiagnosticCategory.Error, key: "A 'yield' expression is only allowed in a generator body." },
|
||||
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
|
||||
A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." },
|
||||
A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." },
|
||||
@@ -165,8 +165,8 @@ module ts {
|
||||
Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
|
||||
Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." },
|
||||
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
|
||||
Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--separateCompilation' flag is provided." },
|
||||
Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." },
|
||||
Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." },
|
||||
Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--isolatedModules' 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" },
|
||||
@@ -174,6 +174,18 @@ module ts {
|
||||
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." },
|
||||
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
|
||||
Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: DiagnosticCategory.Error, key: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." },
|
||||
Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 1220, category: DiagnosticCategory.Error, key: "Generators are only available when targeting ECMAScript 6 or higher." },
|
||||
Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: DiagnosticCategory.Error, key: "Generators are not allowed in an ambient context." },
|
||||
An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: DiagnosticCategory.Error, key: "An overload signature cannot be declared as a generator." },
|
||||
_0_tag_already_specified: { code: 1223, category: DiagnosticCategory.Error, key: "'{0}' tag already specified." },
|
||||
Signature_0_must_have_a_type_predicate: { code: 1224, category: DiagnosticCategory.Error, key: "Signature '{0}' must have a type predicate." },
|
||||
Cannot_find_parameter_0: { code: 1225, category: DiagnosticCategory.Error, key: "Cannot find parameter '{0}'." },
|
||||
Type_predicate_0_is_not_assignable_to_1: { code: 1226, category: DiagnosticCategory.Error, key: "Type predicate '{0}' is not assignable to '{1}'." },
|
||||
Parameter_0_is_not_in_the_same_position_as_parameter_1: { code: 1227, category: DiagnosticCategory.Error, key: "Parameter '{0}' is not in the same position as parameter '{1}'." },
|
||||
A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: { code: 1228, category: DiagnosticCategory.Error, key: "A type predicate is only allowed in return type position for functions and methods." },
|
||||
A_type_predicate_cannot_reference_a_rest_parameter: { code: 1229, category: DiagnosticCategory.Error, key: "A type predicate cannot reference a rest parameter." },
|
||||
A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: { code: 1230, category: DiagnosticCategory.Error, key: "A type predicate cannot reference element '{0}' in a binding pattern." },
|
||||
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." },
|
||||
@@ -334,7 +346,7 @@ module ts {
|
||||
The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to type 'symbol'." },
|
||||
Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: DiagnosticCategory.Error, key: "'Symbol' reference does not refer to the global Symbol constructor object." },
|
||||
A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: DiagnosticCategory.Error, key: "A computed property name of the form '{0}' must be of type 'symbol'." },
|
||||
Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." },
|
||||
Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { code: 2472, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher." },
|
||||
Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." },
|
||||
In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." },
|
||||
const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." },
|
||||
@@ -363,7 +375,11 @@ module ts {
|
||||
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." },
|
||||
Cannot_create_an_instance_of_the_abstract_class_0: { code: 2502, category: DiagnosticCategory.Error, key: "Cannot create an instance of the abstract class '{0}'" },
|
||||
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
|
||||
Cannot_find_namespace_0: { code: 2503, category: DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
|
||||
No_best_common_type_exists_among_yield_expressions: { code: 2504, category: DiagnosticCategory.Error, key: "No best common type exists among yield expressions." },
|
||||
A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: DiagnosticCategory.Error, key: "A generator cannot have a 'void' type annotation." },
|
||||
Cannot_create_an_instance_of_the_abstract_class_0: { code: 2506, category: DiagnosticCategory.Error, key: "Cannot create an instance of the abstract class '{0}'" },
|
||||
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}'." },
|
||||
@@ -443,16 +459,16 @@ module ts {
|
||||
Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." },
|
||||
Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." },
|
||||
Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." },
|
||||
Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." },
|
||||
Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
|
||||
Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." },
|
||||
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
|
||||
Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { code: 5043, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." },
|
||||
Option_declaration_cannot_be_specified_with_option_separateCompilation: { code: 5044, category: DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'separateCompilation'." },
|
||||
Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." },
|
||||
Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." },
|
||||
Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." },
|
||||
Option_sourceMap_cannot_be_specified_with_option_isolatedModules: { code: 5043, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'isolatedModules'." },
|
||||
Option_declaration_cannot_be_specified_with_option_isolatedModules: { code: 5044, category: DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'isolatedModules'." },
|
||||
Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'." },
|
||||
Option_out_cannot_be_specified_with_option_isolatedModules: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'isolatedModules'." },
|
||||
Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." },
|
||||
Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." },
|
||||
Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." },
|
||||
Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." },
|
||||
@@ -464,7 +480,7 @@ module ts {
|
||||
Watch_input_files: { code: 6005, category: DiagnosticCategory.Message, key: "Watch input files." },
|
||||
Redirect_output_structure_to_the_directory: { code: 6006, category: DiagnosticCategory.Message, key: "Redirect output structure to the directory." },
|
||||
Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: DiagnosticCategory.Message, key: "Do not erase const enum declarations in generated code." },
|
||||
Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: DiagnosticCategory.Message, key: "Do not emit outputs if any type checking errors were reported." },
|
||||
Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: DiagnosticCategory.Message, key: "Do not emit outputs if any errors were reported." },
|
||||
Do_not_emit_comments_to_output: { code: 6009, category: DiagnosticCategory.Message, key: "Do not emit comments to output." },
|
||||
Do_not_emit_outputs: { code: 6010, category: DiagnosticCategory.Message, key: "Do not emit outputs." },
|
||||
Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" },
|
||||
@@ -497,12 +513,18 @@ module ts {
|
||||
Corrupted_locale_file_0: { code: 6051, category: DiagnosticCategory.Error, key: "Corrupted locale file {0}." },
|
||||
Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: DiagnosticCategory.Message, key: "Raise error on expressions and declarations with an implied 'any' type." },
|
||||
File_0_not_found: { code: 6053, category: DiagnosticCategory.Error, key: "File '{0}' not found." },
|
||||
File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." },
|
||||
File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' has unsupported extension. The only supported extensions are {1}." },
|
||||
Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." },
|
||||
Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." },
|
||||
Preserve_new_lines_when_emitting_code: { code: 6057, category: DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
|
||||
Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." },
|
||||
File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." },
|
||||
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
|
||||
NEWLINE: { code: 6061, category: DiagnosticCategory.Message, key: "NEWLINE" },
|
||||
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
|
||||
Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." },
|
||||
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
|
||||
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
|
||||
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
|
||||
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
|
||||
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
|
||||
@@ -515,10 +537,10 @@ module ts {
|
||||
Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: DiagnosticCategory.Error, key: "Object literal's property '{0}' implicitly has an '{1}' type." },
|
||||
Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: DiagnosticCategory.Error, key: "Rest parameter '{0}' implicitly has an 'any[]' type." },
|
||||
Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: DiagnosticCategory.Error, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." },
|
||||
_0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." },
|
||||
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
|
||||
_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer." },
|
||||
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: DiagnosticCategory.Error, key: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." },
|
||||
You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." },
|
||||
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." },
|
||||
import_can_only_be_used_in_a_ts_file: { code: 8002, category: DiagnosticCategory.Error, key: "'import ... =' can only be used in a .ts file." },
|
||||
@@ -532,15 +554,11 @@ module ts {
|
||||
types_can_only_be_used_in_a_ts_file: { code: 8010, category: DiagnosticCategory.Error, key: "'types' can only be used in a .ts file." },
|
||||
type_arguments_can_only_be_used_in_a_ts_file: { code: 8011, category: DiagnosticCategory.Error, key: "'type arguments' can only be used in a .ts file." },
|
||||
parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: DiagnosticCategory.Error, key: "'parameter modifiers' can only be used in a .ts file." },
|
||||
can_only_be_used_in_a_ts_file: { code: 8013, category: DiagnosticCategory.Error, key: "'?' can only be used in a .ts file." },
|
||||
property_declarations_can_only_be_used_in_a_ts_file: { code: 8014, category: DiagnosticCategory.Error, key: "'property declarations' can only be used in a .ts file." },
|
||||
enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in a .ts file." },
|
||||
type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in a .ts file." },
|
||||
decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: DiagnosticCategory.Error, key: "'decorators' can only be used in a .ts file." },
|
||||
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
|
||||
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
|
||||
Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." },
|
||||
class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." },
|
||||
class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." },
|
||||
};
|
||||
}
|
||||
@@ -467,7 +467,7 @@
|
||||
"category": "Error",
|
||||
"code": 1162
|
||||
},
|
||||
"'yield' expression must be contained_within a generator declaration.": {
|
||||
"A 'yield' expression is only allowed in a generator body.": {
|
||||
"category": "Error",
|
||||
"code": 1163
|
||||
},
|
||||
@@ -647,11 +647,11 @@
|
||||
"category": "Error",
|
||||
"code": 1207
|
||||
},
|
||||
"Cannot compile namespaces when the '--separateCompilation' flag is provided.": {
|
||||
"Cannot compile namespaces when the '--isolatedModules' flag is provided.": {
|
||||
"category": "Error",
|
||||
"code": 1208
|
||||
},
|
||||
"Ambient const enums are not allowed when the '--separateCompilation' flag is provided.": {
|
||||
"Ambient const enums are not allowed when the '--isolatedModules' flag is provided.": {
|
||||
"category": "Error",
|
||||
"code": 1209
|
||||
},
|
||||
@@ -683,6 +683,55 @@
|
||||
"category": "Error",
|
||||
"code": 1218
|
||||
},
|
||||
"Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.": {
|
||||
"category": "Error",
|
||||
"code": 1219
|
||||
},
|
||||
"Generators are only available when targeting ECMAScript 6 or higher.": {
|
||||
"category": "Error",
|
||||
"code": 1220
|
||||
},
|
||||
"Generators are not allowed in an ambient context.": {
|
||||
"category": "Error",
|
||||
"code": 1221
|
||||
},
|
||||
"An overload signature cannot be declared as a generator.": {
|
||||
"category": "Error",
|
||||
"code": 1222
|
||||
},
|
||||
"'{0}' tag already specified.": {
|
||||
"category": "Error",
|
||||
"code": 1223
|
||||
},
|
||||
"Signature '{0}' must have a type predicate.": {
|
||||
"category": "Error",
|
||||
"code": 1224
|
||||
},
|
||||
"Cannot find parameter '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 1225
|
||||
},
|
||||
"Type predicate '{0}' is not assignable to '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 1226
|
||||
},
|
||||
"Parameter '{0}' is not in the same position as parameter '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 1227
|
||||
},
|
||||
"A type predicate is only allowed in return type position for functions and methods.": {
|
||||
"category": "Error",
|
||||
"code": 1228
|
||||
},
|
||||
"A type predicate cannot reference a rest parameter.": {
|
||||
"category": "Error",
|
||||
"code": 1229
|
||||
},
|
||||
"A type predicate cannot reference element '{0}' in a binding pattern.": {
|
||||
"category": "Error",
|
||||
"code": 1230
|
||||
},
|
||||
|
||||
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
@@ -1324,7 +1373,7 @@
|
||||
"category": "Error",
|
||||
"code": 2471
|
||||
},
|
||||
"Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.": {
|
||||
"Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher.": {
|
||||
"category": "Error",
|
||||
"code": 2472
|
||||
},
|
||||
@@ -1440,11 +1489,26 @@
|
||||
"category": "Error",
|
||||
"code": 2501
|
||||
},
|
||||
"Cannot create an instance of the abstract class '{0}'": {
|
||||
"'{0}' is referenced directly or indirectly in its own type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 2502
|
||||
},
|
||||
|
||||
"Cannot find namespace '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2503
|
||||
},
|
||||
"No best common type exists among yield expressions.": {
|
||||
"category": "Error",
|
||||
"code": 2504
|
||||
},
|
||||
"A generator cannot have a 'void' type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 2505
|
||||
},
|
||||
"Cannot create an instance of the abstract class '{0}'": {
|
||||
"category": "Error",
|
||||
"code": 2506
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
@@ -1761,11 +1825,11 @@
|
||||
"category": "Error",
|
||||
"code": 5033
|
||||
},
|
||||
"Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.": {
|
||||
"Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.": {
|
||||
"category": "Error",
|
||||
"code": 5038
|
||||
},
|
||||
"Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.": {
|
||||
"Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.": {
|
||||
"category": "Error",
|
||||
"code": 5039
|
||||
},
|
||||
@@ -1781,23 +1845,23 @@
|
||||
"category": "Error",
|
||||
"code": 5042
|
||||
},
|
||||
"Option 'sourceMap' cannot be specified with option 'separateCompilation'.": {
|
||||
"Option 'sourceMap' cannot be specified with option 'isolatedModules'.": {
|
||||
"category": "Error",
|
||||
"code": 5043
|
||||
},
|
||||
"Option 'declaration' cannot be specified with option 'separateCompilation'.": {
|
||||
"Option 'declaration' cannot be specified with option 'isolatedModules'.": {
|
||||
"category": "Error",
|
||||
"code": 5044
|
||||
},
|
||||
"Option 'noEmitOnError' cannot be specified with option 'separateCompilation'.": {
|
||||
"Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.": {
|
||||
"category": "Error",
|
||||
"code": 5045
|
||||
},
|
||||
"Option 'out' cannot be specified with option 'separateCompilation'.": {
|
||||
"Option 'out' cannot be specified with option 'isolatedModules'.": {
|
||||
"category": "Error",
|
||||
"code": 5046
|
||||
},
|
||||
"Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.": {
|
||||
"Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.": {
|
||||
"category": "Error",
|
||||
"code": 5047
|
||||
},
|
||||
@@ -1846,7 +1910,7 @@
|
||||
"category": "Message",
|
||||
"code": 6007
|
||||
},
|
||||
"Do not emit outputs if any type checking errors were reported.": {
|
||||
"Do not emit outputs if any errors were reported.": {
|
||||
"category": "Message",
|
||||
"code": 6008
|
||||
},
|
||||
@@ -1978,7 +2042,7 @@
|
||||
"category": "Error",
|
||||
"code": 6053
|
||||
},
|
||||
"File '{0}' must have extension '.ts' or '.d.ts'.": {
|
||||
"File '{0}' has unsupported extension. The only supported extensions are {1}.": {
|
||||
"category": "Error",
|
||||
"code": 6054
|
||||
},
|
||||
@@ -2002,7 +2066,30 @@
|
||||
"category": "Error",
|
||||
"code": 6059
|
||||
},
|
||||
|
||||
"Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).": {
|
||||
"category": "Message",
|
||||
"code": 6060
|
||||
},
|
||||
"NEWLINE": {
|
||||
"category": "Message",
|
||||
"code": 6061
|
||||
},
|
||||
"Argument for '--newLine' option must be 'CRLF' or 'LF'.": {
|
||||
"category": "Error",
|
||||
"code": 6062
|
||||
},
|
||||
"Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified.": {
|
||||
"category": "Error",
|
||||
"code": 6064
|
||||
},
|
||||
"Enables experimental support for ES7 decorators.": {
|
||||
"category": "Message",
|
||||
"code": 6065
|
||||
},
|
||||
"Enables experimental support for emitting type metadata for decorators.": {
|
||||
"category": "Message",
|
||||
"code": 6066
|
||||
},
|
||||
|
||||
"Variable '{0}' implicitly has an '{1}' type.": {
|
||||
"category": "Error",
|
||||
@@ -2052,11 +2139,7 @@
|
||||
"category": "Error",
|
||||
"code": 7020
|
||||
},
|
||||
"'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 7021
|
||||
},
|
||||
"'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer.": {
|
||||
"'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.": {
|
||||
"category": "Error",
|
||||
"code": 7022
|
||||
},
|
||||
@@ -2068,6 +2151,10 @@
|
||||
"category": "Error",
|
||||
"code": 7024
|
||||
},
|
||||
"Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type.": {
|
||||
"category": "Error",
|
||||
"code": 7025
|
||||
},
|
||||
"You cannot rename this element.": {
|
||||
"category": "Error",
|
||||
"code": 8000
|
||||
@@ -2120,10 +2207,6 @@
|
||||
"category": "Error",
|
||||
"code": 8012
|
||||
},
|
||||
"'?' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8013
|
||||
},
|
||||
"'property declarations' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8014
|
||||
@@ -2141,14 +2224,6 @@
|
||||
"code": 8017
|
||||
},
|
||||
|
||||
"'yield' expressions are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9000
|
||||
},
|
||||
"Generators are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9001
|
||||
},
|
||||
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
|
||||
"category": "Error",
|
||||
"code": 9002
|
||||
@@ -2156,9 +2231,5 @@
|
||||
"'class' expressions are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9003
|
||||
},
|
||||
"'class' declarations are only supported directly inside a module or as a top level declaration.": {
|
||||
"category": "Error",
|
||||
"code": 9004
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+395
-308
File diff suppressed because it is too large
Load Diff
+1136
-358
File diff suppressed because it is too large
Load Diff
+64
-38
@@ -8,7 +8,7 @@ module ts {
|
||||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
export const version = "1.5.0";
|
||||
export const version = "1.5.3";
|
||||
|
||||
export function findConfigFile(searchPath: string): string {
|
||||
var fileName = "tsconfig.json";
|
||||
@@ -91,6 +91,8 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
const newLine = getNewLineCharacter(options);
|
||||
|
||||
return {
|
||||
getSourceFile,
|
||||
getDefaultLibFileName: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFileName(options)),
|
||||
@@ -98,7 +100,7 @@ module ts {
|
||||
getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()),
|
||||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
|
||||
getCanonicalFileName,
|
||||
getNewLine: () => sys.newLine
|
||||
getNewLine: () => newLine
|
||||
};
|
||||
}
|
||||
|
||||
@@ -141,9 +143,8 @@ module ts {
|
||||
export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program {
|
||||
let program: Program;
|
||||
let files: SourceFile[] = [];
|
||||
let filesByName: Map<SourceFile> = {};
|
||||
let diagnostics = createDiagnosticCollection();
|
||||
let seenNoDefaultLib = options.noLib;
|
||||
let skipDefaultLib = options.noLib;
|
||||
let commonSourceDirectory: string;
|
||||
let diagnosticsProducingTypeChecker: TypeChecker;
|
||||
let noDiagnosticsTypeChecker: TypeChecker;
|
||||
@@ -151,9 +152,11 @@ module ts {
|
||||
let start = new Date().getTime();
|
||||
|
||||
host = host || createCompilerHost(options);
|
||||
forEach(rootNames, name => processRootFile(name, false));
|
||||
if (!seenNoDefaultLib) {
|
||||
processRootFile(host.getDefaultLibFileName(options), true);
|
||||
let filesByName = createFileMap<SourceFile>(fileName => host.getCanonicalFileName(fileName));
|
||||
|
||||
forEach(rootNames, name => processRootFile(name, /*isDefaultLib:*/ false));
|
||||
if (!skipDefaultLib) {
|
||||
processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib:*/ true);
|
||||
}
|
||||
verifyCompilerOptions();
|
||||
|
||||
@@ -167,6 +170,7 @@ module ts {
|
||||
getGlobalDiagnostics,
|
||||
getSemanticDiagnostics,
|
||||
getDeclarationDiagnostics,
|
||||
getCompilerOptionsDiagnostics,
|
||||
getTypeChecker,
|
||||
getDiagnosticsProducingTypeChecker,
|
||||
getCommonSourceDirectory: () => commonSourceDirectory,
|
||||
@@ -211,7 +215,12 @@ module ts {
|
||||
// Create the emit resolver outside of the "emitTime" tracking code below. That way
|
||||
// any cost associated with it (like type checking) are appropriate associated with
|
||||
// the type-checking counter.
|
||||
let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile);
|
||||
//
|
||||
// If the -out option is specified, we should not pass the source file to getEmitResolver.
|
||||
// This is because in the -out scenario all files need to be emitted, and therefore all
|
||||
// files need to be type checked. And the way to specify that all files need to be type
|
||||
// checked is to not pass the file to getEmitResolver.
|
||||
let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile);
|
||||
|
||||
let start = new Date().getTime();
|
||||
|
||||
@@ -225,8 +234,7 @@ module ts {
|
||||
}
|
||||
|
||||
function getSourceFile(fileName: string) {
|
||||
fileName = host.getCanonicalFileName(fileName);
|
||||
return hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined;
|
||||
return filesByName.get(fileName);
|
||||
}
|
||||
|
||||
function getDiagnosticsHelper(sourceFile: SourceFile, getDiagnostics: (sourceFile: SourceFile) => Diagnostic[]): Diagnostic[] {
|
||||
@@ -278,6 +286,12 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getCompilerOptionsDiagnostics(): Diagnostic[] {
|
||||
let allDiagnostics: Diagnostic[] = [];
|
||||
addRange(allDiagnostics, diagnostics.getGlobalDiagnostics());
|
||||
return sortAndDeduplicateDiagnostics(allDiagnostics);
|
||||
}
|
||||
|
||||
function getGlobalDiagnostics(): Diagnostic[] {
|
||||
let typeChecker = getDiagnosticsProducingTypeChecker();
|
||||
|
||||
@@ -299,58 +313,65 @@ module ts {
|
||||
function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) {
|
||||
let start: number;
|
||||
let length: number;
|
||||
let extensions: string;
|
||||
let diagnosticArgument: string[];
|
||||
if (refEnd !== undefined && refPos !== undefined) {
|
||||
start = refPos;
|
||||
length = refEnd - refPos;
|
||||
}
|
||||
let diagnostic: DiagnosticMessage;
|
||||
if (hasExtension(fileName)) {
|
||||
if (!options.allowNonTsExtensions && !fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) {
|
||||
diagnostic = Diagnostics.File_0_must_have_extension_ts_or_d_ts;
|
||||
if (!options.allowNonTsExtensions && !forEach(supportedExtensions, extension => fileExtensionIs(host.getCanonicalFileName(fileName), extension))) {
|
||||
diagnostic = Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1;
|
||||
diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"];
|
||||
}
|
||||
else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) {
|
||||
diagnostic = Diagnostics.A_file_cannot_have_a_reference_to_itself;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
|
||||
diagnostic = Diagnostics.File_0_not_found;
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) {
|
||||
else if (!forEach(supportedExtensions, extension => findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd))) {
|
||||
diagnostic = Diagnostics.File_0_not_found;
|
||||
fileName += ".ts";
|
||||
diagnosticArgument = [fileName];
|
||||
}
|
||||
}
|
||||
|
||||
if (diagnostic) {
|
||||
if (refFile) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, fileName));
|
||||
diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, ...diagnosticArgument));
|
||||
}
|
||||
else {
|
||||
diagnostics.add(createCompilerDiagnostic(diagnostic, fileName));
|
||||
diagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get source file from normalized fileName
|
||||
function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refStart?: number, refLength?: number): SourceFile {
|
||||
let canonicalName = host.getCanonicalFileName(fileName);
|
||||
if (hasProperty(filesByName, canonicalName)) {
|
||||
let canonicalName = host.getCanonicalFileName(normalizeSlashes(fileName));
|
||||
if (filesByName.contains(canonicalName)) {
|
||||
// We've already looked for this file, use cached result
|
||||
return getSourceFileFromCache(fileName, canonicalName, /*useAbsolutePath*/ false);
|
||||
}
|
||||
else {
|
||||
let normalizedAbsolutePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory());
|
||||
let canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath);
|
||||
if (hasProperty(filesByName, canonicalAbsolutePath)) {
|
||||
if (filesByName.contains(canonicalAbsolutePath)) {
|
||||
return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true);
|
||||
}
|
||||
|
||||
// We haven't looked for this file, do so now and cache result
|
||||
let file = filesByName[canonicalName] = host.getSourceFile(fileName, options.target, hostErrorMessage => {
|
||||
let file = host.getSourceFile(fileName, options.target, hostErrorMessage => {
|
||||
if (refFile) {
|
||||
diagnostics.add(createFileDiagnostic(refFile, refStart, refLength,
|
||||
Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
@@ -359,11 +380,12 @@ module ts {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage));
|
||||
}
|
||||
});
|
||||
filesByName.set(canonicalName, file);
|
||||
if (file) {
|
||||
seenNoDefaultLib = seenNoDefaultLib || file.hasNoDefaultLib;
|
||||
skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib;
|
||||
|
||||
// Set the source file for normalized absolute path
|
||||
filesByName[canonicalAbsolutePath] = file;
|
||||
filesByName.set(canonicalAbsolutePath, file);
|
||||
|
||||
if (!options.noResolve) {
|
||||
let basePath = getDirectoryPath(fileName);
|
||||
@@ -371,6 +393,7 @@ module ts {
|
||||
processImportedModules(file, basePath);
|
||||
}
|
||||
if (isDefaultLib) {
|
||||
file.isDefaultLib = true;
|
||||
files.unshift(file);
|
||||
}
|
||||
else {
|
||||
@@ -382,7 +405,7 @@ module ts {
|
||||
}
|
||||
|
||||
function getSourceFileFromCache(fileName: string, canonicalName: string, useAbsolutePath: boolean): SourceFile {
|
||||
let file = filesByName[canonicalName];
|
||||
let file = filesByName.get(canonicalName);
|
||||
if (file && host.useCaseSensitiveFileNames()) {
|
||||
let sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName;
|
||||
if (canonicalName !== sourceFileName) {
|
||||
@@ -409,9 +432,10 @@ module ts {
|
||||
let moduleNameText = (<LiteralExpression>moduleNameExpr).text;
|
||||
if (moduleNameText) {
|
||||
let searchPath = basePath;
|
||||
let searchName: string;
|
||||
while (true) {
|
||||
let searchName = normalizePath(combinePaths(searchPath, moduleNameText));
|
||||
if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) {
|
||||
searchName = normalizePath(combinePaths(searchPath, moduleNameText));
|
||||
if (forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, moduleNameExpr))) {
|
||||
break;
|
||||
}
|
||||
let parentPath = getDirectoryPath(searchPath);
|
||||
@@ -440,10 +464,7 @@ module ts {
|
||||
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
|
||||
// only through top - level external module names. Relative external module names are not permitted.
|
||||
let searchName = normalizePath(combinePaths(basePath, moduleName));
|
||||
let tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral);
|
||||
if (!tsFile) {
|
||||
findModuleSourceFile(searchName + ".d.ts", nameLiteral);
|
||||
}
|
||||
forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, nameLiteral));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -516,21 +537,21 @@ module ts {
|
||||
}
|
||||
|
||||
function verifyCompilerOptions() {
|
||||
if (options.separateCompilation) {
|
||||
if (options.isolatedModules) {
|
||||
if (options.sourceMap) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_isolatedModules));
|
||||
}
|
||||
|
||||
if (options.declaration) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_declaration_cannot_be_specified_with_option_isolatedModules));
|
||||
}
|
||||
|
||||
if (options.noEmitOnError) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules));
|
||||
}
|
||||
|
||||
if (options.out) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_isolatedModules));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,10 +577,10 @@ module ts {
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
|
||||
if (options.mapRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -567,15 +588,15 @@ module ts {
|
||||
let languageVersion = options.target || ScriptTarget.ES3;
|
||||
|
||||
let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined);
|
||||
if (options.separateCompilation) {
|
||||
if (options.isolatedModules) {
|
||||
if (!options.module && languageVersion < ScriptTarget.ES6) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
}
|
||||
|
||||
let firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined);
|
||||
if (firstNonExternalModuleSourceFile) {
|
||||
let span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
|
||||
diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided));
|
||||
diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
|
||||
}
|
||||
}
|
||||
else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) {
|
||||
@@ -622,6 +643,11 @@ module ts {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.emitDecoratorMetadata &&
|
||||
!options.experimentalDecorators) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
-10
@@ -2,12 +2,10 @@
|
||||
/// <reference path="diagnosticInformationMap.generated.ts"/>
|
||||
|
||||
module ts {
|
||||
/* @internal */
|
||||
export interface ErrorCallback {
|
||||
(message: DiagnosticMessage, length: number): void;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export interface Scanner {
|
||||
getStartPos(): number;
|
||||
getToken(): SyntaxKind;
|
||||
@@ -75,6 +73,7 @@ module ts {
|
||||
"in": SyntaxKind.InKeyword,
|
||||
"instanceof": SyntaxKind.InstanceOfKeyword,
|
||||
"interface": SyntaxKind.InterfaceKeyword,
|
||||
"is": SyntaxKind.IsKeyword,
|
||||
"let": SyntaxKind.LetKeyword,
|
||||
"module": SyntaxKind.ModuleKeyword,
|
||||
"namespace": SyntaxKind.NamespaceKeyword,
|
||||
@@ -523,7 +522,7 @@ module ts {
|
||||
}
|
||||
collecting = true;
|
||||
if (result && result.length) {
|
||||
result[result.length - 1].hasTrailingNewLine = true;
|
||||
lastOrUndefined(result).hasTrailingNewLine = true;
|
||||
}
|
||||
continue;
|
||||
case CharacterCodes.tab:
|
||||
@@ -570,7 +569,7 @@ module ts {
|
||||
default:
|
||||
if (ch > CharacterCodes.maxAsciiCharacter && (isWhiteSpace(ch) || isLineBreak(ch))) {
|
||||
if (result && result.length && isLineBreak(ch)) {
|
||||
result[result.length - 1].hasTrailingNewLine = true;
|
||||
lastOrUndefined(result).hasTrailingNewLine = true;
|
||||
}
|
||||
pos++;
|
||||
continue;
|
||||
@@ -601,13 +600,26 @@ module ts {
|
||||
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion);
|
||||
}
|
||||
|
||||
// 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 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
|
||||
// Creates a scanner over a (possibly unspecified) range of a piece of text.
|
||||
export function createScanner(languageVersion: ScriptTarget,
|
||||
skipTrivia: boolean,
|
||||
text?: string,
|
||||
onError?: ErrorCallback,
|
||||
start?: number,
|
||||
length?: number): Scanner {
|
||||
// Current position (end position of text of current token)
|
||||
let pos: number;
|
||||
|
||||
// end of text
|
||||
let end: number;
|
||||
|
||||
// Start position of whitespace before current token
|
||||
let startPos: number;
|
||||
|
||||
// Start position of text of current token
|
||||
let tokenPos: number;
|
||||
|
||||
let token: SyntaxKind;
|
||||
let tokenValue: string;
|
||||
let precedingLineBreak: boolean;
|
||||
|
||||
+31
-15
@@ -15,7 +15,7 @@ module ts {
|
||||
createDirectory(path: string): void;
|
||||
getExecutingFilePath(): string;
|
||||
getCurrentDirectory(): string;
|
||||
readDirectory(path: string, extension?: string): string[];
|
||||
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
@@ -109,7 +109,11 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getNames(collection: any): string[] {
|
||||
function getCanonicalPath(path: string): string {
|
||||
return path.toLowerCase();
|
||||
}
|
||||
|
||||
function getNames(collection: any): string[]{
|
||||
var result: string[] = [];
|
||||
for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) {
|
||||
result.push(e.item().Name);
|
||||
@@ -117,21 +121,26 @@ module ts {
|
||||
return result.sort();
|
||||
}
|
||||
|
||||
function readDirectory(path: string, extension?: string): string[] {
|
||||
function readDirectory(path: string, extension?: string, exclude?: string[]): string[] {
|
||||
var result: string[] = [];
|
||||
exclude = map(exclude, s => getCanonicalPath(combinePaths(path, s)));
|
||||
visitDirectory(path);
|
||||
return result;
|
||||
function visitDirectory(path: string) {
|
||||
var folder = fso.GetFolder(path || ".");
|
||||
var files = getNames(folder.files);
|
||||
for (let name of files) {
|
||||
if (!extension || fileExtensionIs(name, extension)) {
|
||||
result.push(combinePaths(path, name));
|
||||
for (let current of files) {
|
||||
let name = combinePaths(path, current);
|
||||
if ((!extension || fileExtensionIs(name, extension)) && !contains(exclude, getCanonicalPath(name))) {
|
||||
result.push(name);
|
||||
}
|
||||
}
|
||||
var subfolders = getNames(folder.subfolders);
|
||||
for (let current of subfolders) {
|
||||
visitDirectory(combinePaths(path, current));
|
||||
let name = combinePaths(path, current);
|
||||
if (!contains(exclude, getCanonicalPath(name))) {
|
||||
visitDirectory(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,8 +231,13 @@ module ts {
|
||||
_fs.writeFileSync(fileName, data, "utf8");
|
||||
}
|
||||
|
||||
function readDirectory(path: string, extension?: string): string[] {
|
||||
function getCanonicalPath(path: string): string {
|
||||
return useCaseSensitiveFileNames ? path.toLowerCase() : path;
|
||||
}
|
||||
|
||||
function readDirectory(path: string, extension?: string, exclude?: string[]): string[] {
|
||||
var result: string[] = [];
|
||||
exclude = map(exclude, s => getCanonicalPath(combinePaths(path, s)));
|
||||
visitDirectory(path);
|
||||
return result;
|
||||
function visitDirectory(path: string) {
|
||||
@@ -231,14 +245,16 @@ module ts {
|
||||
var directories: string[] = [];
|
||||
for (let current of files) {
|
||||
var name = combinePaths(path, current);
|
||||
var stat = _fs.lstatSync(name);
|
||||
if (stat.isFile()) {
|
||||
if (!extension || fileExtensionIs(name, extension)) {
|
||||
result.push(name);
|
||||
if (!contains(exclude, getCanonicalPath(name))) {
|
||||
var stat = _fs.statSync(name);
|
||||
if (stat.isFile()) {
|
||||
if (!extension || fileExtensionIs(name, extension)) {
|
||||
result.push(name);
|
||||
}
|
||||
}
|
||||
else if (stat.isDirectory()) {
|
||||
directories.push(name);
|
||||
}
|
||||
}
|
||||
else if (stat.isDirectory()) {
|
||||
directories.push(name);
|
||||
}
|
||||
}
|
||||
for (let current of directories) {
|
||||
|
||||
+224
-40
@@ -3,6 +3,14 @@ module ts {
|
||||
[index: string]: T;
|
||||
}
|
||||
|
||||
export interface FileMap<T> {
|
||||
get(fileName: string): T;
|
||||
set(fileName: string, value: T): void;
|
||||
contains(fileName: string): boolean;
|
||||
remove(fileName: string): void;
|
||||
forEachValue(f: (v: T) => void): void;
|
||||
}
|
||||
|
||||
export interface TextRange {
|
||||
pos: number;
|
||||
end: number;
|
||||
@@ -138,6 +146,7 @@ module ts {
|
||||
ConstructorKeyword,
|
||||
DeclareKeyword,
|
||||
GetKeyword,
|
||||
IsKeyword,
|
||||
ModuleKeyword,
|
||||
NamespaceKeyword,
|
||||
RequireKeyword,
|
||||
@@ -170,6 +179,7 @@ module ts {
|
||||
ConstructSignature,
|
||||
IndexSignature,
|
||||
// Type
|
||||
TypePredicate,
|
||||
TypeReference,
|
||||
FunctionType,
|
||||
ConstructorType,
|
||||
@@ -271,6 +281,32 @@ module ts {
|
||||
// Top-level nodes
|
||||
SourceFile,
|
||||
|
||||
// JSDoc nodes.
|
||||
JSDocTypeExpression,
|
||||
// The * type.
|
||||
JSDocAllType,
|
||||
// The ? type.
|
||||
JSDocUnknownType,
|
||||
JSDocArrayType,
|
||||
JSDocUnionType,
|
||||
JSDocTupleType,
|
||||
JSDocNullableType,
|
||||
JSDocNonNullableType,
|
||||
JSDocRecordType,
|
||||
JSDocRecordMember,
|
||||
JSDocTypeReference,
|
||||
JSDocOptionalType,
|
||||
JSDocFunctionType,
|
||||
JSDocVariadicType,
|
||||
JSDocConstructorType,
|
||||
JSDocThisType,
|
||||
JSDocComment,
|
||||
JSDocTag,
|
||||
JSDocParameterTag,
|
||||
JSDocReturnTag,
|
||||
JSDocTypeTag,
|
||||
JSDocTemplateTag,
|
||||
|
||||
// Synthesized list
|
||||
SyntaxList,
|
||||
// Enum value count
|
||||
@@ -326,6 +362,8 @@ module ts {
|
||||
|
||||
/* @internal */
|
||||
export const enum ParserContextFlags {
|
||||
None = 0,
|
||||
|
||||
// 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.
|
||||
StrictMode = 1 << 0,
|
||||
@@ -347,6 +385,10 @@ module ts {
|
||||
// error.
|
||||
ThisNodeHasError = 1 << 5,
|
||||
|
||||
// This node was parsed in a JavaScript file and can be processed differently. For example
|
||||
// its type can be specified usign a JSDoc comment.
|
||||
JavaScriptFile = 1 << 6,
|
||||
|
||||
// Context flags set directly by the parser.
|
||||
ParserGeneratedFlags = StrictMode | DisallowIn | Yield | GeneratorParameter | Decorator | ThisNodeHasError,
|
||||
|
||||
@@ -354,10 +396,10 @@ module ts {
|
||||
|
||||
// Used during incremental parsing to determine if this node or any of its children had an
|
||||
// error. Computed only once and then cached.
|
||||
ThisNodeOrAnySubNodesHasError = 1 << 6,
|
||||
ThisNodeOrAnySubNodesHasError = 1 << 7,
|
||||
|
||||
// Used to know if we've computed data from children and cached it in this node.
|
||||
HasAggregatedChildData = 1 << 7
|
||||
HasAggregatedChildData = 1 << 8
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
@@ -373,14 +415,15 @@ module ts {
|
||||
// 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).
|
||||
/* @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)
|
||||
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 */ jsDocComment?: JSDocComment; // JSDoc for the node, if it has any. Only for .js files.
|
||||
/* @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 {
|
||||
@@ -575,6 +618,11 @@ module ts {
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
|
||||
export interface TypePredicateNode extends TypeNode {
|
||||
parameterName: Identifier;
|
||||
type: TypeNode;
|
||||
}
|
||||
|
||||
export interface TypeQueryNode extends TypeNode {
|
||||
exprName: EntityName;
|
||||
}
|
||||
@@ -662,7 +710,7 @@ module ts {
|
||||
|
||||
export interface YieldExpression extends Expression {
|
||||
asteriskToken?: Node;
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
}
|
||||
|
||||
export interface BinaryExpression extends Expression {
|
||||
@@ -886,7 +934,7 @@ module ts {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
|
||||
export interface InterfaceDeclaration extends Declaration, ModuleElement {
|
||||
export interface InterfaceDeclaration extends Declaration, Statement {
|
||||
name: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
@@ -898,8 +946,9 @@ module ts {
|
||||
types?: NodeArray<ExpressionWithTypeArguments>;
|
||||
}
|
||||
|
||||
export interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
export interface TypeAliasDeclaration extends Declaration, Statement {
|
||||
name: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
type: TypeNode;
|
||||
}
|
||||
|
||||
@@ -910,7 +959,7 @@ module ts {
|
||||
initializer?: Expression;
|
||||
}
|
||||
|
||||
export interface EnumDeclaration extends Declaration, ModuleElement {
|
||||
export interface EnumDeclaration extends Declaration, Statement {
|
||||
name: Identifier;
|
||||
members: NodeArray<EnumMember>;
|
||||
}
|
||||
@@ -994,6 +1043,106 @@ module ts {
|
||||
kind: SyntaxKind;
|
||||
}
|
||||
|
||||
// represents a top level: { type } expression in a JSDoc comment.
|
||||
export interface JSDocTypeExpression extends Node {
|
||||
type: JSDocType;
|
||||
}
|
||||
|
||||
export interface JSDocType extends TypeNode {
|
||||
_jsDocTypeBrand: any;
|
||||
}
|
||||
|
||||
export interface JSDocAllType extends JSDocType {
|
||||
_JSDocAllTypeBrand: any;
|
||||
}
|
||||
|
||||
export interface JSDocUnknownType extends JSDocType {
|
||||
_JSDocUnknownTypeBrand: any;
|
||||
}
|
||||
|
||||
export interface JSDocArrayType extends JSDocType {
|
||||
elementType: JSDocType;
|
||||
}
|
||||
|
||||
export interface JSDocUnionType extends JSDocType {
|
||||
types: NodeArray<JSDocType>;
|
||||
}
|
||||
|
||||
export interface JSDocTupleType extends JSDocType {
|
||||
types: NodeArray<JSDocType>;
|
||||
}
|
||||
|
||||
export interface JSDocNonNullableType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
|
||||
export interface JSDocNullableType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
|
||||
export interface JSDocRecordType extends JSDocType, TypeLiteralNode {
|
||||
members: NodeArray<JSDocRecordMember>;
|
||||
}
|
||||
|
||||
export interface JSDocTypeReference extends JSDocType {
|
||||
name: EntityName;
|
||||
typeArguments: NodeArray<JSDocType>
|
||||
}
|
||||
|
||||
export interface JSDocOptionalType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
|
||||
export interface JSDocFunctionType extends JSDocType, SignatureDeclaration {
|
||||
parameters: NodeArray<ParameterDeclaration>;
|
||||
type: JSDocType;
|
||||
}
|
||||
|
||||
export interface JSDocVariadicType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
|
||||
export interface JSDocConstructorType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
|
||||
export interface JSDocThisType extends JSDocType {
|
||||
type: JSDocType;
|
||||
}
|
||||
|
||||
export interface JSDocRecordMember extends PropertyDeclaration {
|
||||
name: Identifier | LiteralExpression,
|
||||
type?: JSDocType
|
||||
}
|
||||
|
||||
export interface JSDocComment extends Node {
|
||||
tags: NodeArray<JSDocTag>;
|
||||
}
|
||||
|
||||
export interface JSDocTag extends Node {
|
||||
atToken: Node;
|
||||
tagName: Identifier;
|
||||
}
|
||||
|
||||
export interface JSDocTemplateTag extends JSDocTag {
|
||||
typeParameters: NodeArray<TypeParameterDeclaration>;
|
||||
}
|
||||
|
||||
export interface JSDocReturnTag extends JSDocTag {
|
||||
typeExpression: JSDocTypeExpression;
|
||||
}
|
||||
|
||||
export interface JSDocTypeTag extends JSDocTag {
|
||||
typeExpression: JSDocTypeExpression;
|
||||
}
|
||||
|
||||
export interface JSDocParameterTag extends JSDocTag {
|
||||
preParameterName?: Identifier;
|
||||
typeExpression?: JSDocTypeExpression;
|
||||
postParameterName?: Identifier;
|
||||
isBracketed: boolean;
|
||||
}
|
||||
|
||||
// Source files are declarations when they are external modules.
|
||||
export interface SourceFile extends Declaration {
|
||||
statements: NodeArray<ModuleElement>;
|
||||
@@ -1003,7 +1152,7 @@ module ts {
|
||||
text: string;
|
||||
|
||||
amdDependencies: {path: string; name: string}[];
|
||||
amdModuleName: string;
|
||||
moduleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
|
||||
hasNoDefaultLib: boolean;
|
||||
@@ -1012,7 +1161,8 @@ module ts {
|
||||
|
||||
// The first node that causes this file to be an external module
|
||||
/* @internal */ externalModuleIndicator: Node;
|
||||
|
||||
|
||||
/* @internal */ isDefaultLib: boolean;
|
||||
/* @internal */ identifiers: Map<string>;
|
||||
/* @internal */ nodeCount: number;
|
||||
/* @internal */ identifierCount: number;
|
||||
@@ -1037,7 +1187,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface ParseConfigHost {
|
||||
readDirectory(rootDir: string, extension: string): string[];
|
||||
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
|
||||
}
|
||||
|
||||
export interface WriteFileCallback {
|
||||
@@ -1066,6 +1216,7 @@ module ts {
|
||||
getGlobalDiagnostics(): Diagnostic[];
|
||||
getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
/* @internal */ getCompilerOptionsDiagnostics(): Diagnostic[];
|
||||
|
||||
/**
|
||||
* Gets a type checker that can be used to semantically analyze source fils in the program.
|
||||
@@ -1245,6 +1396,12 @@ module ts {
|
||||
NotAccessible,
|
||||
CannotBeNamed
|
||||
}
|
||||
|
||||
export interface TypePredicate {
|
||||
parameterName: string;
|
||||
parameterIndex: number;
|
||||
type: Type;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
@@ -1265,7 +1422,10 @@ module ts {
|
||||
/* @internal */
|
||||
export interface EmitResolver {
|
||||
hasGlobalName(name: string): boolean;
|
||||
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
|
||||
getReferencedExportContainer(node: Identifier): SourceFile | ModuleDeclaration | EnumDeclaration;
|
||||
getReferencedImportDeclaration(node: Identifier): Declaration;
|
||||
getReferencedNestedRedeclaration(node: Identifier): Declaration;
|
||||
isNestedRedeclaration(node: Declaration): boolean;
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
@@ -1280,15 +1440,15 @@ module ts {
|
||||
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
getReferencedValueDeclaration(reference: Identifier): Declaration;
|
||||
serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
|
||||
serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
|
||||
serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
|
||||
serializeTypeOfNode(node: Node): string | string[];
|
||||
serializeParameterTypesOfNode(node: Node): (string | string[])[];
|
||||
serializeReturnTypeOfNode(node: Node): string | string[];
|
||||
}
|
||||
|
||||
export const enum SymbolFlags {
|
||||
None = 0,
|
||||
FunctionScopedVariable = 0x00000001, // Variable (var) or parameter
|
||||
BlockScopedVariable = 0x00000002, // A block-scoped variable (let or const)
|
||||
Property = 0x00000004, // Property or enum member
|
||||
@@ -1358,11 +1518,11 @@ module ts {
|
||||
|
||||
ExportHasLocal = Function | Class | Enum | ValueModule,
|
||||
|
||||
HasLocals = Function | Module | Method | Constructor | Accessor | Signature,
|
||||
HasExports = Class | Enum | Module,
|
||||
HasMembers = Class | Interface | TypeLiteral | ObjectLiteral,
|
||||
|
||||
IsContainer = HasLocals | HasExports | HasMembers,
|
||||
BlockScoped = BlockScopedVariable | Class | Enum,
|
||||
|
||||
PropertyOrAccessor = Property | Accessor,
|
||||
Export = ExportNamespace | ExportType | ExportValue,
|
||||
}
|
||||
@@ -1370,14 +1530,15 @@ module ts {
|
||||
export interface Symbol {
|
||||
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
|
||||
valueDeclaration?: Declaration; // First value declaration of the symbol
|
||||
|
||||
members?: SymbolTable; // Class, interface or literal instance members
|
||||
exports?: SymbolTable; // Module exports
|
||||
/* @internal */ id?: number; // Unique id (used to look up SymbolLinks)
|
||||
/* @internal */ mergeId?: number; // Merge id (used to look up merged symbol)
|
||||
/* @internal */ parent?: Symbol; // Parent symbol
|
||||
/* @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
|
||||
}
|
||||
|
||||
@@ -1385,12 +1546,15 @@ module ts {
|
||||
export interface SymbolLinks {
|
||||
target?: Symbol; // Resolved (non-alias) target of an alias
|
||||
type?: Type; // Type of value symbol
|
||||
declaredType?: Type; // Type of class, interface, enum, or type parameter
|
||||
declaredType?: Type; // Type of class, interface, enum, type alias, or type parameter
|
||||
typeParameters?: TypeParameter[]; // Type parameters of type alias (undefined if non-generic)
|
||||
instantiations?: Map<Type>; // Instantiations of generic type alias (undefined if non-generic)
|
||||
mapper?: TypeMapper; // Type mapper for instantiation alias
|
||||
referenced?: boolean; // True if alias symbol has been referenced as a value
|
||||
unionType?: UnionType; // Containing union type for union property
|
||||
resolvedExports?: SymbolTable; // Resolved exports of module
|
||||
exportsChecked?: boolean; // True if exports of external module have been checked
|
||||
isNestedRedeclaration?: boolean; // True if symbol is block scoped redeclaration
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
@@ -1451,14 +1615,15 @@ 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
|
||||
/* @internal */
|
||||
ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type
|
||||
ESSymbol = 0x00100000, // Type of symbol primitive introduced in ES6
|
||||
Instantiated = 0x00010000, // Instantiated anonymous type
|
||||
/* @internal */
|
||||
FromSignature = 0x00020000, // Created for signature assignment check
|
||||
ObjectLiteral = 0x00040000, // Originates in an object literal
|
||||
/* @internal */
|
||||
ContainsUndefinedOrNull = 0x00080000, // Type is or contains Undefined or Null type
|
||||
/* @internal */
|
||||
ContainsObjectLiteral = 0x00100000, // Type is or contains object literal type
|
||||
ESSymbol = 0x00200000, // Type of symbol primitive introduced in ES6
|
||||
|
||||
/* @internal */
|
||||
Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null,
|
||||
@@ -1495,6 +1660,8 @@ module ts {
|
||||
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
|
||||
export interface InterfaceType extends ObjectType {
|
||||
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
|
||||
outerTypeParameters: TypeParameter[]; // Outer type parameters (undefined if none)
|
||||
localTypeParameters: TypeParameter[]; // Local type parameters (undefined if none)
|
||||
}
|
||||
|
||||
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
|
||||
@@ -1541,8 +1708,15 @@ module ts {
|
||||
properties: Symbol[]; // Properties
|
||||
callSignatures: Signature[]; // Call signatures of type
|
||||
constructSignatures: Signature[]; // Construct signatures of type
|
||||
stringIndexType: Type; // String index type
|
||||
numberIndexType: Type; // Numeric index type
|
||||
stringIndexType?: Type; // String index type
|
||||
numberIndexType?: Type; // Numeric index type
|
||||
}
|
||||
|
||||
// Just a place to cache element types of iterables and iterators
|
||||
/* @internal */
|
||||
export interface IterableOrIteratorType extends ObjectType, UnionType {
|
||||
iterableElementType?: Type;
|
||||
iteratorElementType?: Type;
|
||||
}
|
||||
|
||||
// Type parameters (TypeFlags.TypeParameter)
|
||||
@@ -1563,6 +1737,7 @@ module ts {
|
||||
declaration: SignatureDeclaration; // Originating declaration
|
||||
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
|
||||
parameters: Symbol[]; // Parameters
|
||||
typePredicate?: TypePredicate; // Type predicate
|
||||
/* @internal */
|
||||
resolvedReturnType: Type; // Resolved return type
|
||||
/* @internal */
|
||||
@@ -1658,7 +1833,9 @@ module ts {
|
||||
locale?: string;
|
||||
mapRoot?: string;
|
||||
module?: ModuleKind;
|
||||
newLine?: NewLineKind;
|
||||
noEmit?: boolean;
|
||||
noEmitHelpers?: boolean;
|
||||
noEmitOnError?: boolean;
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
@@ -1676,9 +1853,11 @@ module ts {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
separateCompilation?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
/* @internal */ skipDefaultLibCheck?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
|
||||
@@ -1690,6 +1869,11 @@ module ts {
|
||||
System = 4,
|
||||
}
|
||||
|
||||
export const enum NewLineKind {
|
||||
CarriageReturnLineFeed = 0,
|
||||
LineFeed = 1,
|
||||
}
|
||||
|
||||
export interface LineAndCharacter {
|
||||
line: number;
|
||||
/*
|
||||
|
||||
+253
-15
@@ -408,6 +408,93 @@ module ts {
|
||||
|
||||
export let fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/
|
||||
|
||||
export function isTypeNode(node: Node): boolean {
|
||||
if (SyntaxKind.FirstTypeNode <= node.kind && node.kind <= SyntaxKind.LastTypeNode) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.AnyKeyword:
|
||||
case SyntaxKind.NumberKeyword:
|
||||
case SyntaxKind.StringKeyword:
|
||||
case SyntaxKind.BooleanKeyword:
|
||||
case SyntaxKind.SymbolKeyword:
|
||||
return true;
|
||||
case SyntaxKind.VoidKeyword:
|
||||
return node.parent.kind !== SyntaxKind.VoidExpression;
|
||||
case SyntaxKind.StringLiteral:
|
||||
// Specialized signatures can have string literals as their parameters' type names
|
||||
return node.parent.kind === SyntaxKind.Parameter;
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return true;
|
||||
|
||||
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
||||
// above them to find the lowest container
|
||||
case SyntaxKind.Identifier:
|
||||
// If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
|
||||
if (node.parent.kind === SyntaxKind.QualifiedName && (<QualifiedName>node.parent).right === node) {
|
||||
node = node.parent;
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.parent).name === node) {
|
||||
node = node.parent;
|
||||
}
|
||||
// fall through
|
||||
case SyntaxKind.QualifiedName:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
// At this point, node is either a qualified name or an identifier
|
||||
Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression,
|
||||
"'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'.");
|
||||
|
||||
let parent = node.parent;
|
||||
if (parent.kind === SyntaxKind.TypeQuery) {
|
||||
return false;
|
||||
}
|
||||
// Do not recursively call isTypeNode on the parent. In the example:
|
||||
//
|
||||
// let a: A.B.C;
|
||||
//
|
||||
// Calling isTypeNode would consider the qualified name A.B a type node. Only C or
|
||||
// A.B.C is a type node.
|
||||
if (SyntaxKind.FirstTypeNode <= parent.kind && parent.kind <= SyntaxKind.LastTypeNode) {
|
||||
return true;
|
||||
}
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return true;
|
||||
case SyntaxKind.TypeParameter:
|
||||
return node === (<TypeParameterDeclaration>parent).constraint;
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return node === (<VariableLikeDeclaration>parent).type;
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
return node === (<FunctionLikeDeclaration>parent).type;
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
return node === (<SignatureDeclaration>parent).type;
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return node === (<TypeAssertion>parent).type;
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
return (<CallExpression>parent).typeArguments && indexOf((<CallExpression>parent).typeArguments, node) >= 0;
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
// TODO (drosen): TaggedTemplateExpressions may eventually support type arguments.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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 {
|
||||
@@ -438,6 +525,46 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void {
|
||||
|
||||
return traverse(body);
|
||||
|
||||
function traverse(node: Node): void {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.YieldExpression:
|
||||
visitor(<YieldExpression>node);
|
||||
let operand = (<YieldExpression>node).expression;
|
||||
if (operand) {
|
||||
traverse(operand);
|
||||
}
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
// These are not allowed inside a generator now, but eventually they may be allowed
|
||||
// as local types. Regardless, any yield statements contained within them should be
|
||||
// skipped in this traversal.
|
||||
return;
|
||||
default:
|
||||
if (isFunctionLike(node)) {
|
||||
let name = (<FunctionLikeDeclaration>node).name;
|
||||
if (name && name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
// Note that we will not include methods/accessors of a class because they would require
|
||||
// first descending into the class. This is by design.
|
||||
traverse((<ComputedPropertyName>name).expression);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!isTypeNode(node)) {
|
||||
// This is the general case, which should include mostly expressions and statements.
|
||||
// Also includes NodeArrays.
|
||||
forEachChild(node, traverse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function isVariableLike(node: Node): boolean {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
@@ -468,6 +595,12 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isClassLike(node: Node): boolean {
|
||||
if (node) {
|
||||
return node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression;
|
||||
}
|
||||
}
|
||||
|
||||
export function isFunctionLike(node: Node): boolean {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
@@ -484,9 +617,6 @@ module ts {
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -736,6 +866,7 @@ module ts {
|
||||
case SyntaxKind.TemplateExpression:
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
case SyntaxKind.OmittedExpression:
|
||||
case SyntaxKind.YieldExpression:
|
||||
return true;
|
||||
case SyntaxKind.QualifiedName:
|
||||
while (node.parent.kind === SyntaxKind.QualifiedName) {
|
||||
@@ -832,10 +963,6 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function hasDotDotDotToken(node: Node) {
|
||||
return node && node.kind === SyntaxKind.Parameter && (<ParameterDeclaration>node).dotDotDotToken !== undefined;
|
||||
}
|
||||
|
||||
export function hasQuestionToken(node: Node) {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
@@ -855,8 +982,76 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function hasRestParameters(s: SignatureDeclaration): boolean {
|
||||
return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined;
|
||||
export function isJSDocConstructSignature(node: Node) {
|
||||
return node.kind === SyntaxKind.JSDocFunctionType &&
|
||||
(<JSDocFunctionType>node).parameters.length > 0 &&
|
||||
(<JSDocFunctionType>node).parameters[0].type.kind === SyntaxKind.JSDocConstructorType;
|
||||
}
|
||||
|
||||
function getJSDocTag(node: Node, kind: SyntaxKind): JSDocTag {
|
||||
if (node && node.jsDocComment) {
|
||||
for (let tag of node.jsDocComment.tags) {
|
||||
if (tag.kind === kind) {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getJSDocTypeTag(node: Node): JSDocTypeTag {
|
||||
return <JSDocTypeTag>getJSDocTag(node, SyntaxKind.JSDocTypeTag);
|
||||
}
|
||||
|
||||
export function getJSDocReturnTag(node: Node): JSDocReturnTag {
|
||||
return <JSDocReturnTag>getJSDocTag(node, SyntaxKind.JSDocReturnTag);
|
||||
}
|
||||
|
||||
export function getJSDocTemplateTag(node: Node): JSDocTemplateTag {
|
||||
return <JSDocTemplateTag>getJSDocTag(node, SyntaxKind.JSDocTemplateTag);
|
||||
}
|
||||
|
||||
export function getCorrespondingJSDocParameterTag(parameter: ParameterDeclaration): JSDocParameterTag {
|
||||
if (parameter.name && parameter.name.kind === SyntaxKind.Identifier) {
|
||||
// If it's a parameter, see if the parent has a jsdoc comment with an @param
|
||||
// annotation.
|
||||
let parameterName = (<Identifier>parameter.name).text;
|
||||
|
||||
let docComment = parameter.parent.jsDocComment;
|
||||
if (docComment) {
|
||||
return <JSDocParameterTag>forEach(docComment.tags, t => {
|
||||
if (t.kind === SyntaxKind.JSDocParameterTag) {
|
||||
let parameterTag = <JSDocParameterTag>t;
|
||||
let name = parameterTag.preParameterName || parameterTag.postParameterName;
|
||||
if (name.text === parameterName) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function hasRestParameter(s: SignatureDeclaration): boolean {
|
||||
return isRestParameter(lastOrUndefined(s.parameters));
|
||||
}
|
||||
|
||||
export function isRestParameter(node: ParameterDeclaration) {
|
||||
if (node) {
|
||||
if (node.parserContextFlags & ParserContextFlags.JavaScriptFile) {
|
||||
if (node.type && node.type.kind === SyntaxKind.JSDocVariadicType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let paramTag = getCorrespondingJSDocParameterTag(node);
|
||||
if (paramTag && paramTag.typeExpression) {
|
||||
return paramTag.typeExpression.type.kind === SyntaxKind.JSDocVariadicType;
|
||||
}
|
||||
}
|
||||
|
||||
return node.dotDotDotToken !== undefined;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isLiteralKind(kind: SyntaxKind): boolean {
|
||||
@@ -1150,6 +1345,18 @@ module ts {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isParameterDeclaration(node: VariableLikeDeclaration) {
|
||||
let root = getRootDeclaration(node);
|
||||
return root.kind === SyntaxKind.Parameter;
|
||||
}
|
||||
|
||||
export function getRootDeclaration(node: Node): Node {
|
||||
while (node.kind === SyntaxKind.BindingElement) {
|
||||
node = node.parent.parent;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
export function nodeStartsNewLexicalEnvironment(n: Node): boolean {
|
||||
return isFunctionLike(n) || n.kind === SyntaxKind.ModuleDeclaration || n.kind === SyntaxKind.SourceFile;
|
||||
@@ -1363,7 +1570,7 @@ module ts {
|
||||
let lineStartsOfS = computeLineStarts(s);
|
||||
if (lineStartsOfS.length > 1) {
|
||||
lineCount = lineCount + lineStartsOfS.length - 1;
|
||||
linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1];
|
||||
linePos = output.length - s.length + lastOrUndefined(lineStartsOfS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1436,8 +1643,10 @@ module ts {
|
||||
|
||||
export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean {
|
||||
if (!isDeclarationFile(sourceFile)) {
|
||||
if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.fileName, ".js")) {
|
||||
return true;
|
||||
if ((isExternalModule(sourceFile) || !compilerOptions.out)) {
|
||||
// 1. in-browser single file compilation scenario
|
||||
// 2. non .js file
|
||||
return compilerOptions.isolatedModules || !fileExtensionIs(sourceFile.fileName, ".js");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1695,7 +1904,11 @@ module ts {
|
||||
}
|
||||
|
||||
export function getLocalSymbolForExportDefault(symbol: Symbol) {
|
||||
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
|
||||
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
|
||||
}
|
||||
|
||||
export function isJavaScript(fileName: string) {
|
||||
return fileExtensionIs(fileName, ".js");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1729,8 +1942,8 @@ module ts {
|
||||
output.push(((charCode >> 6) & 0B00111111) | 0B10000000);
|
||||
output.push((charCode & 0B00111111) | 0B10000000);
|
||||
}
|
||||
else {
|
||||
Debug.assert(false, "Unexpected code point");
|
||||
else {
|
||||
Debug.assert(false, "Unexpected code point");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1774,6 +1987,21 @@ module ts {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const carriageReturnLineFeed = "\r\n";
|
||||
const lineFeed = "\n";
|
||||
export function getNewLineCharacter(options: CompilerOptions): string {
|
||||
if (options.newLine === NewLineKind.CarriageReturnLineFeed) {
|
||||
return carriageReturnLineFeed;
|
||||
}
|
||||
else if (options.newLine === NewLineKind.LineFeed) {
|
||||
return lineFeed;
|
||||
}
|
||||
else if (sys) {
|
||||
return sys.newLine
|
||||
}
|
||||
return carriageReturnLineFeed;
|
||||
}
|
||||
}
|
||||
|
||||
module ts {
|
||||
@@ -1991,4 +2219,14 @@ module ts {
|
||||
|
||||
return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength:*/ newEndN - oldStartN);
|
||||
}
|
||||
|
||||
export function getTypeParameterOwner(d: Declaration): Declaration {
|
||||
if (d && d.kind === SyntaxKind.TypeParameter) {
|
||||
for (let current: Node = d; current; current = current.parent) {
|
||||
if (isFunctionLike(current) || isClassLike(current) || current.kind === SyntaxKind.InterfaceDeclaration) {
|
||||
return <Declaration>current;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,10 +144,10 @@ module FourSlash {
|
||||
if (globalOptions.hasOwnProperty(prop)) {
|
||||
switch (prop) {
|
||||
case metadataOptionNames.allowNonTsExtensions:
|
||||
settings.allowNonTsExtensions = true;
|
||||
settings.allowNonTsExtensions = globalOptions[prop] === "true";
|
||||
break;
|
||||
case metadataOptionNames.declaration:
|
||||
settings.declaration = true;
|
||||
settings.declaration = globalOptions[prop] === "true";
|
||||
break;
|
||||
case metadataOptionNames.mapRoot:
|
||||
settings.mapRoot = globalOptions[prop];
|
||||
@@ -174,7 +174,7 @@ module FourSlash {
|
||||
settings.outDir = globalOptions[prop];
|
||||
break;
|
||||
case metadataOptionNames.sourceMap:
|
||||
settings.sourceMap = true;
|
||||
settings.sourceMap = globalOptions[prop] === "true";
|
||||
break;
|
||||
case metadataOptionNames.sourceRoot:
|
||||
settings.sourceRoot = globalOptions[prop];
|
||||
@@ -308,7 +308,7 @@ module FourSlash {
|
||||
ts.forEach(testData.files, file => {
|
||||
// Create map between fileName and its content for easily looking up when resolveReference flag is specified
|
||||
this.inputFiles[file.fileName] = file.content;
|
||||
if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference]) {
|
||||
if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference] === "true") {
|
||||
startResolveFileRef = file;
|
||||
} else if (startResolveFileRef) {
|
||||
// If entry point for resolving file references is already specified, report duplication error
|
||||
@@ -798,8 +798,17 @@ module FourSlash {
|
||||
return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue;
|
||||
}
|
||||
|
||||
public getSyntacticDiagnostics(expected: string) {
|
||||
var diagnostics = this.languageService.getSyntacticDiagnostics(this.activeFile.fileName);
|
||||
this.testDiagnostics(expected, diagnostics);
|
||||
}
|
||||
|
||||
public getSemanticDiagnostics(expected: string) {
|
||||
var diagnostics = this.languageService.getSemanticDiagnostics(this.activeFile.fileName);
|
||||
this.testDiagnostics(expected, diagnostics);
|
||||
}
|
||||
|
||||
private testDiagnostics(expected: string, diagnostics: ts.Diagnostic[]) {
|
||||
var realized = ts.realizeDiagnostics(diagnostics, "\r\n");
|
||||
var actual = JSON.stringify(realized, null, " ");
|
||||
assert.equal(actual, expected);
|
||||
@@ -1158,7 +1167,7 @@ module FourSlash {
|
||||
var allFourSlashFiles = this.testData.files;
|
||||
for (var idx = 0; idx < allFourSlashFiles.length; ++idx) {
|
||||
var file = allFourSlashFiles[idx];
|
||||
if (file.fileOptions[metadataOptionNames.emitThisFile]) {
|
||||
if (file.fileOptions[metadataOptionNames.emitThisFile] === "true") {
|
||||
// Find a file with the flag emitThisFile turned on
|
||||
emitFiles.push(file);
|
||||
}
|
||||
@@ -1570,6 +1579,28 @@ module FourSlash {
|
||||
this.currentCaretPosition = definition.textSpan.start;
|
||||
}
|
||||
|
||||
public goToTypeDefinition(definitionIndex: number) {
|
||||
if (definitionIndex === 0) {
|
||||
this.scenarioActions.push('<GoToTypeDefinition />');
|
||||
}
|
||||
else {
|
||||
this.taoInvalidReason = 'GoToTypeDefinition not supported for non-zero definition indices';
|
||||
}
|
||||
|
||||
var definitions = this.languageService.getTypeDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
if (!definitions || !definitions.length) {
|
||||
this.raiseError('goToTypeDefinition failed - expected to at least one definition location but got 0');
|
||||
}
|
||||
|
||||
if (definitionIndex >= definitions.length) {
|
||||
this.raiseError('goToTypeDefinition failed - definitionIndex value (' + definitionIndex + ') exceeds definition list size (' + definitions.length + ')');
|
||||
}
|
||||
|
||||
var definition = definitions[definitionIndex];
|
||||
this.openFile(definition.fileName);
|
||||
this.currentCaretPosition = definition.textSpan.start;
|
||||
}
|
||||
|
||||
public verifyDefinitionLocationExists(negative: boolean) {
|
||||
this.taoInvalidReason = 'verifyDefinitionLocationExists NYI';
|
||||
|
||||
@@ -1589,8 +1620,18 @@ module FourSlash {
|
||||
var assertFn = negative ? assert.notEqual : assert.equal;
|
||||
|
||||
var definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
var actualCount = definitions && definitions.length || 0;
|
||||
|
||||
assertFn(definitions.length, expectedCount, this.messageAtLastKnownMarker("Definitions Count"));
|
||||
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Definitions Count"));
|
||||
}
|
||||
|
||||
public verifyTypeDefinitionsCount(negative: boolean, expectedCount: number) {
|
||||
var assertFn = negative ? assert.notEqual : assert.equal;
|
||||
|
||||
var definitions = this.languageService.getTypeDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
var actualCount = definitions && definitions.length || 0;
|
||||
|
||||
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Type definitions Count"));
|
||||
}
|
||||
|
||||
public verifyDefinitionsName(negative: boolean, expectedName: string, expectedContainerName: string) {
|
||||
@@ -1777,6 +1818,21 @@ module FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
private verifyProjectInfo(expected: string[]) {
|
||||
if (this.testType == FourSlashTestType.Server) {
|
||||
let actual = (<ts.server.SessionClient>this.languageService).getProjectInfo(
|
||||
this.activeFile.fileName,
|
||||
/* needFileNameList */ true
|
||||
);
|
||||
assert.equal(
|
||||
expected.join(","),
|
||||
actual.fileNameList.map( file => {
|
||||
return file.replace(this.basePath + "/", "")
|
||||
}).join(",")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public verifySemanticClassifications(expected: { classificationType: string; text: string }[]) {
|
||||
var actual = this.languageService.getSemanticClassifications(this.activeFile.fileName,
|
||||
ts.createTextSpan(0, this.activeFile.content.length));
|
||||
|
||||
@@ -35,9 +35,9 @@ class FourSlashRunner extends RunnerBase {
|
||||
this.tests = this.enumerateFiles(this.basePath, /\.ts/i, { recursive: false });
|
||||
}
|
||||
|
||||
describe(this.testSuiteName, () => {
|
||||
this.tests.forEach((fn: string) => {
|
||||
fn = ts.normalizeSlashes(fn);
|
||||
describe(fn, () => {
|
||||
fn = ts.normalizeSlashes(fn);
|
||||
var justName = fn.replace(/^.*[\\\/]/, '');
|
||||
|
||||
// Convert to relative path
|
||||
|
||||
+120
-115
@@ -45,11 +45,13 @@ module Utils {
|
||||
export function getExecutionEnvironment() {
|
||||
if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
|
||||
return ExecutionEnvironment.CScript;
|
||||
} else if (process && process.execPath && process.execPath.indexOf("node") !== -1) {
|
||||
return ExecutionEnvironment.Node;
|
||||
} else {
|
||||
}
|
||||
else if (typeof window !== "undefined") {
|
||||
return ExecutionEnvironment.Browser;
|
||||
}
|
||||
else {
|
||||
return ExecutionEnvironment.Node;
|
||||
}
|
||||
}
|
||||
|
||||
export var currentExecutionEnvironment = getExecutionEnvironment();
|
||||
@@ -191,12 +193,16 @@ module Utils {
|
||||
};
|
||||
}
|
||||
|
||||
export function sourceFileToJSON(file: ts.SourceFile): string {
|
||||
export function sourceFileToJSON(file: ts.Node): string {
|
||||
return JSON.stringify(file,(k, v) => {
|
||||
return isNodeOrArray(v) ? serializeNode(v) : v;
|
||||
}, " ");
|
||||
|
||||
function getKindName(k: number): string {
|
||||
function getKindName(k: number | string): string {
|
||||
if (typeof k === "string") {
|
||||
return k;
|
||||
}
|
||||
|
||||
return (<any>ts).SyntaxKind[k]
|
||||
}
|
||||
|
||||
@@ -229,7 +235,9 @@ module Utils {
|
||||
|
||||
function serializeNode(n: ts.Node): any {
|
||||
var o: any = { kind: getKindName(n.kind) };
|
||||
o.containsParseError = ts.containsParseError(n);
|
||||
if (ts.containsParseError(n)) {
|
||||
o.containsParseError = true;
|
||||
}
|
||||
|
||||
ts.forEach(Object.getOwnPropertyNames(n), propertyName => {
|
||||
switch (propertyName) {
|
||||
@@ -247,6 +255,10 @@ module Utils {
|
||||
// Blacklist of items we never put in the baseline file.
|
||||
break;
|
||||
|
||||
case "originalKeywordKind":
|
||||
o[propertyName] = getKindName((<any>n)[propertyName]);
|
||||
break;
|
||||
|
||||
case "flags":
|
||||
// Print out flags with their enum names.
|
||||
o[propertyName] = getNodeFlagName(n.flags);
|
||||
@@ -796,18 +808,27 @@ module Harness {
|
||||
}
|
||||
}
|
||||
|
||||
export function createSourceFileAndAssertInvariants(fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, assertInvariants = true) {
|
||||
export function createSourceFileAndAssertInvariants(
|
||||
fileName: string,
|
||||
sourceText: string,
|
||||
languageVersion: ts.ScriptTarget,
|
||||
assertInvariants: boolean) {
|
||||
|
||||
// Only set the parent nodes if we're asserting invariants. We don't need them otherwise.
|
||||
var result = ts.createSourceFile(fileName, sourceText, languageVersion, /*setParentNodes:*/ assertInvariants);
|
||||
|
||||
if (assertInvariants) {
|
||||
Utils.assertInvariants(result, /*parent:*/ undefined);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const carriageReturnLineFeed = "\r\n";
|
||||
const lineFeed = "\n";
|
||||
|
||||
export var defaultLibFileName = 'lib.d.ts';
|
||||
export var defaultLibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest);
|
||||
export var defaultES6LibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest);
|
||||
export var defaultLibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*assertInvariants:*/ true);
|
||||
export var defaultES6LibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*assertInvariants:*/ true);
|
||||
|
||||
// Cache these between executions so we don't have to re-parse them for every test
|
||||
export var fourslashFileName = 'fourslash.ts';
|
||||
@@ -817,12 +838,14 @@ module Harness {
|
||||
return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
|
||||
}
|
||||
|
||||
export function createCompilerHost(inputFiles: { unitName: string; content: string; }[],
|
||||
writeFile: (fn: string, contents: string, writeByteOrderMark: boolean) => void,
|
||||
scriptTarget: ts.ScriptTarget,
|
||||
useCaseSensitiveFileNames: boolean,
|
||||
// the currentDirectory is needed for rwcRunner to passed in specified current directory to compiler host
|
||||
currentDirectory?: string): ts.CompilerHost {
|
||||
export function createCompilerHost(
|
||||
inputFiles: { unitName: string; content: string; }[],
|
||||
writeFile: (fn: string, contents: string, writeByteOrderMark: boolean) => void,
|
||||
scriptTarget: ts.ScriptTarget,
|
||||
useCaseSensitiveFileNames: boolean,
|
||||
// the currentDirectory is needed for rwcRunner to passed in specified current directory to compiler host
|
||||
currentDirectory?: string,
|
||||
newLineKind?: ts.NewLineKind): ts.CompilerHost {
|
||||
|
||||
// Local get canonical file name function, that depends on passed in parameter for useCaseSensitiveFileNames
|
||||
function getCanonicalFileName(fileName: string): string {
|
||||
@@ -836,11 +859,16 @@ module Harness {
|
||||
function register(file: { unitName: string; content: string; }) {
|
||||
if (file.content !== undefined) {
|
||||
var fileName = ts.normalizePath(file.unitName);
|
||||
filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, scriptTarget);
|
||||
filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, scriptTarget, /*assertInvariants:*/ true);
|
||||
}
|
||||
};
|
||||
inputFiles.forEach(register);
|
||||
|
||||
let newLine =
|
||||
newLineKind === ts.NewLineKind.CarriageReturnLineFeed ? carriageReturnLineFeed :
|
||||
newLineKind === ts.NewLineKind.LineFeed ? lineFeed :
|
||||
ts.sys.newLine;
|
||||
|
||||
return {
|
||||
getCurrentDirectory,
|
||||
getSourceFile: (fn, languageVersion) => {
|
||||
@@ -854,7 +882,7 @@ module Harness {
|
||||
}
|
||||
else if (fn === fourslashFileName) {
|
||||
var tsFn = 'tests/cases/fourslash/' + fourslashFileName;
|
||||
fourslashSourceFile = fourslashSourceFile || createSourceFileAndAssertInvariants(tsFn, Harness.IO.readFile(tsFn), scriptTarget);
|
||||
fourslashSourceFile = fourslashSourceFile || createSourceFileAndAssertInvariants(tsFn, Harness.IO.readFile(tsFn), scriptTarget, /*assertInvariants:*/ true);
|
||||
return fourslashSourceFile;
|
||||
}
|
||||
else {
|
||||
@@ -869,7 +897,7 @@ module Harness {
|
||||
writeFile,
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
||||
getNewLine: () => ts.sys.newLine
|
||||
getNewLine: () => newLine
|
||||
};
|
||||
}
|
||||
|
||||
@@ -878,7 +906,7 @@ module Harness {
|
||||
private compileOptions: ts.CompilerOptions;
|
||||
private settings: Harness.TestCaseParser.CompilerSetting[] = [];
|
||||
|
||||
private lastErrors: HarnessDiagnostic[];
|
||||
private lastErrors: ts.Diagnostic[];
|
||||
|
||||
public reset() {
|
||||
this.inputFiles = [];
|
||||
@@ -936,13 +964,15 @@ module Harness {
|
||||
options = options || { noResolve: false };
|
||||
options.target = options.target || ts.ScriptTarget.ES3;
|
||||
options.module = options.module || ts.ModuleKind.None;
|
||||
options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed;
|
||||
options.noErrorTruncation = true;
|
||||
|
||||
if (settingsCallback) {
|
||||
settingsCallback(null);
|
||||
}
|
||||
|
||||
var newLine = '\r\n';
|
||||
let newLine = '\r\n';
|
||||
options.skipDefaultLibCheck = true;
|
||||
|
||||
// Files from built\local that are requested by test "@includeBuiltFiles" to be in the context.
|
||||
// Treat them as library files, so include them in build, but not in baselines.
|
||||
@@ -989,21 +1019,33 @@ module Harness {
|
||||
options.target = <any>setting.value;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'experimentaldecorators':
|
||||
options.experimentalDecorators = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'emitdecoratormetadata':
|
||||
options.emitDecoratorMetadata = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'noemithelpers':
|
||||
options.noEmitHelpers = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'noemitonerror':
|
||||
options.noEmitOnError = !!setting.value;
|
||||
options.noEmitOnError = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'noresolve':
|
||||
options.noResolve = !!setting.value;
|
||||
options.noResolve = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'noimplicitany':
|
||||
options.noImplicitAny = !!setting.value;
|
||||
options.noImplicitAny = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'nolib':
|
||||
options.noLib = !!setting.value;
|
||||
options.noLib = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'out':
|
||||
@@ -1016,6 +1058,10 @@ module Harness {
|
||||
options.outDir = setting.value;
|
||||
break;
|
||||
|
||||
case 'skipdefaultlibcheck':
|
||||
options.skipDefaultLibCheck = setting.value === "true";
|
||||
break;
|
||||
|
||||
case 'sourceroot':
|
||||
options.sourceRoot = setting.value;
|
||||
break;
|
||||
@@ -1025,16 +1071,23 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'sourcemap':
|
||||
options.sourceMap = !!setting.value;
|
||||
options.sourceMap = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'declaration':
|
||||
options.declaration = !!setting.value;
|
||||
options.declaration = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'newline':
|
||||
case 'newlines':
|
||||
newLine = setting.value;
|
||||
if (setting.value.toLowerCase() === 'crlf') {
|
||||
options.newLine = ts.NewLineKind.CarriageReturnLineFeed;
|
||||
}
|
||||
else if (setting.value.toLowerCase() === 'lf') {
|
||||
options.newLine = ts.NewLineKind.LineFeed;
|
||||
}
|
||||
else {
|
||||
throw new Error('Unknown option for newLine: ' + setting.value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'comments':
|
||||
@@ -1042,7 +1095,7 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'stripinternal':
|
||||
options.stripInternal = !!setting.value;
|
||||
options.stripInternal = setting.value === 'true';
|
||||
|
||||
case 'usecasesensitivefilenames':
|
||||
useCaseSensitiveFileNames = setting.value === 'true';
|
||||
@@ -1053,7 +1106,7 @@ module Harness {
|
||||
break;
|
||||
|
||||
case 'emitbom':
|
||||
options.emitBOM = !!setting.value;
|
||||
options.emitBOM = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'errortruncation':
|
||||
@@ -1064,8 +1117,8 @@ module Harness {
|
||||
options.preserveConstEnums = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'separatecompilation':
|
||||
options.separateCompilation = setting.value === 'true';
|
||||
case 'isolatedmodules':
|
||||
options.isolatedModules = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'suppressimplicitanyindexerrors':
|
||||
@@ -1093,17 +1146,15 @@ module Harness {
|
||||
var fileOutputs: GeneratedFile[] = [];
|
||||
|
||||
var programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName);
|
||||
var program = ts.createProgram(programFiles, options, createCompilerHost(inputFiles.concat(includeBuiltFiles).concat(otherFiles),
|
||||
var compilerHost = createCompilerHost(
|
||||
inputFiles.concat(includeBuiltFiles).concat(otherFiles),
|
||||
(fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }),
|
||||
options.target, useCaseSensitiveFileNames, currentDirectory));
|
||||
options.target, useCaseSensitiveFileNames, currentDirectory, options.newLine);
|
||||
var program = ts.createProgram(programFiles, options, compilerHost);
|
||||
|
||||
var emitResult = program.emit();
|
||||
|
||||
var errors: HarnessDiagnostic[] = [];
|
||||
ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics).forEach(err => {
|
||||
// TODO: new compiler formats errors after this point to add . and newlines so we'll just do it manually for now
|
||||
errors.push(getMinimalDiagnostic(err));
|
||||
});
|
||||
var errors = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
||||
this.lastErrors = errors;
|
||||
|
||||
var result = new CompilerResult(fileOutputs, errors, program, ts.sys.getCurrentDirectory(), emitResult.sourceMaps);
|
||||
@@ -1190,70 +1241,50 @@ module Harness {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic {
|
||||
var errorLineInfo = err.file ? err.file.getLineAndCharacterOfPosition(err.start) : { line: -1, character: -1 };
|
||||
return {
|
||||
fileName: err.file && err.file.fileName,
|
||||
start: err.start,
|
||||
end: err.start + err.length,
|
||||
line: errorLineInfo.line + 1,
|
||||
character: errorLineInfo.character + 1,
|
||||
message: ts.flattenDiagnosticMessageText(err.messageText, ts.sys.newLine),
|
||||
category: ts.DiagnosticCategory[err.category].toLowerCase(),
|
||||
code: err.code
|
||||
};
|
||||
}
|
||||
|
||||
export function minimalDiagnosticsToString(diagnostics: HarnessDiagnostic[]) {
|
||||
export function minimalDiagnosticsToString(diagnostics: ts.Diagnostic[]) {
|
||||
// This is basically copied from tsc.ts's reportError to replicate what tsc does
|
||||
var errorOutput = "";
|
||||
ts.forEach(diagnostics, diagnotic => {
|
||||
if (diagnotic.fileName) {
|
||||
errorOutput += diagnotic.fileName + "(" + diagnotic.line + "," + diagnotic.character + "): ";
|
||||
ts.forEach(diagnostics, diagnostic => {
|
||||
if (diagnostic.file) {
|
||||
var lineAndCharacter = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
errorOutput += diagnostic.file.fileName + "(" + (lineAndCharacter.line + 1) + "," + (lineAndCharacter.character + 1) + "): ";
|
||||
}
|
||||
|
||||
errorOutput += diagnotic.category + " TS" + diagnotic.code + ": " + diagnotic.message + ts.sys.newLine;
|
||||
errorOutput += ts.DiagnosticCategory[diagnostic.category].toLowerCase() + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine;
|
||||
});
|
||||
|
||||
return errorOutput;
|
||||
}
|
||||
|
||||
function compareDiagnostics(d1: HarnessDiagnostic, d2: HarnessDiagnostic) {
|
||||
return ts.compareValues(d1.fileName, d2.fileName) ||
|
||||
ts.compareValues(d1.start, d2.start) ||
|
||||
ts.compareValues(d1.end, d2.end) ||
|
||||
ts.compareValues(d1.code, d2.code) ||
|
||||
ts.compareValues(d1.message, d2.message) ||
|
||||
0;
|
||||
}
|
||||
|
||||
export function getErrorBaseline(inputFiles: { unitName: string; content: string }[], diagnostics: HarnessDiagnostic[]) {
|
||||
diagnostics.sort(compareDiagnostics);
|
||||
export function getErrorBaseline(inputFiles: { unitName: string; content: string }[], diagnostics: ts.Diagnostic[]) {
|
||||
diagnostics.sort(ts.compareDiagnostics);
|
||||
var outputLines: string[] = [];
|
||||
// Count up all the errors we find so we don't miss any
|
||||
var totalErrorsReported = 0;
|
||||
|
||||
function outputErrorText(error: Harness.Compiler.HarnessDiagnostic) {
|
||||
var errLines = RunnerBase.removeFullPaths(error.message)
|
||||
function outputErrorText(error: ts.Diagnostic) {
|
||||
var message = ts.flattenDiagnosticMessageText(error.messageText, ts.sys.newLine);
|
||||
|
||||
var errLines = RunnerBase.removeFullPaths(message)
|
||||
.split('\n')
|
||||
.map(s => s.length > 0 && s.charAt(s.length - 1) === '\r' ? s.substr(0, s.length - 1) : s)
|
||||
.filter(s => s.length > 0)
|
||||
.map(s => '!!! ' + error.category + " TS" + error.code + ": " + s);
|
||||
.map(s => '!!! ' + ts.DiagnosticCategory[error.category].toLowerCase() + " TS" + error.code + ": " + s);
|
||||
errLines.forEach(e => outputLines.push(e));
|
||||
|
||||
totalErrorsReported++;
|
||||
}
|
||||
|
||||
// Report global errors
|
||||
var globalErrors = diagnostics.filter(err => !err.fileName);
|
||||
var globalErrors = diagnostics.filter(err => !err.file);
|
||||
globalErrors.forEach(outputErrorText);
|
||||
|
||||
// 'merge' the lines of each input file with any errors associated with it
|
||||
inputFiles.filter(f => f.content !== undefined).forEach(inputFile => {
|
||||
// Filter down to the errors in the file
|
||||
var fileErrors = diagnostics.filter(e => {
|
||||
var errFn = e.fileName;
|
||||
return errFn && errFn === inputFile.unitName;
|
||||
var errFn = e.file;
|
||||
return errFn && errFn.fileName === inputFile.unitName;
|
||||
});
|
||||
|
||||
|
||||
@@ -1289,18 +1320,19 @@ module Harness {
|
||||
outputLines.push(' ' + line);
|
||||
fileErrors.forEach(err => {
|
||||
// Does any error start or continue on to this line? Emit squiggles
|
||||
if ((err.end >= thisLineStart) && ((err.start < nextLineStart) || (lineIndex === lines.length - 1))) {
|
||||
let end = ts.textSpanEnd(err);
|
||||
if ((end >= thisLineStart) && ((err.start < nextLineStart) || (lineIndex === lines.length - 1))) {
|
||||
// How many characters from the start of this line the error starts at (could be positive or negative)
|
||||
var relativeOffset = err.start - thisLineStart;
|
||||
// How many characters of the error are on this line (might be longer than this line in reality)
|
||||
var length = (err.end - err.start) - Math.max(0, thisLineStart - err.start);
|
||||
var length = (end - err.start) - Math.max(0, thisLineStart - err.start);
|
||||
// Calculate the start of the squiggle
|
||||
var squiggleStart = Math.max(0, relativeOffset);
|
||||
// TODO/REVIEW: this doesn't work quite right in the browser if a multi file test has files whose names are just the right length relative to one another
|
||||
outputLines.push(' ' + line.substr(0, squiggleStart).replace(/[^\s]/g, ' ') + new Array(Math.min(length, line.length - squiggleStart) + 1).join('~'));
|
||||
|
||||
// If the error ended here, or we're at the end of the file, emit its message
|
||||
if ((lineIndex === lines.length - 1) || nextLineStart > err.end) {
|
||||
if ((lineIndex === lines.length - 1) || nextLineStart > end) {
|
||||
// Just like above, we need to do a split on a string instead of on a regex
|
||||
// because the JS engine does regexes wrong
|
||||
|
||||
@@ -1316,12 +1348,12 @@ module Harness {
|
||||
});
|
||||
|
||||
var numLibraryDiagnostics = ts.countWhere(diagnostics, diagnostic => {
|
||||
return diagnostic.fileName && (isLibraryFile(diagnostic.fileName) || isBuiltFile(diagnostic.fileName));
|
||||
return diagnostic.file && (isLibraryFile(diagnostic.file.fileName) || isBuiltFile(diagnostic.file.fileName));
|
||||
});
|
||||
|
||||
var numTest262HarnessDiagnostics = ts.countWhere(diagnostics, diagnostic => {
|
||||
// Count an error generated from tests262-harness folder.This should only apply for test262
|
||||
return diagnostic.fileName && diagnostic.fileName.indexOf("test262-harness") >= 0;
|
||||
return diagnostic.file && diagnostic.file.fileName.indexOf("test262-harness") >= 0;
|
||||
});
|
||||
|
||||
// Verify we didn't miss any errors in total
|
||||
@@ -1374,17 +1406,6 @@ module Harness {
|
||||
//harnessCompiler.compileString(code, unitName, callback);
|
||||
}
|
||||
|
||||
export interface HarnessDiagnostic {
|
||||
fileName: string;
|
||||
start: number;
|
||||
end: number;
|
||||
line: number;
|
||||
character: number;
|
||||
message: string;
|
||||
category: string;
|
||||
code: number;
|
||||
}
|
||||
|
||||
export interface GeneratedFile {
|
||||
fileName: string;
|
||||
code: string;
|
||||
@@ -1414,12 +1435,12 @@ module Harness {
|
||||
/** Contains the code and errors of a compilation and some helper methods to check its status. */
|
||||
export class CompilerResult {
|
||||
public files: GeneratedFile[] = [];
|
||||
public errors: HarnessDiagnostic[] = [];
|
||||
public errors: ts.Diagnostic[] = [];
|
||||
public declFilesCode: GeneratedFile[] = [];
|
||||
public sourceMaps: GeneratedFile[] = [];
|
||||
|
||||
/** @param fileResults an array of strings for the fileName and an ITextWriter with its code */
|
||||
constructor(fileResults: GeneratedFile[], errors: HarnessDiagnostic[], public program: ts.Program,
|
||||
constructor(fileResults: GeneratedFile[], errors: ts.Diagnostic[], public program: ts.Program,
|
||||
public currentDirectoryForProgram: string, private sourceMapData: ts.SourceMapData[]) {
|
||||
|
||||
fileResults.forEach(emittedFile => {
|
||||
@@ -1444,15 +1465,6 @@ module Harness {
|
||||
return Harness.SourceMapRecoder.getSourceMapRecord(this.sourceMapData, this.program, this.files);
|
||||
}
|
||||
}
|
||||
|
||||
public isErrorAt(line: number, column: number, message: string) {
|
||||
for (var i = 0; i < this.errors.length; i++) {
|
||||
if ((this.errors[i].line + 1) === line && (this.errors[i].character + 1) === column && this.errors[i].message === message)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1477,12 +1489,13 @@ module Harness {
|
||||
|
||||
// List of allowed metadata names
|
||||
var fileMetadataNames = ["filename", "comments", "declaration", "module",
|
||||
"nolib", "sourcemap", "target", "out", "outdir", "noemitonerror",
|
||||
"noimplicitany", "noresolve", "newline", "newlines", "emitbom",
|
||||
"nolib", "sourcemap", "target", "out", "outdir", "noemithelpers", "noemitonerror",
|
||||
"noimplicitany", "noresolve", "newline", "normalizenewline", "emitbom",
|
||||
"errortruncation", "usecasesensitivefilenames", "preserveconstenums",
|
||||
"includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal",
|
||||
"separatecompilation", "inlinesourcemap", "maproot", "sourceroot",
|
||||
"inlinesources"];
|
||||
"isolatedmodules", "inlinesourcemap", "maproot", "sourceroot",
|
||||
"inlinesources", "emitdecoratormetadata", "experimentaldecorators",
|
||||
"skipdefaultlibcheck"];
|
||||
|
||||
function extractCompilerSettings(content: string): CompilerSetting[] {
|
||||
|
||||
@@ -1582,7 +1595,6 @@ module Harness {
|
||||
export module Baseline {
|
||||
|
||||
export interface BaselineOptions {
|
||||
LineEndingSensitive?: boolean;
|
||||
Subfolder?: string;
|
||||
Baselinefolder?: string;
|
||||
}
|
||||
@@ -1674,13 +1686,6 @@ module Harness {
|
||||
expected = IO.readFile(refFileName);
|
||||
}
|
||||
|
||||
var lineEndingSensitive = opts && opts.LineEndingSensitive;
|
||||
|
||||
if (!lineEndingSensitive) {
|
||||
expected = expected.replace(/\r\n?/g, '\n');
|
||||
actual = actual.replace(/\r\n?/g, '\n');
|
||||
}
|
||||
|
||||
return { expected, actual };
|
||||
}
|
||||
|
||||
@@ -1736,4 +1741,4 @@ module Harness {
|
||||
}
|
||||
|
||||
// TODO: not sure why Utils.evalFile isn't working with this, eventually will concat it like old compiler instead of eval
|
||||
eval(Harness.tcServicesFile);
|
||||
eval(Harness.tcServicesFile);
|
||||
|
||||
@@ -241,6 +241,9 @@ module Harness.LanguageService {
|
||||
class ClassifierShimProxy implements ts.Classifier {
|
||||
constructor(private shim: ts.ClassifierShim) {
|
||||
}
|
||||
getEncodedLexicalClassifications(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.Classifications {
|
||||
throw new Error("NYI");
|
||||
}
|
||||
getClassificationsForLine(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.ClassificationResult {
|
||||
var result = this.shim.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics).split('\n');
|
||||
var entries: ts.ClassificationInfo[] = [];
|
||||
@@ -306,6 +309,12 @@ module Harness.LanguageService {
|
||||
getSemanticClassifications(fileName: string, span: ts.TextSpan): ts.ClassifiedSpan[] {
|
||||
return unwrapJSONCallResult(this.shim.getSemanticClassifications(fileName, span.start, span.length));
|
||||
}
|
||||
getEncodedSyntacticClassifications(fileName: string, span: ts.TextSpan): ts.Classifications {
|
||||
return unwrapJSONCallResult(this.shim.getEncodedSyntacticClassifications(fileName, span.start, span.length));
|
||||
}
|
||||
getEncodedSemanticClassifications(fileName: string, span: ts.TextSpan): ts.Classifications {
|
||||
return unwrapJSONCallResult(this.shim.getEncodedSemanticClassifications(fileName, span.start, span.length));
|
||||
}
|
||||
getCompletionsAtPosition(fileName: string, position: number): ts.CompletionInfo {
|
||||
return unwrapJSONCallResult(this.shim.getCompletionsAtPosition(fileName, position));
|
||||
}
|
||||
@@ -333,6 +342,9 @@ module Harness.LanguageService {
|
||||
getDefinitionAtPosition(fileName: string, position: number): ts.DefinitionInfo[] {
|
||||
return unwrapJSONCallResult(this.shim.getDefinitionAtPosition(fileName, position));
|
||||
}
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): ts.DefinitionInfo[]{
|
||||
return unwrapJSONCallResult(this.shim.getTypeDefinitionAtPosition(fileName, position));
|
||||
}
|
||||
getReferencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[] {
|
||||
return unwrapJSONCallResult(this.shim.getReferencesAtPosition(fileName, position));
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class ProjectRunner extends RunnerBase {
|
||||
else {
|
||||
var text = getSourceFileText(fileName);
|
||||
if (text !== undefined) {
|
||||
sourceFile = Harness.Compiler.createSourceFileAndAssertInvariants(fileName, text, languageVersion);
|
||||
sourceFile = Harness.Compiler.createSourceFileAndAssertInvariants(fileName, text, languageVersion, /*assertInvariants:*/ true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,9 +323,8 @@ class ProjectRunner extends RunnerBase {
|
||||
sourceFile => {
|
||||
return { unitName: sourceFile.fileName, content: sourceFile.text };
|
||||
});
|
||||
var diagnostics = ts.map(compilerResult.errors, error => Harness.Compiler.getMinimalDiagnostic(error));
|
||||
|
||||
return Harness.Compiler.getErrorBaseline(inputFiles, diagnostics);
|
||||
return Harness.Compiler.getErrorBaseline(inputFiles, compilerResult.errors);
|
||||
}
|
||||
|
||||
var name = 'Compiling project for ' + testCase.scenario + ': testcase ' + testCaseFileName;
|
||||
|
||||
+39
-35
@@ -38,41 +38,45 @@ var testConfigFile =
|
||||
(Harness.IO.fileExists(testconfig) ? Harness.IO.readFile(testconfig) : '');
|
||||
|
||||
if (testConfigFile !== '') {
|
||||
// TODO: not sure why this is crashing mocha
|
||||
//var testConfig = JSON.parse(testConfigRaw);
|
||||
var testConfig = testConfigFile.match(/test:\s\['(.*)'\]/);
|
||||
var options = testConfig ? [testConfig[1]] : [];
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
switch (options[i]) {
|
||||
case 'compiler':
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Conformance));
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Regressions));
|
||||
runners.push(new ProjectRunner());
|
||||
break;
|
||||
case 'conformance':
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Conformance));
|
||||
break;
|
||||
case 'project':
|
||||
runners.push(new ProjectRunner());
|
||||
break;
|
||||
case 'fourslash':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Native));
|
||||
break;
|
||||
case 'fourslash-shims':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Shims));
|
||||
break;
|
||||
case 'fourslash-server':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Server));
|
||||
break;
|
||||
case 'fourslash-generated':
|
||||
runners.push(new GeneratedFourslashRunner(FourSlashTestType.Native));
|
||||
break;
|
||||
case 'rwc':
|
||||
runners.push(new RWCRunner());
|
||||
break;
|
||||
case 'test262':
|
||||
runners.push(new Test262BaselineRunner());
|
||||
break;
|
||||
var testConfig = JSON.parse(testConfigFile);
|
||||
|
||||
if (testConfig.test && testConfig.test.length > 0) {
|
||||
for (let option of testConfig.test) {
|
||||
if (!option) {
|
||||
continue;
|
||||
}
|
||||
ts.sys.write("Option: " + option + "\r\n");
|
||||
switch (option) {
|
||||
case 'compiler':
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Conformance));
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Regressions));
|
||||
runners.push(new ProjectRunner());
|
||||
break;
|
||||
case 'conformance':
|
||||
runners.push(new CompilerBaselineRunner(CompilerTestType.Conformance));
|
||||
break;
|
||||
case 'project':
|
||||
runners.push(new ProjectRunner());
|
||||
break;
|
||||
case 'fourslash':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Native));
|
||||
break;
|
||||
case 'fourslash-shims':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Shims));
|
||||
break;
|
||||
case 'fourslash-server':
|
||||
runners.push(new FourSlashRunner(FourSlashTestType.Server));
|
||||
break;
|
||||
case 'fourslash-generated':
|
||||
runners.push(new GeneratedFourslashRunner(FourSlashTestType.Native));
|
||||
break;
|
||||
case 'rwc':
|
||||
runners.push(new RWCRunner());
|
||||
break;
|
||||
case 'test262':
|
||||
runners.push(new Test262BaselineRunner());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
interface DOMTokenList {
|
||||
[Symbol.iterator](): IterableIterator<string>;
|
||||
}
|
||||
|
||||
interface NodeList {
|
||||
[Symbol.iterator](): IterableIterator<Node>
|
||||
}
|
||||
|
||||
interface NodeListOf<TNode extends Node> {
|
||||
[Symbol.iterator](): IterableIterator<TNode>
|
||||
}
|
||||
Vendored
+22
-4
@@ -3697,6 +3697,8 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas.
|
||||
* @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl");
|
||||
*/
|
||||
getContext(contextId: "2d"): CanvasRenderingContext2D;
|
||||
getContext(contextId: "experimental-webgl"): WebGLRenderingContext;
|
||||
getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext;
|
||||
/**
|
||||
* Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing.
|
||||
@@ -7675,10 +7677,10 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: string;
|
||||
readyState: number;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: string): void;
|
||||
endOfStream(error?: number): void;
|
||||
removeSourceBuffer(sourceBuffer: SourceBuffer): void;
|
||||
}
|
||||
|
||||
@@ -8407,7 +8409,7 @@ declare var PopStateEvent: {
|
||||
|
||||
interface Position {
|
||||
coords: Coordinates;
|
||||
timestamp: Date;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
declare var Position: {
|
||||
@@ -11088,9 +11090,17 @@ interface WebGLRenderingContext {
|
||||
stencilMaskSeparate(face: number, mask: number): void;
|
||||
stencilOp(fail: number, zfail: number, zpass: number): void;
|
||||
stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, image: HTMLImageElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, canvas: HTMLCanvasElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, video: HTMLVideoElement): void;
|
||||
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageData): void;
|
||||
texParameterf(target: number, pname: number, param: number): void;
|
||||
texParameteri(target: number, pname: number, param: number): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, image: HTMLImageElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void;
|
||||
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void;
|
||||
uniform1f(location: WebGLUniformLocation, x: number): void;
|
||||
uniform1fv(location: WebGLUniformLocation, v: any): void;
|
||||
@@ -12178,6 +12188,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget {
|
||||
overrideMimeType(mime: string): void;
|
||||
send(data?: Document): void;
|
||||
send(data?: string): void;
|
||||
send(data?: any): void;
|
||||
setRequestHeader(header: string, value: string): void;
|
||||
DONE: number;
|
||||
HEADERS_RECEIVED: number;
|
||||
@@ -12329,14 +12340,17 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent;
|
||||
createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent;
|
||||
createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent;
|
||||
createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent;
|
||||
createEvent(eventInterface:"CloseEvent"): CloseEvent;
|
||||
createEvent(eventInterface:"CommandEvent"): CommandEvent;
|
||||
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
|
||||
createEvent(eventInterface:"CustomEvent"): CustomEvent;
|
||||
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
|
||||
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
|
||||
createEvent(eventInterface:"DragEvent"): DragEvent;
|
||||
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
|
||||
createEvent(eventInterface:"Event"): Event;
|
||||
createEvent(eventInterface:"Events"): Event;
|
||||
createEvent(eventInterface:"FocusEvent"): FocusEvent;
|
||||
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
|
||||
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
|
||||
@@ -12351,8 +12365,10 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
|
||||
createEvent(eventInterface:"MessageEvent"): MessageEvent;
|
||||
createEvent(eventInterface:"MouseEvent"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseEvents"): MouseEvent;
|
||||
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
|
||||
createEvent(eventInterface:"MutationEvent"): MutationEvent;
|
||||
createEvent(eventInterface:"MutationEvents"): MutationEvent;
|
||||
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
|
||||
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
|
||||
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
|
||||
@@ -12363,6 +12379,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
|
||||
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
|
||||
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
|
||||
createEvent(eventInterface:"StorageEvent"): StorageEvent;
|
||||
createEvent(eventInterface:"TextEvent"): TextEvent;
|
||||
@@ -12370,6 +12387,7 @@ interface DocumentEvent {
|
||||
createEvent(eventInterface:"TrackEvent"): TrackEvent;
|
||||
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
|
||||
createEvent(eventInterface:"UIEvent"): UIEvent;
|
||||
createEvent(eventInterface:"UIEvents"): UIEvent;
|
||||
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
|
||||
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
|
||||
createEvent(eventInterface:"WheelEvent"): WheelEvent;
|
||||
@@ -12960,4 +12978,4 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any,
|
||||
declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
|
||||
Vendored
+59
-26
@@ -51,11 +51,41 @@ interface SymbolConstructor {
|
||||
isConcatSpreadable: symbol;
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object.Called by the semantics of the
|
||||
* A method that returns the default iterator for an object. Called by the semantics of the
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that matches the regular expression against a string. Called
|
||||
* by the String.prototype.match method.
|
||||
*/
|
||||
match: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that replaces matched substrings of a string. Called by the
|
||||
* String.prototype.replace method.
|
||||
*/
|
||||
replace: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that returns the index within a string that matches the
|
||||
* regular expression. Called by the String.prototype.search method.
|
||||
*/
|
||||
search: symbol;
|
||||
|
||||
/**
|
||||
* A function valued property that is the constructor function that is used to create
|
||||
* derived objects.
|
||||
*/
|
||||
species: symbol;
|
||||
|
||||
/**
|
||||
* A regular expression method that splits a string at the indices that match the regular
|
||||
* expression. Called by the String.prototype.split method.
|
||||
*/
|
||||
split: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
@@ -286,6 +316,11 @@ interface Array<T> {
|
||||
copyWithin(target: number, start: number, end?: number): T[];
|
||||
}
|
||||
|
||||
interface IArguments {
|
||||
/** Iterator */
|
||||
[Symbol.iterator](): IterableIterator<any>;
|
||||
}
|
||||
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Creates an array from an array-like object.
|
||||
@@ -470,14 +505,6 @@ interface GeneratorFunctionConstructor {
|
||||
}
|
||||
declare var GeneratorFunction: GeneratorFunctionConstructor;
|
||||
|
||||
interface Generator<T> extends IterableIterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
throw(exception: any): IteratorResult<T>;
|
||||
return(value: T): IteratorResult<T>;
|
||||
[Symbol.iterator](): Generator<T>;
|
||||
[Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface Math {
|
||||
/**
|
||||
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
|
||||
@@ -3542,6 +3569,17 @@ declare module Reflect {
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
|
||||
interface PromiseLike<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
*/
|
||||
@@ -3552,14 +3590,17 @@ interface Promise<T> {
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | Promise<TResult>, onrejected?: (reason: any) => TResult | Promise<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected?: (reason: any) => T | Promise<T>): Promise<T>;
|
||||
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
[Symbol.toStringTag]: string;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
@@ -3570,13 +3611,11 @@ interface PromiseConstructor {
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param init A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
<T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
@@ -3584,15 +3623,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of values.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all(values: Promise<void>[]): Promise<void>;
|
||||
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
@@ -3600,7 +3631,7 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: (T | Promise<T>)[]): Promise<T>;
|
||||
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
@@ -3621,13 +3652,15 @@ interface PromiseConstructor {
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
resolve<T>(value: T | Promise<T>): Promise<T>;
|
||||
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise .
|
||||
* @returns A resolved promise.
|
||||
*/
|
||||
resolve(): Promise<void>;
|
||||
|
||||
[Symbol.species]: Function;
|
||||
}
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
||||
|
||||
Vendored
+8
-8
@@ -62,10 +62,10 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedNumberFormatOptions;
|
||||
}
|
||||
var NumberFormat: {
|
||||
new (locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
new (locale?: string, options?: NumberFormatOptions): Collator;
|
||||
(locales?: string[], options?: NumberFormatOptions): Collator;
|
||||
(locale?: string, options?: NumberFormatOptions): Collator;
|
||||
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
|
||||
(locale?: string, options?: NumberFormatOptions): NumberFormat;
|
||||
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
|
||||
}
|
||||
@@ -107,10 +107,10 @@ declare module Intl {
|
||||
resolvedOptions(): ResolvedDateTimeFormatOptions;
|
||||
}
|
||||
var DateTimeFormat: {
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): Collator;
|
||||
(locale?: string, options?: DateTimeFormatOptions): Collator;
|
||||
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
|
||||
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
|
||||
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
|
||||
}
|
||||
|
||||
@@ -171,6 +171,21 @@ module ts.server {
|
||||
documentation: [{ kind: "text", text: response.body.documentation }]
|
||||
};
|
||||
}
|
||||
|
||||
getProjectInfo(fileName: string, needFileNameList: boolean): protocol.ProjectInfo {
|
||||
var args: protocol.ProjectInfoRequestArgs = {
|
||||
file: fileName,
|
||||
needFileNameList: needFileNameList
|
||||
};
|
||||
|
||||
var request = this.processRequest<protocol.ProjectInfoRequest>(CommandNames.ProjectInfo, args);
|
||||
var response = this.processResponse<protocol.ProjectInfoResponse>(request);
|
||||
|
||||
return {
|
||||
configFileName: response.body.configFileName,
|
||||
fileNameList: response.body.fileNameList
|
||||
};
|
||||
}
|
||||
|
||||
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo {
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
@@ -300,6 +315,32 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] {
|
||||
var lineOffset = this.positionToOneBasedLineOffset(fileName, position);
|
||||
var args: protocol.FileLocationRequestArgs = {
|
||||
file: fileName,
|
||||
line: lineOffset.line,
|
||||
offset: lineOffset.offset,
|
||||
};
|
||||
|
||||
var request = this.processRequest<protocol.TypeDefinitionRequest>(CommandNames.TypeDefinition, args);
|
||||
var response = this.processResponse<protocol.TypeDefinitionResponse>(request);
|
||||
|
||||
return response.body.map(entry => {
|
||||
var fileName = entry.file;
|
||||
var start = this.lineOffsetToPosition(fileName, entry.start);
|
||||
var end = this.lineOffsetToPosition(fileName, entry.end);
|
||||
return {
|
||||
containerKind: "",
|
||||
containerName: "",
|
||||
fileName: fileName,
|
||||
textSpan: ts.createTextSpanFromBounds(start, end),
|
||||
kind: "",
|
||||
name: ""
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
findReferences(fileName: string, position: number): ReferencedSymbol[]{
|
||||
// Not yet implemented.
|
||||
return [];
|
||||
@@ -533,6 +574,14 @@ module ts.server {
|
||||
throw new Error("Not Implemented Yet.");
|
||||
}
|
||||
|
||||
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications {
|
||||
throw new Error("Not Implemented Yet.");
|
||||
}
|
||||
|
||||
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications {
|
||||
throw new Error("Not Implemented Yet.");
|
||||
}
|
||||
|
||||
getProgram(): Program {
|
||||
throw new Error("SourceFile objects are not serializable through the server protocol.");
|
||||
}
|
||||
|
||||
@@ -305,6 +305,11 @@ module ts.server {
|
||||
return this.projectService.openFile(filename, false);
|
||||
}
|
||||
|
||||
getFileNameList() {
|
||||
let sourceFiles = this.program.getSourceFiles();
|
||||
return sourceFiles.map(sourceFile => sourceFile.fileName);
|
||||
}
|
||||
|
||||
getSourceFile(info: ScriptInfo) {
|
||||
return this.filenameToSourceFile[info.fileName];
|
||||
}
|
||||
@@ -398,7 +403,7 @@ module ts.server {
|
||||
|
||||
export class ProjectService {
|
||||
filenameToScriptInfo: ts.Map<ScriptInfo> = {};
|
||||
// open, non-configured root files
|
||||
// open, non-configured root files
|
||||
openFileRoots: ScriptInfo[] = [];
|
||||
// projects built from openFileRoots
|
||||
inferredProjects: Project[] = [];
|
||||
@@ -421,10 +426,10 @@ module ts.server {
|
||||
hostInfo: "Unknown host"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getFormatCodeOptions(file?: string) {
|
||||
if (file) {
|
||||
var info = this.filenameToScriptInfo[file];
|
||||
var info = this.filenameToScriptInfo[file];
|
||||
if (info) {
|
||||
return info.formatCodeOptions;
|
||||
}
|
||||
@@ -448,7 +453,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log(msg: string, type = "Err") {
|
||||
this.psLogger.msg(msg, type);
|
||||
}
|
||||
@@ -457,17 +462,17 @@ module ts.server {
|
||||
if (args.file) {
|
||||
var info = this.filenameToScriptInfo[args.file];
|
||||
if (info) {
|
||||
info.setFormatOptions(args.formatOptions);
|
||||
info.setFormatOptions(args.formatOptions);
|
||||
this.log("Host configuration update for file " + args.file, "Info");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (args.hostInfo !== undefined) {
|
||||
this.hostConfiguration.hostInfo = args.hostInfo;
|
||||
this.log("Host information " + args.hostInfo, "Info");
|
||||
this.log("Host information " + args.hostInfo, "Info");
|
||||
}
|
||||
if (args.formatOptions) {
|
||||
mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions);
|
||||
mergeFormatOptions(this.hostConfiguration.formatCodeOptions, args.formatOptions);
|
||||
this.log("Format host information updated", "Info");
|
||||
}
|
||||
}
|
||||
@@ -487,7 +492,7 @@ module ts.server {
|
||||
|
||||
fileDeletedInFilesystem(info: ScriptInfo) {
|
||||
this.psLogger.info(info.fileName + " deleted");
|
||||
|
||||
|
||||
if (info.fileWatcher) {
|
||||
info.fileWatcher.close();
|
||||
info.fileWatcher = undefined;
|
||||
@@ -537,7 +542,7 @@ module ts.server {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
addOpenFile(info: ScriptInfo) {
|
||||
if (this.setConfiguredProjectRoot(info)) {
|
||||
this.openFileRootsConfigured.push(info);
|
||||
@@ -561,7 +566,7 @@ module ts.server {
|
||||
copyListRemovingItem(r.defaultProject, this.inferredProjects);
|
||||
// put r in referenced open file list
|
||||
this.openFilesReferenced.push(r);
|
||||
// set default project of r to the new project
|
||||
// set default project of r to the new project
|
||||
r.defaultProject = info.defaultProject;
|
||||
}
|
||||
else {
|
||||
@@ -694,7 +699,7 @@ module ts.server {
|
||||
this.openFilesReferenced = openFilesReferenced;
|
||||
|
||||
// Then, loop through all of the open files that are project roots.
|
||||
// For each root file, note the project that it roots. Then see if
|
||||
// For each root file, note the project that it roots. Then see if
|
||||
// any other projects newly reference the file. If zero projects
|
||||
// newly reference the file, keep it as a root. If one or more
|
||||
// projects newly references the file, remove its project from the
|
||||
@@ -719,7 +724,7 @@ module ts.server {
|
||||
|
||||
// Finally, if we found any open, referenced files that are no longer
|
||||
// referenced by their default project, treat them as newly opened
|
||||
// by the editor.
|
||||
// by the editor.
|
||||
for (var i = 0, len = unattachedOpenFiles.length; i < len; i++) {
|
||||
this.addOpenFile(unattachedOpenFiles[i]);
|
||||
}
|
||||
@@ -750,6 +755,7 @@ module ts.server {
|
||||
if (content !== undefined) {
|
||||
var indentSize: number;
|
||||
info = new ScriptInfo(this.host, fileName, content, openedByClient);
|
||||
info.setFormatOptions(this.getFormatCodeOptions());
|
||||
this.filenameToScriptInfo[fileName] = info;
|
||||
if (!info.isOpen) {
|
||||
info.fileWatcher = this.host.watchFile(fileName, _ => { this.watchedFileChanged(fileName); });
|
||||
@@ -772,7 +778,7 @@ module ts.server {
|
||||
findConfigFile(searchPath: string): string {
|
||||
while (true) {
|
||||
var fileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
if (sys.fileExists(fileName)) {
|
||||
if (this.host.fileExists(fileName)) {
|
||||
return fileName;
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(searchPath);
|
||||
@@ -808,7 +814,7 @@ module ts.server {
|
||||
}
|
||||
else {
|
||||
this.log("Opened configuration file " + configFileName,"Info");
|
||||
this.configuredProjects.push(configResult.project);
|
||||
this.configuredProjects.push(configResult.project);
|
||||
}
|
||||
}
|
||||
var info = this.openFile(fileName, true);
|
||||
@@ -900,29 +906,29 @@ module ts.server {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult {
|
||||
configFilename = ts.normalizePath(configFilename);
|
||||
// file references will be relative to dirPath (or absolute)
|
||||
var dirPath = ts.getDirectoryPath(configFilename);
|
||||
var rawConfig = <ProjectOptions>ts.readConfigFile(configFilename);
|
||||
if (!rawConfig) {
|
||||
return { errorMsg: "tsconfig syntax error" };
|
||||
var rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.readConfigFile(configFilename);
|
||||
if (rawConfig.error) {
|
||||
return rawConfig.error;
|
||||
}
|
||||
else {
|
||||
var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath);
|
||||
var parsedCommandLine = ts.parseConfigFile(rawConfig.config, ts.sys, dirPath);
|
||||
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
|
||||
return { errorMsg: "tsconfig option errors" };
|
||||
}
|
||||
else if (parsedCommandLine.fileNames) {
|
||||
var projectOptions: ProjectOptions = {
|
||||
var projectOptions: ProjectOptions = {
|
||||
files: parsedCommandLine.fileNames,
|
||||
compilerOptions: parsedCommandLine.options
|
||||
};
|
||||
var proj = this.createProject(configFilename, projectOptions);
|
||||
for (var i = 0, len = parsedCommandLine.fileNames.length; i < len; i++) {
|
||||
var rootFilename = parsedCommandLine.fileNames[i];
|
||||
if (ts.sys.fileExists(rootFilename)) {
|
||||
if (this.host.fileExists(rootFilename)) {
|
||||
var info = this.openFile(rootFilename, clientFileName == rootFilename);
|
||||
proj.addRoot(info);
|
||||
}
|
||||
@@ -1039,7 +1045,7 @@ module ts.server {
|
||||
startPath: LineCollection[];
|
||||
endBranch: LineCollection[] = [];
|
||||
branchNode: LineNode;
|
||||
// path to current node
|
||||
// path to current node
|
||||
stack: LineNode[];
|
||||
state = CharRangeSection.Entire;
|
||||
lineCollectionAtBranch: LineCollection;
|
||||
@@ -1241,7 +1247,7 @@ module ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
// text change information
|
||||
// text change information
|
||||
class TextChange {
|
||||
constructor(public pos: number, public deleteLen: number, public insertedText?: string) {
|
||||
}
|
||||
@@ -1289,7 +1295,7 @@ module ts.server {
|
||||
if (cb)
|
||||
cb();
|
||||
}
|
||||
|
||||
|
||||
// reload whole script, leaving no change history behind reload
|
||||
reload(script: string) {
|
||||
this.currentVersion++;
|
||||
@@ -1299,7 +1305,7 @@ module ts.server {
|
||||
snap.index = new LineIndex();
|
||||
var lm = LineIndex.linesFromText(script);
|
||||
snap.index.load(lm.lines);
|
||||
// REVIEW: could use linked list
|
||||
// REVIEW: could use linked list
|
||||
for (var i = this.minVersion; i < this.currentVersion; i++) {
|
||||
this.versions[i] = undefined;
|
||||
}
|
||||
@@ -1380,7 +1386,7 @@ module ts.server {
|
||||
return this.index.root.charCount();
|
||||
}
|
||||
|
||||
// this requires linear space so don't hold on to these
|
||||
// this requires linear space so don't hold on to these
|
||||
getLineStartPositions(): number[] {
|
||||
var starts: number[] = [-1];
|
||||
var count = 1;
|
||||
@@ -1642,7 +1648,7 @@ module ts.server {
|
||||
}
|
||||
|
||||
walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) {
|
||||
// assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
|
||||
// assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
|
||||
var childIndex = 0;
|
||||
var child = this.children[0];
|
||||
var childCharCount = child.charCount();
|
||||
@@ -1728,7 +1734,7 @@ module ts.server {
|
||||
line: lineNumber,
|
||||
offset: charOffset
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (childInfo.child.isLeaf()) {
|
||||
return {
|
||||
line: lineNumber,
|
||||
@@ -1916,4 +1922,4 @@ module ts.server {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+54
@@ -87,6 +87,45 @@ declare module ts.server.protocol {
|
||||
file: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arguments for ProjectInfoRequest request.
|
||||
*/
|
||||
export interface ProjectInfoRequestArgs extends FileRequestArgs {
|
||||
/**
|
||||
* Indicate if the file name list of the project is needed
|
||||
*/
|
||||
needFileNameList: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A request to get the project information of the current file
|
||||
*/
|
||||
export interface ProjectInfoRequest extends Request {
|
||||
arguments: ProjectInfoRequestArgs
|
||||
}
|
||||
|
||||
/**
|
||||
* Response message body for "projectInfo" request
|
||||
*/
|
||||
export interface ProjectInfo {
|
||||
/**
|
||||
* For configured project, this is the normalized path of the 'tsconfig.json' file
|
||||
* For inferred project, this is undefined
|
||||
*/
|
||||
configFileName: string;
|
||||
/**
|
||||
* The list of normalized file name in the project, including 'lib.d.ts'
|
||||
*/
|
||||
fileNameList?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Response message for "projectInfo" request
|
||||
*/
|
||||
export interface ProjectInfoResponse extends Response {
|
||||
body?: ProjectInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request whose sole parameter is a file name.
|
||||
*/
|
||||
@@ -125,6 +164,14 @@ declare module ts.server.protocol {
|
||||
export interface DefinitionRequest extends FileLocationRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Go to type request; value of command field is
|
||||
* "typeDefinition". Return response giving the file locations that
|
||||
* define the type for the symbol found in file at location line, col.
|
||||
*/
|
||||
export interface TypeDefinitionRequest extends FileLocationRequest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Location in source code expressed as (one-based) line and character offset.
|
||||
*/
|
||||
@@ -165,6 +212,13 @@ declare module ts.server.protocol {
|
||||
body?: FileSpan[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Definition response message. Gives text range for definition.
|
||||
*/
|
||||
export interface TypeDefinitionResponse extends Response {
|
||||
body?: FileSpan[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get occurrences request; value of command field is
|
||||
* "occurrences". Return response giving spans that are relevant
|
||||
|
||||
+73
-24
@@ -76,28 +76,30 @@ module ts.server {
|
||||
}
|
||||
|
||||
export module CommandNames {
|
||||
export var Brace = "brace";
|
||||
export var Change = "change";
|
||||
export var Close = "close";
|
||||
export var Completions = "completions";
|
||||
export var CompletionDetails = "completionEntryDetails";
|
||||
export var Configure = "configure";
|
||||
export var Definition = "definition";
|
||||
export var Exit = "exit";
|
||||
export var Format = "format";
|
||||
export var Formatonkey = "formatonkey";
|
||||
export var Geterr = "geterr";
|
||||
export var NavBar = "navbar";
|
||||
export var Navto = "navto";
|
||||
export var Occurrences = "occurrences";
|
||||
export var Open = "open";
|
||||
export var Quickinfo = "quickinfo";
|
||||
export var References = "references";
|
||||
export var Reload = "reload";
|
||||
export var Rename = "rename";
|
||||
export var Saveto = "saveto";
|
||||
export var SignatureHelp = "signatureHelp";
|
||||
export var Unknown = "unknown";
|
||||
export const Brace = "brace";
|
||||
export const Change = "change";
|
||||
export const Close = "close";
|
||||
export const Completions = "completions";
|
||||
export const CompletionDetails = "completionEntryDetails";
|
||||
export const Configure = "configure";
|
||||
export const Definition = "definition";
|
||||
export const Exit = "exit";
|
||||
export const Format = "format";
|
||||
export const Formatonkey = "formatonkey";
|
||||
export const Geterr = "geterr";
|
||||
export const NavBar = "navbar";
|
||||
export const Navto = "navto";
|
||||
export const Occurrences = "occurrences";
|
||||
export const Open = "open";
|
||||
export const Quickinfo = "quickinfo";
|
||||
export const References = "references";
|
||||
export const Reload = "reload";
|
||||
export const Rename = "rename";
|
||||
export const Saveto = "saveto";
|
||||
export const SignatureHelp = "signatureHelp";
|
||||
export const TypeDefinition = "typeDefinition";
|
||||
export const ProjectInfo = "projectInfo";
|
||||
export const Unknown = "unknown";
|
||||
}
|
||||
|
||||
module Errors {
|
||||
@@ -285,7 +287,29 @@ module ts.server {
|
||||
}));
|
||||
}
|
||||
|
||||
getOccurrences(line: number, offset: number, fileName: string): protocol.OccurrencesResponseItem[] {
|
||||
getTypeDefinition(line: number, offset: number, fileName: string): protocol.FileSpan[] {
|
||||
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 definitions = compilerService.languageService.getTypeDefinitionAtPosition(file, position);
|
||||
if (!definitions) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return definitions.map(def => ({
|
||||
file: def.fileName,
|
||||
start: compilerService.host.positionToLineOffset(def.fileName, def.textSpan.start),
|
||||
end: compilerService.host.positionToLineOffset(def.fileName, ts.textSpanEnd(def.textSpan))
|
||||
}));
|
||||
}
|
||||
|
||||
getOccurrences(line: number, offset: number, fileName: string): protocol.OccurrencesResponseItem[]{
|
||||
fileName = ts.normalizePath(fileName);
|
||||
let project = this.projectService.getProjectForFile(fileName);
|
||||
|
||||
@@ -315,6 +339,21 @@ module ts.server {
|
||||
});
|
||||
}
|
||||
|
||||
getProjectInfo(fileName: string, needFileNameList: boolean): protocol.ProjectInfo {
|
||||
fileName = ts.normalizePath(fileName)
|
||||
let project = this.projectService.getProjectForFile(fileName)
|
||||
|
||||
let projectInfo: protocol.ProjectInfo = {
|
||||
configFileName: project.projectFilename
|
||||
}
|
||||
|
||||
if (needFileNameList) {
|
||||
projectInfo.fileNameList = project.getFileNameList();
|
||||
}
|
||||
|
||||
return projectInfo;
|
||||
}
|
||||
|
||||
getRenameLocations(line: number, offset: number, fileName: string,findInComments: boolean, findInStrings: boolean): protocol.RenameResponseBody {
|
||||
var file = ts.normalizePath(fileName);
|
||||
var project = this.projectService.getProjectForFile(file);
|
||||
@@ -519,7 +558,7 @@ module ts.server {
|
||||
IndentSize: formatOptions.IndentSize,
|
||||
TabSize: formatOptions.TabSize,
|
||||
NewLineCharacter: "\n",
|
||||
ConvertTabsToSpaces: true,
|
||||
ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces,
|
||||
};
|
||||
var indentPosition =
|
||||
compilerService.languageService.getIndentationAtPosition(file, position, editorOptions);
|
||||
@@ -817,6 +856,11 @@ module ts.server {
|
||||
response = this.getDefinition(defArgs.line, defArgs.offset, defArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.TypeDefinition: {
|
||||
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getTypeDefinition(defArgs.line, defArgs.offset, defArgs.file);
|
||||
break;
|
||||
}
|
||||
case CommandNames.References: {
|
||||
var refArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getReferences(refArgs.line, refArgs.offset, refArgs.file);
|
||||
@@ -923,6 +967,11 @@ module ts.server {
|
||||
response = this.getOccurrences(line, offset, fileName);
|
||||
break;
|
||||
}
|
||||
case CommandNames.ProjectInfo: {
|
||||
var { file, needFileNameList } = <protocol.ProjectInfoRequestArgs>request.arguments;
|
||||
response = this.getProjectInfo(file, needFileNameList);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this.projectService.log("Unrecognized JSON command: " + message);
|
||||
this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command);
|
||||
|
||||
@@ -446,14 +446,14 @@ module ts.BreakpointResolver {
|
||||
// fall through.
|
||||
|
||||
case SyntaxKind.CatchClause:
|
||||
return spanInNode((<Block>node.parent).statements[(<Block>node.parent).statements.length - 1]);;
|
||||
return spanInNode(lastOrUndefined((<Block>node.parent).statements));;
|
||||
|
||||
case SyntaxKind.CaseBlock:
|
||||
// breakpoint in last statement of the last clause
|
||||
let caseBlock = <CaseBlock>node.parent;
|
||||
let lastClause = caseBlock.clauses[caseBlock.clauses.length - 1];
|
||||
let lastClause = lastOrUndefined(caseBlock.clauses);
|
||||
if (lastClause) {
|
||||
return spanInNode(lastClause.statements[lastClause.statements.length - 1]);
|
||||
return spanInNode(lastOrUndefined(lastClause.statements));
|
||||
}
|
||||
return undefined;
|
||||
|
||||
|
||||
@@ -323,6 +323,9 @@ module ts.formatting {
|
||||
let previousParent: Node;
|
||||
let previousRangeStartLine: number;
|
||||
|
||||
let lastIndentedLine: number;
|
||||
let indentationOnLastIndentedLine: number;
|
||||
|
||||
let edits: TextChange[] = [];
|
||||
|
||||
formattingScanner.advance();
|
||||
@@ -416,7 +419,9 @@ module ts.formatting {
|
||||
// if node is located on the same line with the parent
|
||||
// - inherit indentation from the parent
|
||||
// - push children if either parent of node itself has non-zero delta
|
||||
indentation = parentDynamicIndentation.getIndentation();
|
||||
indentation = startLine === lastIndentedLine
|
||||
? indentationOnLastIndentedLine
|
||||
: parentDynamicIndentation.getIndentation();
|
||||
delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta);
|
||||
}
|
||||
return {
|
||||
@@ -716,7 +721,6 @@ module ts.formatting {
|
||||
continue;
|
||||
}
|
||||
|
||||
let triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line;
|
||||
switch (triviaItem.kind) {
|
||||
case SyntaxKind.MultiLineCommentTrivia:
|
||||
let commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind);
|
||||
@@ -741,6 +745,9 @@ module ts.formatting {
|
||||
if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) {
|
||||
let tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind);
|
||||
insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded);
|
||||
|
||||
lastIndentedLine = tokenStart.line;
|
||||
indentationOnLastIndentedLine = tokenIndentation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ module ts.formatting {
|
||||
if (isStarted) {
|
||||
if (trailingTrivia) {
|
||||
Debug.assert(trailingTrivia.length !== 0);
|
||||
wasNewLine = trailingTrivia[trailingTrivia.length - 1].kind === SyntaxKind.NewLineTrivia;
|
||||
wasNewLine = lastOrUndefined(trailingTrivia).kind === SyntaxKind.NewLineTrivia;
|
||||
}
|
||||
else {
|
||||
wasNewLine = false;
|
||||
|
||||
@@ -193,12 +193,18 @@ module ts.formatting {
|
||||
// Insert space after function keyword for anonymous functions
|
||||
public SpaceAfterAnonymousFunctionKeyword: Rule;
|
||||
public NoSpaceAfterAnonymousFunctionKeyword: Rule;
|
||||
|
||||
|
||||
// Insert space after @ in decorator
|
||||
public SpaceBeforeAt: Rule;
|
||||
public NoSpaceAfterAt: Rule;
|
||||
public SpaceAfterDecorator: Rule;
|
||||
|
||||
// Generator: function*
|
||||
public NoSpaceBetweenFunctionKeywordAndStar: Rule;
|
||||
public SpaceAfterStarInGeneratorDeclaration: Rule;
|
||||
public NoSpaceBetweenYieldKeywordAndStar: Rule;
|
||||
public SpaceBetweenYieldOrYieldStarAndOperand: Rule;
|
||||
|
||||
constructor() {
|
||||
///
|
||||
/// Common Rules
|
||||
@@ -231,7 +237,7 @@ module ts.formatting {
|
||||
this.NoSpaceBeforeOpenBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||
this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), RuleAction.Delete));
|
||||
|
||||
// Place a space before open brace in a function declaration
|
||||
this.FunctionOpenBraceLeftTokenRange = Shared.TokenRange.AnyIncludingMultilineComments;
|
||||
@@ -340,6 +346,11 @@ module ts.formatting {
|
||||
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));
|
||||
|
||||
this.NoSpaceBetweenFunctionKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), RuleAction.Delete));
|
||||
this.SpaceAfterStarInGeneratorDeclaration = new Rule(RuleDescriptor.create3(SyntaxKind.AsteriskToken, Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), RuleAction.Space));
|
||||
this.NoSpaceBetweenYieldKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Delete));
|
||||
this.SpaceBetweenYieldOrYieldStarAndOperand = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Space));
|
||||
|
||||
// These rules are higher in priority than user-configurable rules.
|
||||
this.HighPriorityCommonRules =
|
||||
[
|
||||
@@ -357,7 +368,9 @@ module ts.formatting {
|
||||
this.NoSpaceAfterCloseBrace,
|
||||
this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext,
|
||||
this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets,
|
||||
this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration,
|
||||
this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember,
|
||||
this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand,
|
||||
this.NoSpaceBetweenReturnAndSemicolon,
|
||||
this.SpaceAfterCertainKeywords,
|
||||
this.SpaceAfterLetConstInVariableDeclaration,
|
||||
@@ -574,6 +587,10 @@ module ts.formatting {
|
||||
return false;
|
||||
}
|
||||
|
||||
static IsFunctionDeclarationOrFunctionExpressionContext(context: FormattingContext): boolean {
|
||||
return context.contextNode.kind === SyntaxKind.FunctionDeclaration || context.contextNode.kind === SyntaxKind.FunctionExpression;
|
||||
}
|
||||
|
||||
static IsTypeScriptDeclWithBlockContext(context: FormattingContext): boolean {
|
||||
return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode);
|
||||
}
|
||||
@@ -650,6 +667,10 @@ module ts.formatting {
|
||||
return context.TokensAreOnSameLine();
|
||||
}
|
||||
|
||||
static IsNotBeforeBlockInFunctionDeclarationContext(context: FormattingContext): boolean {
|
||||
return !Rules.IsFunctionDeclContext(context) && !Rules.IsBeforeBlockContext(context)
|
||||
}
|
||||
|
||||
static IsEndOfDecoratorContextOnSameLine(context: FormattingContext): boolean {
|
||||
return context.TokensAreOnSameLine() &&
|
||||
context.contextNode.decorators &&
|
||||
@@ -713,5 +734,9 @@ module ts.formatting {
|
||||
static IsVoidOpContext(context: FormattingContext): boolean {
|
||||
return context.currentTokenSpan.kind === SyntaxKind.VoidKeyword && context.currentTokenParent.kind === SyntaxKind.VoidExpression;
|
||||
}
|
||||
|
||||
static IsYieldOrYieldStarWithOperand(context: FormattingContext): boolean {
|
||||
return context.contextNode.kind === SyntaxKind.YieldExpression && (<YieldExpression>context.contextNode).expression !== undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
+623
-235
File diff suppressed because it is too large
Load Diff
+114
-32
@@ -1,6 +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
|
||||
@@ -55,6 +55,8 @@ module ts {
|
||||
getCurrentDirectory(): string;
|
||||
getDefaultLibFileName(options: string): string;
|
||||
getNewLine?(): string;
|
||||
getProjectVersion?(): string;
|
||||
useCaseSensitiveFileNames?(): boolean;
|
||||
}
|
||||
|
||||
/** Public interface of the the of a config service shim instance.*/
|
||||
@@ -83,7 +85,7 @@ module ts {
|
||||
export interface Shim {
|
||||
dispose(dummy: any): void;
|
||||
}
|
||||
|
||||
|
||||
export interface LanguageServiceShim extends Shim {
|
||||
languageService: LanguageService;
|
||||
|
||||
@@ -99,6 +101,8 @@ module ts {
|
||||
|
||||
getSyntacticClassifications(fileName: string, start: number, length: number): string;
|
||||
getSemanticClassifications(fileName: string, start: number, length: number): string;
|
||||
getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string;
|
||||
getEncodedSemanticClassifications(fileName: string, start: number, length: number): string;
|
||||
|
||||
getCompletionsAtPosition(fileName: string, position: number): string;
|
||||
getCompletionEntryDetails(fileName: string, position: number, entryName: string): string;
|
||||
@@ -130,12 +134,20 @@ module ts {
|
||||
*/
|
||||
getDefinitionAtPosition(fileName: string, position: number): string;
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { fileName: string; textSpan: { start: number; length: number}; kind: string; name: string; containerKind: string; containerName: string }
|
||||
*
|
||||
* Or undefined value if no definition can be found.
|
||||
*/
|
||||
getTypeDefinitionAtPosition(fileName: string, position: number): string;
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean }[]
|
||||
*/
|
||||
getReferencesAtPosition(fileName: string, position: number): string;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a JSON-encoded value of the type:
|
||||
* { definition: <encoded>; references: <encoded>[] }[]
|
||||
@@ -152,8 +164,8 @@ module ts {
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @param fileToSearch A JSON encoded string[] containing the file names that should be
|
||||
* considered when searching.
|
||||
*/
|
||||
getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string;
|
||||
@@ -189,6 +201,7 @@ module ts {
|
||||
}
|
||||
|
||||
export interface ClassifierShim extends Shim {
|
||||
getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string;
|
||||
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string;
|
||||
}
|
||||
|
||||
@@ -199,7 +212,9 @@ module ts {
|
||||
}
|
||||
|
||||
function logInternalError(logger: Logger, err: Error) {
|
||||
logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message);
|
||||
if (logger) {
|
||||
logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
class ScriptSnapshotShimAdapter implements IScriptSnapshot {
|
||||
@@ -231,7 +246,7 @@ module ts {
|
||||
|
||||
export class LanguageServiceShimHostAdapter implements LanguageServiceHost {
|
||||
private files: string[];
|
||||
|
||||
|
||||
constructor(private shimHost: LanguageServiceShimHost) {
|
||||
}
|
||||
|
||||
@@ -242,11 +257,24 @@ module ts {
|
||||
public trace(s: string): void {
|
||||
this.shimHost.trace(s);
|
||||
}
|
||||
|
||||
|
||||
public error(s: string): void {
|
||||
this.shimHost.error(s);
|
||||
}
|
||||
|
||||
public getProjectVersion(): string {
|
||||
if (!this.shimHost.getProjectVersion) {
|
||||
// shimmed host does not support getProjectVersion
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return this.shimHost.getProjectVersion();
|
||||
}
|
||||
|
||||
public useCaseSensitiveFileNames(): boolean {
|
||||
return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false;
|
||||
}
|
||||
|
||||
public getCompilationSettings(): CompilerOptions {
|
||||
var settingsJson = this.shimHost.getCompilationSettings();
|
||||
if (settingsJson == null || settingsJson == "") {
|
||||
@@ -309,7 +337,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class CoreServicesShimHostAdapter implements ParseConfigHost {
|
||||
|
||||
constructor(private shimHost: CoreServicesShimHost) {
|
||||
@@ -321,25 +349,32 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any): any {
|
||||
logger.log(actionDescription);
|
||||
var start = Date.now();
|
||||
var result = action();
|
||||
var end = Date.now();
|
||||
logger.log(actionDescription + " completed in " + (end - start) + " msec");
|
||||
if (typeof (result) === "string") {
|
||||
var str = <string>result;
|
||||
if (str.length > 128) {
|
||||
str = str.substring(0, 128) + "...";
|
||||
}
|
||||
logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'");
|
||||
function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any, noPerfLogging: boolean): any {
|
||||
if (!noPerfLogging) {
|
||||
logger.log(actionDescription);
|
||||
var start = Date.now();
|
||||
}
|
||||
|
||||
var result = action();
|
||||
|
||||
if (!noPerfLogging) {
|
||||
var end = Date.now();
|
||||
logger.log(actionDescription + " completed in " + (end - start) + " msec");
|
||||
if (typeof (result) === "string") {
|
||||
var str = <string>result;
|
||||
if (str.length > 128) {
|
||||
str = str.substring(0, 128) + "...";
|
||||
}
|
||||
logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function forwardJSONCall(logger: Logger, actionDescription: string, action: () => any): string {
|
||||
function forwardJSONCall(logger: Logger, actionDescription: string, action: () => any, noPerfLogging: boolean): string {
|
||||
try {
|
||||
var result = simpleForwardCall(logger, actionDescription, action);
|
||||
var result = simpleForwardCall(logger, actionDescription, action, noPerfLogging);
|
||||
return JSON.stringify({ result: result });
|
||||
}
|
||||
catch (err) {
|
||||
@@ -387,7 +422,7 @@ module ts {
|
||||
}
|
||||
|
||||
public forwardJSONCall(actionDescription: string, action: () => any): string {
|
||||
return forwardJSONCall(this.logger, actionDescription, action);
|
||||
return forwardJSONCall(this.logger, actionDescription, action, /*noPerfLogging:*/ false);
|
||||
}
|
||||
|
||||
/// DISPOSE
|
||||
@@ -457,6 +492,26 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
public getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string {
|
||||
return this.forwardJSONCall(
|
||||
"getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")",
|
||||
() => {
|
||||
// directly serialize the spans out to a string. This is much faster to decode
|
||||
// on the managed side versus a full JSON array.
|
||||
return convertClassifications(this.languageService.getEncodedSyntacticClassifications(fileName, createTextSpan(start, length)));
|
||||
});
|
||||
}
|
||||
|
||||
public getEncodedSemanticClassifications(fileName: string, start: number, length: number): string {
|
||||
return this.forwardJSONCall(
|
||||
"getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")",
|
||||
() => {
|
||||
// directly serialize the spans out to a string. This is much faster to decode
|
||||
// on the managed side versus a full JSON array.
|
||||
return convertClassifications(this.languageService.getEncodedSemanticClassifications(fileName, createTextSpan(start, length)));
|
||||
});
|
||||
}
|
||||
|
||||
private getNewLine(): string {
|
||||
return this.host.getNewLine ? this.host.getNewLine() : "\r\n";
|
||||
}
|
||||
@@ -547,7 +602,7 @@ module ts {
|
||||
|
||||
/**
|
||||
* Computes the definition location and file for the symbol
|
||||
* at the requested position.
|
||||
* at the requested position.
|
||||
*/
|
||||
public getDefinitionAtPosition(fileName: string, position: number): string {
|
||||
return this.forwardJSONCall(
|
||||
@@ -557,6 +612,20 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
/// GOTO Type
|
||||
|
||||
/**
|
||||
* Computes the definition location of the type of the symbol
|
||||
* at the requested position.
|
||||
*/
|
||||
public getTypeDefinitionAtPosition(fileName: string, position: number): string {
|
||||
return this.forwardJSONCall(
|
||||
"getTypeDefinitionAtPosition('" + fileName + "', " + position + ")",
|
||||
() => {
|
||||
return this.languageService.getTypeDefinitionAtPosition(fileName, position);
|
||||
});
|
||||
}
|
||||
|
||||
public getRenameInfo(fileName: string, position: number): string {
|
||||
return this.forwardJSONCall(
|
||||
"getRenameInfo('" + fileName + "', " + position + ")",
|
||||
@@ -630,8 +699,8 @@ module ts {
|
||||
/// COMPLETION LISTS
|
||||
|
||||
/**
|
||||
* Get a string based representation of the completions
|
||||
* to provide at the given source position and providing a member completion
|
||||
* Get a string based representation of the completions
|
||||
* to provide at the given source position and providing a member completion
|
||||
* list if requested.
|
||||
*/
|
||||
public getCompletionsAtPosition(fileName: string, position: number) {
|
||||
@@ -736,14 +805,24 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function convertClassifications(classifications: Classifications): { spans: string, endOfLineState: EndOfLineState } {
|
||||
return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState };
|
||||
}
|
||||
|
||||
class ClassifierShimObject extends ShimBase implements ClassifierShim {
|
||||
public classifier: Classifier;
|
||||
|
||||
constructor(factory: ShimFactory) {
|
||||
constructor(factory: ShimFactory, private logger: Logger) {
|
||||
super(factory);
|
||||
this.classifier = createClassifier();
|
||||
}
|
||||
|
||||
public getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string {
|
||||
return forwardJSONCall(this.logger, "getEncodedLexicalClassifications",
|
||||
() => convertClassifications(this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)),
|
||||
/*noPerfLogging:*/ true);
|
||||
}
|
||||
|
||||
/// COLORIZATION
|
||||
public getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): string {
|
||||
var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics);
|
||||
@@ -765,7 +844,7 @@ module ts {
|
||||
}
|
||||
|
||||
private forwardJSONCall(actionDescription: string, action: () => any): any {
|
||||
return forwardJSONCall(this.logger, actionDescription, action);
|
||||
return forwardJSONCall(this.logger, actionDescription, action, /*noPerfLogging:*/ false);
|
||||
}
|
||||
|
||||
public getPreProcessedFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string {
|
||||
@@ -835,7 +914,7 @@ module ts {
|
||||
|
||||
export class TypeScriptServicesFactory implements ShimFactory {
|
||||
private _shims: Shim[] = [];
|
||||
private documentRegistry: DocumentRegistry = createDocumentRegistry();
|
||||
private documentRegistry: DocumentRegistry;
|
||||
|
||||
/*
|
||||
* Returns script API version.
|
||||
@@ -846,6 +925,9 @@ module ts {
|
||||
|
||||
public createLanguageServiceShim(host: LanguageServiceShimHost): LanguageServiceShim {
|
||||
try {
|
||||
if (this.documentRegistry === undefined) {
|
||||
this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
||||
}
|
||||
var hostAdapter = new LanguageServiceShimHostAdapter(host);
|
||||
var languageService = createLanguageService(hostAdapter, this.documentRegistry);
|
||||
return new LanguageServiceShimObject(this, host, languageService);
|
||||
@@ -858,7 +940,7 @@ module ts {
|
||||
|
||||
public createClassifierShim(logger: Logger): ClassifierShim {
|
||||
try {
|
||||
return new ClassifierShimObject(this);
|
||||
return new ClassifierShimObject(this, logger);
|
||||
}
|
||||
catch (err) {
|
||||
logInternalError(logger, err);
|
||||
@@ -915,4 +997,4 @@ module TypeScript.Services {
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
let toolsVersion = "1.4";
|
||||
let toolsVersion = "1.5";
|
||||
|
||||
@@ -200,7 +200,7 @@ module ts {
|
||||
function nodeEndsWith(n: Node, expectedLastToken: SyntaxKind, sourceFile: SourceFile): boolean {
|
||||
let children = n.getChildren(sourceFile);
|
||||
if (children.length) {
|
||||
let last = children[children.length - 1];
|
||||
let last = lastOrUndefined(children);
|
||||
if (last.kind === expectedLastToken) {
|
||||
return true;
|
||||
}
|
||||
@@ -652,8 +652,4 @@ module ts {
|
||||
typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);
|
||||
});
|
||||
}
|
||||
|
||||
export function isJavaScript(fileName: string) {
|
||||
return fileExtensionIs(fileName, ".js");
|
||||
}
|
||||
}
|
||||
@@ -1,67 +1,67 @@
|
||||
//// [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;
|
||||
declare var console: any;
|
||||
declare var readFileSync: any;
|
||||
|
||||
import * as ts from "typescript";
|
||||
|
||||
export function delint(sourceFile: ts.SourceFile) {
|
||||
delintNode(sourceFile);
|
||||
|
||||
function delintNode(node: ts.Node) {
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.ForStatement:
|
||||
case ts.SyntaxKind.ForInStatement:
|
||||
case ts.SyntaxKind.WhileStatement:
|
||||
case ts.SyntaxKind.DoStatement:
|
||||
if ((<ts.IterationStatement>node).statement.kind !== ts.SyntaxKind.Block) {
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.IfStatement:
|
||||
let ifStatement = (<ts.IfStatement>node);
|
||||
if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) {
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
ifStatement.elseStatement.kind !== ts.SyntaxKind.Block &&
|
||||
ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.BinaryExpression:
|
||||
let op = (<ts.BinaryExpression>node).operatorToken.kind;
|
||||
if (op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken) {
|
||||
report(node, "Use '===' and '!=='.")
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ts.forEachChild(node, delintNode);
|
||||
}
|
||||
|
||||
function report(node: ts.Node, message: string) {
|
||||
let { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
||||
console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
const fileNames = process.argv.slice(2);
|
||||
fileNames.forEach(fileName => {
|
||||
// Parse a file
|
||||
let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true);
|
||||
|
||||
// delint it
|
||||
delint(sourceFile);
|
||||
|
||||
/*
|
||||
* 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;
|
||||
declare var console: any;
|
||||
declare var readFileSync: any;
|
||||
|
||||
import * as ts from "typescript";
|
||||
|
||||
export function delint(sourceFile: ts.SourceFile) {
|
||||
delintNode(sourceFile);
|
||||
|
||||
function delintNode(node: ts.Node) {
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.ForStatement:
|
||||
case ts.SyntaxKind.ForInStatement:
|
||||
case ts.SyntaxKind.WhileStatement:
|
||||
case ts.SyntaxKind.DoStatement:
|
||||
if ((<ts.IterationStatement>node).statement.kind !== ts.SyntaxKind.Block) {
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.IfStatement:
|
||||
let ifStatement = (<ts.IfStatement>node);
|
||||
if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) {
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
ifStatement.elseStatement.kind !== ts.SyntaxKind.Block &&
|
||||
ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) {
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.BinaryExpression:
|
||||
let op = (<ts.BinaryExpression>node).operatorToken.kind;
|
||||
if (op === ts.SyntaxKind.EqualsEqualsToken || op == ts.SyntaxKind.ExclamationEqualsToken) {
|
||||
report(node, "Use '===' and '!=='.")
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ts.forEachChild(node, delintNode);
|
||||
}
|
||||
|
||||
function report(node: ts.Node, message: string) {
|
||||
let { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
||||
console.log(`${sourceFile.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
const fileNames = process.argv.slice(2);
|
||||
fileNames.forEach(fileName => {
|
||||
// Parse a file
|
||||
let sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true);
|
||||
|
||||
// delint it
|
||||
delint(sourceFile);
|
||||
});
|
||||
|
||||
//// [APISample_linter.js]
|
||||
@@ -75,26 +75,26 @@ function delint(sourceFile) {
|
||||
delintNode(sourceFile);
|
||||
function delintNode(node) {
|
||||
switch (node.kind) {
|
||||
case 188 /* ForStatement */:
|
||||
case 189 /* ForInStatement */:
|
||||
case 187 /* WhileStatement */:
|
||||
case 186 /* DoStatement */:
|
||||
if (node.statement.kind !== 181 /* Block */) {
|
||||
case 189 /* ForStatement */:
|
||||
case 190 /* ForInStatement */:
|
||||
case 188 /* WhileStatement */:
|
||||
case 187 /* DoStatement */:
|
||||
if (node.statement.kind !== 182 /* Block */) {
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 185 /* IfStatement */:
|
||||
case 186 /* IfStatement */:
|
||||
var ifStatement = node;
|
||||
if (ifStatement.thenStatement.kind !== 181 /* Block */) {
|
||||
if (ifStatement.thenStatement.kind !== 182 /* Block */) {
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
ifStatement.elseStatement.kind !== 181 /* Block */ &&
|
||||
ifStatement.elseStatement.kind !== 185 /* IfStatement */) {
|
||||
ifStatement.elseStatement.kind !== 182 /* Block */ &&
|
||||
ifStatement.elseStatement.kind !== 186 /* IfStatement */) {
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 171 /* BinaryExpression */:
|
||||
case 172 /* BinaryExpression */:
|
||||
var op = node.operatorToken.kind;
|
||||
if (op === 28 /* EqualsEqualsToken */ || op == 29 /* ExclamationEqualsToken */) {
|
||||
report(node, "Use '===' and '!=='.");
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,13): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,14): error TS1110: Type expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts (1 errors) ====
|
||||
var v = (a): => {
|
||||
|
||||
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
~~
|
||||
!!! error TS1110: Type expected.
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ for (let v of []) {
|
||||
for (var _i = 0, _a = []; _i < _a.length; _i++) {
|
||||
var v = _a[_i];
|
||||
v;
|
||||
for (var _b = 0, _c = [v]; _b < _c.length; _b++) {
|
||||
for (var _b = 0, _c = [v_1]; _b < _c.length; _b++) {
|
||||
var v_1 = _c[_b];
|
||||
var x = v_1;
|
||||
v_1++;
|
||||
|
||||
@@ -10,7 +10,7 @@ for (let v of []) {
|
||||
for (var _i = 0, _a = []; _i < _a.length; _i++) {
|
||||
var v = _a[_i];
|
||||
var v_1;
|
||||
for (var _b = 0, _c = [v]; _b < _c.length; _b++) {
|
||||
for (var _b = 0, _c = [v_2]; _b < _c.length; _b++) {
|
||||
var v_2 = _c[_b];
|
||||
var v_3;
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ module A {
|
||||
|
||||
|
||||
//// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ module A {
|
||||
|
||||
|
||||
//// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js]
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
|
||||
-1
@@ -16,6 +16,5 @@ var A;
|
||||
}
|
||||
return B;
|
||||
})();
|
||||
A.beez;
|
||||
A.beez2 = new Array();
|
||||
})(A || (A = {}));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (1 errors) ====
|
||||
function * foo(a = yield => yield) {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts (1 errors) ====
|
||||
function * yield() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (2 errors) ====
|
||||
function * foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
// Legal to use 'yield' in a type context.
|
||||
var v: yield;
|
||||
~~~~~
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts (1 errors) ====
|
||||
function * foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (2 errors) ====
|
||||
function*foo(a = yield) {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,11): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,11): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2304: Cannot find name 'yield'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (3 errors) ====
|
||||
function*bar() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
// 'yield' here is an identifier, and not a yield expression.
|
||||
function*foo(a = yield) {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,14): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (1 errors) ====
|
||||
function * foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
var v = { [yield]: foo }
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts(1,18): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts(1,18): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts (1 errors) ====
|
||||
var v = function * () { }
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts(1,18): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts(1,18): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts (1 errors) ====
|
||||
var v = function * foo() { }
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts(1,11): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts(1,11): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts (1 errors) ====
|
||||
var v = { *foo() { } }
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ====
|
||||
var v = { *[foo()]() { } }
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts(2,4): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts(2,4): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts (1 errors) ====
|
||||
class C {
|
||||
*foo() { }
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts(2,11): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts(2,11): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts (1 errors) ====
|
||||
class C {
|
||||
public * foo() { }
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,6): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration
|
||||
class C {
|
||||
*[foo]() { }
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts(2,4): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts(2,4): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts (1 errors) ====
|
||||
class C {
|
||||
*foo<T>() { }
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(3,8): error TS1123: Variable declaration list cannot be empty.
|
||||
tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(4,5): error TS2304: Cannot find name 'let'.
|
||||
tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts(5,10): error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
|
||||
==== tests/cases/conformance/internalModules/exportDeclarations/NonInitializedExportInInternalModule.ts (3 errors) ====
|
||||
|
||||
module Inner {
|
||||
var;
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
let;
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'let'.
|
||||
const;
|
||||
|
||||
!!! error TS1123: Variable declaration list cannot be empty.
|
||||
|
||||
export var a;
|
||||
export let b;
|
||||
export var c: string;
|
||||
export let d: number;
|
||||
class A {}
|
||||
export var e: A;
|
||||
export let f: A;
|
||||
|
||||
namespace B {
|
||||
export let a = 1, b, c = 2;
|
||||
export let x, y, z;
|
||||
}
|
||||
|
||||
module C {
|
||||
export var a = 1, b, c = 2;
|
||||
export var x, y, z;
|
||||
}
|
||||
|
||||
// Shouldn't be filtered
|
||||
export var a1 = 1;
|
||||
export let b1 = 1;
|
||||
export var c1: string = 'a';
|
||||
export let d1: number = 1;
|
||||
class D {}
|
||||
export var e1 = new D;
|
||||
export let f1 = new D;
|
||||
export var g1: D = new D;
|
||||
export let h1: D = new D;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//// [NonInitializedExportInInternalModule.ts]
|
||||
|
||||
module Inner {
|
||||
var;
|
||||
let;
|
||||
const;
|
||||
|
||||
export var a;
|
||||
export let b;
|
||||
export var c: string;
|
||||
export let d: number;
|
||||
class A {}
|
||||
export var e: A;
|
||||
export let f: A;
|
||||
|
||||
namespace B {
|
||||
export let a = 1, b, c = 2;
|
||||
export let x, y, z;
|
||||
}
|
||||
|
||||
module C {
|
||||
export var a = 1, b, c = 2;
|
||||
export var x, y, z;
|
||||
}
|
||||
|
||||
// Shouldn't be filtered
|
||||
export var a1 = 1;
|
||||
export let b1 = 1;
|
||||
export var c1: string = 'a';
|
||||
export let d1: number = 1;
|
||||
class D {}
|
||||
export var e1 = new D;
|
||||
export let f1 = new D;
|
||||
export var g1: D = new D;
|
||||
export let h1: D = new D;
|
||||
}
|
||||
|
||||
//// [NonInitializedExportInInternalModule.js]
|
||||
var Inner;
|
||||
(function (Inner) {
|
||||
var ;
|
||||
let;
|
||||
var ;
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B;
|
||||
(function (B) {
|
||||
B.a = 1, B.c = 2;
|
||||
})(B || (B = {}));
|
||||
var C;
|
||||
(function (C) {
|
||||
C.a = 1, C.c = 2;
|
||||
})(C || (C = {}));
|
||||
// Shouldn't be filtered
|
||||
Inner.a1 = 1;
|
||||
Inner.b1 = 1;
|
||||
Inner.c1 = 'a';
|
||||
Inner.d1 = 1;
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
})();
|
||||
Inner.e1 = new D;
|
||||
Inner.f1 = new D;
|
||||
Inner.g1 = new D;
|
||||
Inner.h1 = new D;
|
||||
})(Inner || (Inner = {}));
|
||||
-2
@@ -39,14 +39,12 @@ var A;
|
||||
(function (A) {
|
||||
var B;
|
||||
(function (B) {
|
||||
B.x;
|
||||
})(B = A.B || (A.B = {}));
|
||||
})(A || (A = {}));
|
||||
var A;
|
||||
(function (A) {
|
||||
var B;
|
||||
(function (B) {
|
||||
B.x;
|
||||
})(B || (B = {}));
|
||||
})(A || (A = {}));
|
||||
// ensure the right var decl is exported
|
||||
|
||||
@@ -35,14 +35,14 @@ function f1(x: Color | string) {
|
||||
}
|
||||
|
||||
function f2(x: Color | string | string[]) {
|
||||
>f2 : (x: string | string[] | Color) => void
|
||||
>x : string | string[] | Color
|
||||
>f2 : (x: string | Color | string[]) => void
|
||||
>x : string | Color | string[]
|
||||
>Color : Color
|
||||
|
||||
if (typeof x === "object") {
|
||||
>typeof x === "object" : boolean
|
||||
>typeof x : string
|
||||
>x : string | string[] | Color
|
||||
>x : string | Color | string[]
|
||||
>"object" : string
|
||||
|
||||
var y = x;
|
||||
@@ -55,7 +55,7 @@ function f2(x: Color | string | string[]) {
|
||||
if (typeof x === "number") {
|
||||
>typeof x === "number" : boolean
|
||||
>typeof x : string
|
||||
>x : string | string[] | Color
|
||||
>x : string | Color | string[]
|
||||
>"number" : string
|
||||
|
||||
var z = x;
|
||||
@@ -77,7 +77,7 @@ function f2(x: Color | string | string[]) {
|
||||
if (typeof x === "string") {
|
||||
>typeof x === "string" : boolean
|
||||
>typeof x : string
|
||||
>x : string | string[] | Color
|
||||
>x : string | Color | string[]
|
||||
>"string" : string
|
||||
|
||||
var a = x;
|
||||
@@ -89,11 +89,11 @@ function f2(x: Color | string | string[]) {
|
||||
}
|
||||
else {
|
||||
var b = x;
|
||||
>b : string[] | Color
|
||||
>x : string[] | Color
|
||||
>b : Color | string[]
|
||||
>x : Color | string[]
|
||||
|
||||
var b: Color | string[];
|
||||
>b : string[] | Color
|
||||
>b : Color | string[]
|
||||
>Color : Color
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(2,11): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts (2 errors) ====
|
||||
var v = { * foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
yield(foo);
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,5): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (2 errors) ====
|
||||
class C {
|
||||
*foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
yield(foo);
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts (1 errors) ====
|
||||
@@ -6,6 +6,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): erro
|
||||
constructor() {
|
||||
yield foo
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,19): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (2 errors) ====
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (1 errors) ====
|
||||
function* foo() { yield }
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts (1 errors) ====
|
||||
@@ -6,6 +6,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): erro
|
||||
foo() {
|
||||
yield foo
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts(2,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts(2,6): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts (1 errors) ====
|
||||
var v = () => {
|
||||
yield foo
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts (2 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
function bar() {
|
||||
yield foo;
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts (3 errors) ====
|
||||
@@ -10,4 +10,4 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): err
|
||||
~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
@@ -1,8 +1,8 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts (1 errors) ====
|
||||
"use strict";
|
||||
yield(foo);
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
@@ -1,19 +1,16 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(3,13): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(4,7): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(3,13): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (2 errors) ====
|
||||
function*foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
function bar() {
|
||||
function* quux() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
yield(foo);
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts(1,1): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts(1,1): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts (1 errors) ====
|
||||
yield foo;
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
@@ -1,16 +1,10 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(3,3): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
yield
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
yield
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
@@ -1,16 +1,10 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(3,3): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
yield;
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
yield;
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(2,9): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts (2 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
yield*foo
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
~~~
|
||||
!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (2 errors) ====
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (1 errors) ====
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
yield foo
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
@@ -1,16 +1,13 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(3,3): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (2 errors) ====
|
||||
yield(foo);
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
function* foo() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
yield(foo);
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(2,9): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts (2 errors) ====
|
||||
var v = function*() {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
yield(foo);
|
||||
~~~~~
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression1_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression1_es6.ts(1,9): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression1_es6.ts (2 errors) ====
|
||||
yield * [];
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -0,0 +1,5 @@
|
||||
//// [YieldStarExpression1_es6.ts]
|
||||
yield * [];
|
||||
|
||||
//// [YieldStarExpression1_es6.js]
|
||||
yield * [];
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user