mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into iFeelPrettyErr
This commit is contained in:
+2
-1
@@ -1,6 +1,7 @@
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- '4'
|
||||
- '0.10'
|
||||
|
||||
sudo: false
|
||||
sudo: false
|
||||
|
||||
+36
-11
@@ -1,17 +1,21 @@
|
||||
## Contributing bug fixes
|
||||
|
||||
TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.
|
||||
|
||||
## Contributing features
|
||||
|
||||
Features (things that add new or improved functionality to TypeScript) may be accepted, but will need to first be approved (marked as "Milestone == Community" by a TypeScript coordinator with the message "Approved") in the suggestion issue. Features with language design impact, or that are adequately satisfied with external tools, will not be accepted.
|
||||
|
||||
Design changes will not be accepted at this time. If you have a design change proposal, please log a suggestion issue.
|
||||
|
||||
## Legal
|
||||
|
||||
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
|
||||
|
||||
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190) or [Microsoft Contribution License Agreement.pdf](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=921298)), sign, scan, and email it back to <cla@microsoft.com>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request.
|
||||
|
||||
## Housekeeping
|
||||
|
||||
Your pull request should:
|
||||
|
||||
* Include a description of what your change intends to do
|
||||
@@ -29,7 +33,8 @@ Your pull request should:
|
||||
* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
|
||||
|
||||
## Running the Tests
|
||||
To run all tests, invoke the runtests target using jake:
|
||||
|
||||
To run all tests, invoke the `runtests` target using jake:
|
||||
|
||||
```Shell
|
||||
jake runtests
|
||||
@@ -47,23 +52,42 @@ e.g. to run all compiler baseline tests:
|
||||
jake runtests tests=compiler
|
||||
```
|
||||
|
||||
or to run specifc test: `tests\cases\compiler\2dArrays.ts`
|
||||
or to run a specific test: `tests\cases\compiler\2dArrays.ts`
|
||||
|
||||
```Shell
|
||||
jake runtests tests=2dArrays
|
||||
```
|
||||
|
||||
## Debugging the tests
|
||||
|
||||
To debug the tests, invoke the `runtests-browser` task from jake.
|
||||
You will probably only want to debug one test at a time:
|
||||
|
||||
```Shell
|
||||
jake runtests-browser tests=2dArrays
|
||||
```
|
||||
|
||||
You can specify which browser to use for debugging. Currently Chrome and IE are supported:
|
||||
|
||||
```Shell
|
||||
jake runtests-browser tests=2dArrays browser=chrome
|
||||
```
|
||||
|
||||
You can debug with VS Code or Node instead with `jake runtests debug=true`:
|
||||
|
||||
```Shell
|
||||
jake runtests tests=2dArrays debug=true
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
These files support metadata tags in the format `// @metaDataName: value`. The supported names and values are:
|
||||
To add a new test case, simply place a `.ts` file in `tests\cases\compiler` containing code that exemplifies the bugfix or change you are making.
|
||||
|
||||
* `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.
|
||||
These files support metadata tags in the format `// @metaDataName: value`.
|
||||
The supported names and values are the same as those supported in the compiler itself, with the addition of the `fileName` flag.
|
||||
`fileName` 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 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.
|
||||
@@ -86,6 +110,7 @@ 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.
|
||||
|
||||
When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use
|
||||
@@ -102,4 +127,4 @@ 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.
|
||||
|
||||
**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.
|
||||
**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.
|
||||
|
||||
+42
-15
@@ -626,9 +626,7 @@ function deleteTemporaryProjectOutput() {
|
||||
}
|
||||
}
|
||||
|
||||
var testTimeout = 20000;
|
||||
desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]', debug=true.");
|
||||
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
|
||||
function runConsoleTests(defaultReporter, defaultSubsets, postLint) {
|
||||
cleanTestDirs();
|
||||
var debug = process.env.debug || process.env.d;
|
||||
tests = process.env.test || process.env.tests || process.env.t;
|
||||
@@ -638,7 +636,7 @@ task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
|
||||
fs.unlinkSync(testConfigFile);
|
||||
}
|
||||
|
||||
if(tests || light) {
|
||||
if (tests || light) {
|
||||
writeTestConfigFile(tests, light, testConfigFile);
|
||||
}
|
||||
|
||||
@@ -648,20 +646,48 @@ task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
|
||||
|
||||
colors = process.env.colors || process.env.color
|
||||
colors = colors ? ' --no-colors ' : ' --colors ';
|
||||
tests = tests ? ' -g ' + tests : '';
|
||||
reporter = process.env.reporter || process.env.r || 'mocha-fivemat-progress-reporter';
|
||||
reporter = process.env.reporter || process.env.r || defaultReporter;
|
||||
|
||||
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
|
||||
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
|
||||
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
|
||||
console.log(cmd);
|
||||
exec(cmd, function() {
|
||||
deleteTemporaryProjectOutput();
|
||||
var lint = jake.Task['lint'];
|
||||
lint.addListener('complete', function () {
|
||||
complete();
|
||||
var subsetRegexes;
|
||||
if(defaultSubsets.length === 0) {
|
||||
subsetRegexes = [tests]
|
||||
}
|
||||
else {
|
||||
var subsets = tests ? tests.split("|") : defaultSubsets;
|
||||
subsetRegexes = subsets.map(function (sub) { return "^" + sub + ".*$"; });
|
||||
subsetRegexes.push("^(?!" + subsets.join("|") + ").*$");
|
||||
}
|
||||
subsetRegexes.forEach(function (subsetRegex) {
|
||||
tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '';
|
||||
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
|
||||
console.log(cmd);
|
||||
exec(cmd, function () {
|
||||
deleteTemporaryProjectOutput();
|
||||
if (postLint) {
|
||||
var lint = jake.Task['lint'];
|
||||
lint.addListener('complete', function () {
|
||||
complete();
|
||||
});
|
||||
lint.invoke();
|
||||
}
|
||||
else {
|
||||
complete();
|
||||
}
|
||||
});
|
||||
lint.invoke();
|
||||
});
|
||||
}
|
||||
|
||||
var testTimeout = 20000;
|
||||
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true.");
|
||||
task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], function() {
|
||||
runConsoleTests('min', ['compiler', 'conformance', 'Projects', 'fourslash']);
|
||||
}, {async: true});
|
||||
|
||||
desc("Runs the tests using the built run.js file. Optional arguments are: t[ests]=regex r[eporter]=[list|spec|json|<more>] d[ebug]=true color[s]=false.");
|
||||
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
|
||||
runConsoleTests('mocha-fivemat-progress-reporter', [], /*postLint*/ true);
|
||||
}, {async: true});
|
||||
|
||||
desc("Generates code coverage data via instanbul");
|
||||
@@ -820,7 +846,8 @@ var tslintRuleDir = "scripts/tslint";
|
||||
var tslintRules = ([
|
||||
"nextLineRule",
|
||||
"noNullRule",
|
||||
"booleanTriviaRule"
|
||||
"booleanTriviaRule",
|
||||
"typeOperatorSpacingRule"
|
||||
]);
|
||||
var tslintRulesFiles = tslintRules.map(function(p) {
|
||||
return path.join(tslintRuleDir, p + ".ts");
|
||||
|
||||
Vendored
+27
-125
@@ -4243,8 +4243,8 @@ interface AnalyserNode extends AudioNode {
|
||||
smoothingTimeConstant: number;
|
||||
getByteFrequencyData(array: Uint8Array): void;
|
||||
getByteTimeDomainData(array: Uint8Array): void;
|
||||
getFloatFrequencyData(array: any): void;
|
||||
getFloatTimeDomainData(array: any): void;
|
||||
getFloatFrequencyData(array: Float32Array): void;
|
||||
getFloatTimeDomainData(array: Float32Array): void;
|
||||
}
|
||||
|
||||
declare var AnalyserNode: {
|
||||
@@ -4331,7 +4331,7 @@ interface AudioBuffer {
|
||||
length: number;
|
||||
numberOfChannels: number;
|
||||
sampleRate: number;
|
||||
getChannelData(channel: number): any;
|
||||
getChannelData(channel: number): Float32Array;
|
||||
}
|
||||
|
||||
declare var AudioBuffer: {
|
||||
@@ -4375,7 +4375,7 @@ interface AudioContext extends EventTarget {
|
||||
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
|
||||
createOscillator(): OscillatorNode;
|
||||
createPanner(): PannerNode;
|
||||
createPeriodicWave(real: any, imag: any): PeriodicWave;
|
||||
createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave;
|
||||
createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
|
||||
createStereoPanner(): StereoPannerNode;
|
||||
createWaveShaper(): WaveShaperNode;
|
||||
@@ -4433,7 +4433,7 @@ interface AudioParam {
|
||||
linearRampToValueAtTime(value: number, endTime: number): void;
|
||||
setTargetAtTime(target: number, startTime: number, timeConstant: number): void;
|
||||
setValueAtTime(value: number, startTime: number): void;
|
||||
setValueCurveAtTime(values: any, startTime: number, duration: number): void;
|
||||
setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;
|
||||
}
|
||||
|
||||
declare var AudioParam: {
|
||||
@@ -4509,7 +4509,7 @@ interface BiquadFilterNode extends AudioNode {
|
||||
frequency: AudioParam;
|
||||
gain: AudioParam;
|
||||
type: string;
|
||||
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
|
||||
getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;
|
||||
}
|
||||
|
||||
declare var BiquadFilterNode: {
|
||||
@@ -5108,7 +5108,7 @@ declare var CanvasPattern: {
|
||||
|
||||
interface CanvasRenderingContext2D {
|
||||
canvas: HTMLCanvasElement;
|
||||
fillStyle: any;
|
||||
fillStyle: string | CanvasGradient | CanvasPattern;
|
||||
font: string;
|
||||
globalAlpha: number;
|
||||
globalCompositeOperation: string;
|
||||
@@ -5123,7 +5123,7 @@ interface CanvasRenderingContext2D {
|
||||
shadowColor: string;
|
||||
shadowOffsetX: number;
|
||||
shadowOffsetY: number;
|
||||
strokeStyle: any;
|
||||
strokeStyle: string | CanvasGradient | CanvasPattern;
|
||||
textAlign: string;
|
||||
textBaseline: string;
|
||||
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
|
||||
@@ -6491,8 +6491,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
importNode(importedNode: Node, deep: boolean): Node;
|
||||
msElementsFromPoint(x: number, y: number): NodeList;
|
||||
msElementsFromRect(left: number, top: number, width: number, height: number): NodeList;
|
||||
msGetPrintDocumentForNamedFlow(flowName: string): Document;
|
||||
msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void;
|
||||
/**
|
||||
* Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
|
||||
* @param url Specifies a MIME type for the document.
|
||||
@@ -11314,27 +11312,6 @@ declare var MSHTMLWebViewElement: {
|
||||
new(): MSHTMLWebViewElement;
|
||||
}
|
||||
|
||||
interface MSHeaderFooter {
|
||||
URL: string;
|
||||
dateLong: string;
|
||||
dateShort: string;
|
||||
font: string;
|
||||
htmlFoot: string;
|
||||
htmlHead: string;
|
||||
page: number;
|
||||
pageTotal: number;
|
||||
textFoot: string;
|
||||
textHead: string;
|
||||
timeLong: string;
|
||||
timeShort: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
declare var MSHeaderFooter: {
|
||||
prototype: MSHeaderFooter;
|
||||
new(): MSHeaderFooter;
|
||||
}
|
||||
|
||||
interface MSInputMethodContext extends EventTarget {
|
||||
compositionEndOffset: number;
|
||||
compositionStartOffset: number;
|
||||
@@ -11493,24 +11470,6 @@ declare var MSPointerEvent: {
|
||||
new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;
|
||||
}
|
||||
|
||||
interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget {
|
||||
percentScale: number;
|
||||
showHeaderFooter: boolean;
|
||||
shrinkToFit: boolean;
|
||||
drawPreviewPage(element: HTMLElement, pageNumber: number): void;
|
||||
endPrint(): void;
|
||||
getPrintTaskOptionValue(key: string): any;
|
||||
invalidatePreview(): void;
|
||||
setPageCount(pageCount: number): void;
|
||||
startPrint(): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
declare var MSPrintManagerTemplatePrinter: {
|
||||
prototype: MSPrintManagerTemplatePrinter;
|
||||
new(): MSPrintManagerTemplatePrinter;
|
||||
}
|
||||
|
||||
interface MSRangeCollection {
|
||||
length: number;
|
||||
item(index: number): Range;
|
||||
@@ -11558,63 +11517,6 @@ declare var MSStreamReader: {
|
||||
new(): MSStreamReader;
|
||||
}
|
||||
|
||||
interface MSTemplatePrinter {
|
||||
collate: boolean;
|
||||
copies: number;
|
||||
currentPage: boolean;
|
||||
currentPageAvail: boolean;
|
||||
duplex: boolean;
|
||||
footer: string;
|
||||
frameActive: boolean;
|
||||
frameActiveEnabled: boolean;
|
||||
frameAsShown: boolean;
|
||||
framesetDocument: boolean;
|
||||
header: string;
|
||||
headerFooterFont: string;
|
||||
marginBottom: number;
|
||||
marginLeft: number;
|
||||
marginRight: number;
|
||||
marginTop: number;
|
||||
orientation: string;
|
||||
pageFrom: number;
|
||||
pageHeight: number;
|
||||
pageTo: number;
|
||||
pageWidth: number;
|
||||
selectedPages: boolean;
|
||||
selection: boolean;
|
||||
selectionEnabled: boolean;
|
||||
unprintableBottom: number;
|
||||
unprintableLeft: number;
|
||||
unprintableRight: number;
|
||||
unprintableTop: number;
|
||||
usePrinterCopyCollate: boolean;
|
||||
createHeaderFooter(): MSHeaderFooter;
|
||||
deviceSupports(property: string): any;
|
||||
ensurePrintDialogDefaults(): boolean;
|
||||
getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginBottomImportant(pageRule: CSSPageRule): boolean;
|
||||
getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginLeftImportant(pageRule: CSSPageRule): boolean;
|
||||
getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginRightImportant(pageRule: CSSPageRule): boolean;
|
||||
getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginTopImportant(pageRule: CSSPageRule): boolean;
|
||||
printBlankPage(): void;
|
||||
printNonNative(document: any): boolean;
|
||||
printNonNativeFrames(document: any, activeFrame: boolean): void;
|
||||
printPage(element: HTMLElement): void;
|
||||
showPageSetupDialog(): boolean;
|
||||
showPrintDialog(): boolean;
|
||||
startDoc(title: string): boolean;
|
||||
stopDoc(): void;
|
||||
updatePageStatus(status: number): void;
|
||||
}
|
||||
|
||||
declare var MSTemplatePrinter: {
|
||||
prototype: MSTemplatePrinter;
|
||||
new(): MSTemplatePrinter;
|
||||
}
|
||||
|
||||
interface MSWebViewAsyncOperation extends EventTarget {
|
||||
error: DOMError;
|
||||
oncomplete: (ev: Event) => any;
|
||||
@@ -12032,6 +11934,10 @@ declare var Node: {
|
||||
}
|
||||
|
||||
interface NodeFilter {
|
||||
acceptNode(n: Node): number;
|
||||
}
|
||||
|
||||
declare var NodeFilter: {
|
||||
FILTER_ACCEPT: number;
|
||||
FILTER_REJECT: number;
|
||||
FILTER_SKIP: number;
|
||||
@@ -12049,7 +11955,6 @@ interface NodeFilter {
|
||||
SHOW_PROCESSING_INSTRUCTION: number;
|
||||
SHOW_TEXT: number;
|
||||
}
|
||||
declare var NodeFilter: NodeFilter;
|
||||
|
||||
interface NodeIterator {
|
||||
expandEntityReferences: boolean;
|
||||
@@ -12759,7 +12664,6 @@ declare var SVGDescElement: {
|
||||
|
||||
interface SVGElement extends Element {
|
||||
id: string;
|
||||
className: any;
|
||||
onclick: (ev: MouseEvent) => any;
|
||||
ondblclick: (ev: MouseEvent) => any;
|
||||
onfocusin: (ev: FocusEvent) => any;
|
||||
@@ -12773,6 +12677,7 @@ interface SVGElement extends Element {
|
||||
ownerSVGElement: SVGSVGElement;
|
||||
viewportElement: SVGElement;
|
||||
xmlbase: string;
|
||||
className: any;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -14934,7 +14839,7 @@ declare var WEBGL_depth_texture: {
|
||||
}
|
||||
|
||||
interface WaveShaperNode extends AudioNode {
|
||||
curve: any;
|
||||
curve: Float32Array;
|
||||
oversample: string;
|
||||
}
|
||||
|
||||
@@ -15121,34 +15026,34 @@ interface WebGLRenderingContext {
|
||||
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;
|
||||
uniform1fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform1i(location: WebGLUniformLocation, x: number): void;
|
||||
uniform1iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniform2f(location: WebGLUniformLocation, x: number, y: number): void;
|
||||
uniform2fv(location: WebGLUniformLocation, v: any): void;
|
||||
uniform2fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform2i(location: WebGLUniformLocation, x: number, y: number): void;
|
||||
uniform2iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void;
|
||||
uniform3fv(location: WebGLUniformLocation, v: any): void;
|
||||
uniform3fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void;
|
||||
uniform3iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
|
||||
uniform4fv(location: WebGLUniformLocation, v: any): void;
|
||||
uniform4fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
|
||||
uniform4iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
|
||||
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
|
||||
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
|
||||
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
|
||||
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
|
||||
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
|
||||
useProgram(program: WebGLProgram): void;
|
||||
validateProgram(program: WebGLProgram): void;
|
||||
vertexAttrib1f(indx: number, x: number): void;
|
||||
vertexAttrib1fv(indx: number, values: any): void;
|
||||
vertexAttrib1fv(indx: number, values: Float32Array): void;
|
||||
vertexAttrib2f(indx: number, x: number, y: number): void;
|
||||
vertexAttrib2fv(indx: number, values: any): void;
|
||||
vertexAttrib2fv(indx: number, values: Float32Array): void;
|
||||
vertexAttrib3f(indx: number, x: number, y: number, z: number): void;
|
||||
vertexAttrib3fv(indx: number, values: any): void;
|
||||
vertexAttrib3fv(indx: number, values: Float32Array): void;
|
||||
vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;
|
||||
vertexAttrib4fv(indx: number, values: any): void;
|
||||
vertexAttrib4fv(indx: number, values: Float32Array): void;
|
||||
vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;
|
||||
viewport(x: number, y: number, width: number, height: number): void;
|
||||
ACTIVE_ATTRIBUTES: number;
|
||||
@@ -15912,7 +15817,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
locationbar: BarProp;
|
||||
menubar: BarProp;
|
||||
msAnimationStartTime: number;
|
||||
msTemplatePrinter: MSTemplatePrinter;
|
||||
name: string;
|
||||
navigator: Navigator;
|
||||
offscreenBuffering: string | boolean;
|
||||
@@ -16649,7 +16553,6 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
|
||||
interface NodeListOf<TNode extends Node> extends NodeList {
|
||||
length: number;
|
||||
item(index: number): TNode;
|
||||
@@ -16670,8 +16573,6 @@ interface EventListenerObject {
|
||||
handleEvent(evt: Event): void;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface MessageEventInit extends EventInit {
|
||||
data?: any;
|
||||
origin?: string;
|
||||
@@ -16687,6 +16588,8 @@ interface ProgressEventInit extends EventInit {
|
||||
total?: number;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
|
||||
}
|
||||
@@ -16747,7 +16650,6 @@ declare var location: Location;
|
||||
declare var locationbar: BarProp;
|
||||
declare var menubar: BarProp;
|
||||
declare var msAnimationStartTime: number;
|
||||
declare var msTemplatePrinter: MSTemplatePrinter;
|
||||
declare var name: string;
|
||||
declare var navigator: Navigator;
|
||||
declare var offscreenBuffering: string | boolean;
|
||||
|
||||
Vendored
+27
-125
@@ -419,8 +419,8 @@ interface AnalyserNode extends AudioNode {
|
||||
smoothingTimeConstant: number;
|
||||
getByteFrequencyData(array: Uint8Array): void;
|
||||
getByteTimeDomainData(array: Uint8Array): void;
|
||||
getFloatFrequencyData(array: any): void;
|
||||
getFloatTimeDomainData(array: any): void;
|
||||
getFloatFrequencyData(array: Float32Array): void;
|
||||
getFloatTimeDomainData(array: Float32Array): void;
|
||||
}
|
||||
|
||||
declare var AnalyserNode: {
|
||||
@@ -507,7 +507,7 @@ interface AudioBuffer {
|
||||
length: number;
|
||||
numberOfChannels: number;
|
||||
sampleRate: number;
|
||||
getChannelData(channel: number): any;
|
||||
getChannelData(channel: number): Float32Array;
|
||||
}
|
||||
|
||||
declare var AudioBuffer: {
|
||||
@@ -551,7 +551,7 @@ interface AudioContext extends EventTarget {
|
||||
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
|
||||
createOscillator(): OscillatorNode;
|
||||
createPanner(): PannerNode;
|
||||
createPeriodicWave(real: any, imag: any): PeriodicWave;
|
||||
createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave;
|
||||
createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
|
||||
createStereoPanner(): StereoPannerNode;
|
||||
createWaveShaper(): WaveShaperNode;
|
||||
@@ -609,7 +609,7 @@ interface AudioParam {
|
||||
linearRampToValueAtTime(value: number, endTime: number): void;
|
||||
setTargetAtTime(target: number, startTime: number, timeConstant: number): void;
|
||||
setValueAtTime(value: number, startTime: number): void;
|
||||
setValueCurveAtTime(values: any, startTime: number, duration: number): void;
|
||||
setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;
|
||||
}
|
||||
|
||||
declare var AudioParam: {
|
||||
@@ -685,7 +685,7 @@ interface BiquadFilterNode extends AudioNode {
|
||||
frequency: AudioParam;
|
||||
gain: AudioParam;
|
||||
type: string;
|
||||
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
|
||||
getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;
|
||||
}
|
||||
|
||||
declare var BiquadFilterNode: {
|
||||
@@ -1284,7 +1284,7 @@ declare var CanvasPattern: {
|
||||
|
||||
interface CanvasRenderingContext2D {
|
||||
canvas: HTMLCanvasElement;
|
||||
fillStyle: any;
|
||||
fillStyle: string | CanvasGradient | CanvasPattern;
|
||||
font: string;
|
||||
globalAlpha: number;
|
||||
globalCompositeOperation: string;
|
||||
@@ -1299,7 +1299,7 @@ interface CanvasRenderingContext2D {
|
||||
shadowColor: string;
|
||||
shadowOffsetX: number;
|
||||
shadowOffsetY: number;
|
||||
strokeStyle: any;
|
||||
strokeStyle: string | CanvasGradient | CanvasPattern;
|
||||
textAlign: string;
|
||||
textBaseline: string;
|
||||
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
|
||||
@@ -2667,8 +2667,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
importNode(importedNode: Node, deep: boolean): Node;
|
||||
msElementsFromPoint(x: number, y: number): NodeList;
|
||||
msElementsFromRect(left: number, top: number, width: number, height: number): NodeList;
|
||||
msGetPrintDocumentForNamedFlow(flowName: string): Document;
|
||||
msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void;
|
||||
/**
|
||||
* Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
|
||||
* @param url Specifies a MIME type for the document.
|
||||
@@ -7490,27 +7488,6 @@ declare var MSHTMLWebViewElement: {
|
||||
new(): MSHTMLWebViewElement;
|
||||
}
|
||||
|
||||
interface MSHeaderFooter {
|
||||
URL: string;
|
||||
dateLong: string;
|
||||
dateShort: string;
|
||||
font: string;
|
||||
htmlFoot: string;
|
||||
htmlHead: string;
|
||||
page: number;
|
||||
pageTotal: number;
|
||||
textFoot: string;
|
||||
textHead: string;
|
||||
timeLong: string;
|
||||
timeShort: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
declare var MSHeaderFooter: {
|
||||
prototype: MSHeaderFooter;
|
||||
new(): MSHeaderFooter;
|
||||
}
|
||||
|
||||
interface MSInputMethodContext extends EventTarget {
|
||||
compositionEndOffset: number;
|
||||
compositionStartOffset: number;
|
||||
@@ -7669,24 +7646,6 @@ declare var MSPointerEvent: {
|
||||
new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;
|
||||
}
|
||||
|
||||
interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget {
|
||||
percentScale: number;
|
||||
showHeaderFooter: boolean;
|
||||
shrinkToFit: boolean;
|
||||
drawPreviewPage(element: HTMLElement, pageNumber: number): void;
|
||||
endPrint(): void;
|
||||
getPrintTaskOptionValue(key: string): any;
|
||||
invalidatePreview(): void;
|
||||
setPageCount(pageCount: number): void;
|
||||
startPrint(): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
declare var MSPrintManagerTemplatePrinter: {
|
||||
prototype: MSPrintManagerTemplatePrinter;
|
||||
new(): MSPrintManagerTemplatePrinter;
|
||||
}
|
||||
|
||||
interface MSRangeCollection {
|
||||
length: number;
|
||||
item(index: number): Range;
|
||||
@@ -7734,63 +7693,6 @@ declare var MSStreamReader: {
|
||||
new(): MSStreamReader;
|
||||
}
|
||||
|
||||
interface MSTemplatePrinter {
|
||||
collate: boolean;
|
||||
copies: number;
|
||||
currentPage: boolean;
|
||||
currentPageAvail: boolean;
|
||||
duplex: boolean;
|
||||
footer: string;
|
||||
frameActive: boolean;
|
||||
frameActiveEnabled: boolean;
|
||||
frameAsShown: boolean;
|
||||
framesetDocument: boolean;
|
||||
header: string;
|
||||
headerFooterFont: string;
|
||||
marginBottom: number;
|
||||
marginLeft: number;
|
||||
marginRight: number;
|
||||
marginTop: number;
|
||||
orientation: string;
|
||||
pageFrom: number;
|
||||
pageHeight: number;
|
||||
pageTo: number;
|
||||
pageWidth: number;
|
||||
selectedPages: boolean;
|
||||
selection: boolean;
|
||||
selectionEnabled: boolean;
|
||||
unprintableBottom: number;
|
||||
unprintableLeft: number;
|
||||
unprintableRight: number;
|
||||
unprintableTop: number;
|
||||
usePrinterCopyCollate: boolean;
|
||||
createHeaderFooter(): MSHeaderFooter;
|
||||
deviceSupports(property: string): any;
|
||||
ensurePrintDialogDefaults(): boolean;
|
||||
getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginBottomImportant(pageRule: CSSPageRule): boolean;
|
||||
getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginLeftImportant(pageRule: CSSPageRule): boolean;
|
||||
getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginRightImportant(pageRule: CSSPageRule): boolean;
|
||||
getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginTopImportant(pageRule: CSSPageRule): boolean;
|
||||
printBlankPage(): void;
|
||||
printNonNative(document: any): boolean;
|
||||
printNonNativeFrames(document: any, activeFrame: boolean): void;
|
||||
printPage(element: HTMLElement): void;
|
||||
showPageSetupDialog(): boolean;
|
||||
showPrintDialog(): boolean;
|
||||
startDoc(title: string): boolean;
|
||||
stopDoc(): void;
|
||||
updatePageStatus(status: number): void;
|
||||
}
|
||||
|
||||
declare var MSTemplatePrinter: {
|
||||
prototype: MSTemplatePrinter;
|
||||
new(): MSTemplatePrinter;
|
||||
}
|
||||
|
||||
interface MSWebViewAsyncOperation extends EventTarget {
|
||||
error: DOMError;
|
||||
oncomplete: (ev: Event) => any;
|
||||
@@ -8208,6 +8110,10 @@ declare var Node: {
|
||||
}
|
||||
|
||||
interface NodeFilter {
|
||||
acceptNode(n: Node): number;
|
||||
}
|
||||
|
||||
declare var NodeFilter: {
|
||||
FILTER_ACCEPT: number;
|
||||
FILTER_REJECT: number;
|
||||
FILTER_SKIP: number;
|
||||
@@ -8225,7 +8131,6 @@ interface NodeFilter {
|
||||
SHOW_PROCESSING_INSTRUCTION: number;
|
||||
SHOW_TEXT: number;
|
||||
}
|
||||
declare var NodeFilter: NodeFilter;
|
||||
|
||||
interface NodeIterator {
|
||||
expandEntityReferences: boolean;
|
||||
@@ -8935,7 +8840,6 @@ declare var SVGDescElement: {
|
||||
|
||||
interface SVGElement extends Element {
|
||||
id: string;
|
||||
className: any;
|
||||
onclick: (ev: MouseEvent) => any;
|
||||
ondblclick: (ev: MouseEvent) => any;
|
||||
onfocusin: (ev: FocusEvent) => any;
|
||||
@@ -8949,6 +8853,7 @@ interface SVGElement extends Element {
|
||||
ownerSVGElement: SVGSVGElement;
|
||||
viewportElement: SVGElement;
|
||||
xmlbase: string;
|
||||
className: any;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -11110,7 +11015,7 @@ declare var WEBGL_depth_texture: {
|
||||
}
|
||||
|
||||
interface WaveShaperNode extends AudioNode {
|
||||
curve: any;
|
||||
curve: Float32Array;
|
||||
oversample: string;
|
||||
}
|
||||
|
||||
@@ -11297,34 +11202,34 @@ interface WebGLRenderingContext {
|
||||
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;
|
||||
uniform1fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform1i(location: WebGLUniformLocation, x: number): void;
|
||||
uniform1iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniform2f(location: WebGLUniformLocation, x: number, y: number): void;
|
||||
uniform2fv(location: WebGLUniformLocation, v: any): void;
|
||||
uniform2fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform2i(location: WebGLUniformLocation, x: number, y: number): void;
|
||||
uniform2iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void;
|
||||
uniform3fv(location: WebGLUniformLocation, v: any): void;
|
||||
uniform3fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void;
|
||||
uniform3iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
|
||||
uniform4fv(location: WebGLUniformLocation, v: any): void;
|
||||
uniform4fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
|
||||
uniform4iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
|
||||
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
|
||||
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
|
||||
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
|
||||
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
|
||||
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
|
||||
useProgram(program: WebGLProgram): void;
|
||||
validateProgram(program: WebGLProgram): void;
|
||||
vertexAttrib1f(indx: number, x: number): void;
|
||||
vertexAttrib1fv(indx: number, values: any): void;
|
||||
vertexAttrib1fv(indx: number, values: Float32Array): void;
|
||||
vertexAttrib2f(indx: number, x: number, y: number): void;
|
||||
vertexAttrib2fv(indx: number, values: any): void;
|
||||
vertexAttrib2fv(indx: number, values: Float32Array): void;
|
||||
vertexAttrib3f(indx: number, x: number, y: number, z: number): void;
|
||||
vertexAttrib3fv(indx: number, values: any): void;
|
||||
vertexAttrib3fv(indx: number, values: Float32Array): void;
|
||||
vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;
|
||||
vertexAttrib4fv(indx: number, values: any): void;
|
||||
vertexAttrib4fv(indx: number, values: Float32Array): void;
|
||||
vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;
|
||||
viewport(x: number, y: number, width: number, height: number): void;
|
||||
ACTIVE_ATTRIBUTES: number;
|
||||
@@ -12088,7 +11993,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
locationbar: BarProp;
|
||||
menubar: BarProp;
|
||||
msAnimationStartTime: number;
|
||||
msTemplatePrinter: MSTemplatePrinter;
|
||||
name: string;
|
||||
navigator: Navigator;
|
||||
offscreenBuffering: string | boolean;
|
||||
@@ -12825,7 +12729,6 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
|
||||
interface NodeListOf<TNode extends Node> extends NodeList {
|
||||
length: number;
|
||||
item(index: number): TNode;
|
||||
@@ -12846,8 +12749,6 @@ interface EventListenerObject {
|
||||
handleEvent(evt: Event): void;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface MessageEventInit extends EventInit {
|
||||
data?: any;
|
||||
origin?: string;
|
||||
@@ -12863,6 +12764,8 @@ interface ProgressEventInit extends EventInit {
|
||||
total?: number;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
|
||||
}
|
||||
@@ -12923,7 +12826,6 @@ declare var location: Location;
|
||||
declare var locationbar: BarProp;
|
||||
declare var menubar: BarProp;
|
||||
declare var msAnimationStartTime: number;
|
||||
declare var msTemplatePrinter: MSTemplatePrinter;
|
||||
declare var name: string;
|
||||
declare var navigator: Navigator;
|
||||
declare var offscreenBuffering: string | boolean;
|
||||
|
||||
Vendored
+27
-125
@@ -5558,8 +5558,8 @@ interface AnalyserNode extends AudioNode {
|
||||
smoothingTimeConstant: number;
|
||||
getByteFrequencyData(array: Uint8Array): void;
|
||||
getByteTimeDomainData(array: Uint8Array): void;
|
||||
getFloatFrequencyData(array: any): void;
|
||||
getFloatTimeDomainData(array: any): void;
|
||||
getFloatFrequencyData(array: Float32Array): void;
|
||||
getFloatTimeDomainData(array: Float32Array): void;
|
||||
}
|
||||
|
||||
declare var AnalyserNode: {
|
||||
@@ -5646,7 +5646,7 @@ interface AudioBuffer {
|
||||
length: number;
|
||||
numberOfChannels: number;
|
||||
sampleRate: number;
|
||||
getChannelData(channel: number): any;
|
||||
getChannelData(channel: number): Float32Array;
|
||||
}
|
||||
|
||||
declare var AudioBuffer: {
|
||||
@@ -5690,7 +5690,7 @@ interface AudioContext extends EventTarget {
|
||||
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
|
||||
createOscillator(): OscillatorNode;
|
||||
createPanner(): PannerNode;
|
||||
createPeriodicWave(real: any, imag: any): PeriodicWave;
|
||||
createPeriodicWave(real: Float32Array, imag: Float32Array): PeriodicWave;
|
||||
createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
|
||||
createStereoPanner(): StereoPannerNode;
|
||||
createWaveShaper(): WaveShaperNode;
|
||||
@@ -5748,7 +5748,7 @@ interface AudioParam {
|
||||
linearRampToValueAtTime(value: number, endTime: number): void;
|
||||
setTargetAtTime(target: number, startTime: number, timeConstant: number): void;
|
||||
setValueAtTime(value: number, startTime: number): void;
|
||||
setValueCurveAtTime(values: any, startTime: number, duration: number): void;
|
||||
setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;
|
||||
}
|
||||
|
||||
declare var AudioParam: {
|
||||
@@ -5824,7 +5824,7 @@ interface BiquadFilterNode extends AudioNode {
|
||||
frequency: AudioParam;
|
||||
gain: AudioParam;
|
||||
type: string;
|
||||
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
|
||||
getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;
|
||||
}
|
||||
|
||||
declare var BiquadFilterNode: {
|
||||
@@ -6423,7 +6423,7 @@ declare var CanvasPattern: {
|
||||
|
||||
interface CanvasRenderingContext2D {
|
||||
canvas: HTMLCanvasElement;
|
||||
fillStyle: any;
|
||||
fillStyle: string | CanvasGradient | CanvasPattern;
|
||||
font: string;
|
||||
globalAlpha: number;
|
||||
globalCompositeOperation: string;
|
||||
@@ -6438,7 +6438,7 @@ interface CanvasRenderingContext2D {
|
||||
shadowColor: string;
|
||||
shadowOffsetX: number;
|
||||
shadowOffsetY: number;
|
||||
strokeStyle: any;
|
||||
strokeStyle: string | CanvasGradient | CanvasPattern;
|
||||
textAlign: string;
|
||||
textBaseline: string;
|
||||
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
|
||||
@@ -7806,8 +7806,6 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
importNode(importedNode: Node, deep: boolean): Node;
|
||||
msElementsFromPoint(x: number, y: number): NodeList;
|
||||
msElementsFromRect(left: number, top: number, width: number, height: number): NodeList;
|
||||
msGetPrintDocumentForNamedFlow(flowName: string): Document;
|
||||
msSetPrintDocumentUriForNamedFlow(flowName: string, uri: string): void;
|
||||
/**
|
||||
* Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
|
||||
* @param url Specifies a MIME type for the document.
|
||||
@@ -12629,27 +12627,6 @@ declare var MSHTMLWebViewElement: {
|
||||
new(): MSHTMLWebViewElement;
|
||||
}
|
||||
|
||||
interface MSHeaderFooter {
|
||||
URL: string;
|
||||
dateLong: string;
|
||||
dateShort: string;
|
||||
font: string;
|
||||
htmlFoot: string;
|
||||
htmlHead: string;
|
||||
page: number;
|
||||
pageTotal: number;
|
||||
textFoot: string;
|
||||
textHead: string;
|
||||
timeLong: string;
|
||||
timeShort: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
declare var MSHeaderFooter: {
|
||||
prototype: MSHeaderFooter;
|
||||
new(): MSHeaderFooter;
|
||||
}
|
||||
|
||||
interface MSInputMethodContext extends EventTarget {
|
||||
compositionEndOffset: number;
|
||||
compositionStartOffset: number;
|
||||
@@ -12808,24 +12785,6 @@ declare var MSPointerEvent: {
|
||||
new(typeArg: string, eventInitDict?: PointerEventInit): MSPointerEvent;
|
||||
}
|
||||
|
||||
interface MSPrintManagerTemplatePrinter extends MSTemplatePrinter, EventTarget {
|
||||
percentScale: number;
|
||||
showHeaderFooter: boolean;
|
||||
shrinkToFit: boolean;
|
||||
drawPreviewPage(element: HTMLElement, pageNumber: number): void;
|
||||
endPrint(): void;
|
||||
getPrintTaskOptionValue(key: string): any;
|
||||
invalidatePreview(): void;
|
||||
setPageCount(pageCount: number): void;
|
||||
startPrint(): void;
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
declare var MSPrintManagerTemplatePrinter: {
|
||||
prototype: MSPrintManagerTemplatePrinter;
|
||||
new(): MSPrintManagerTemplatePrinter;
|
||||
}
|
||||
|
||||
interface MSRangeCollection {
|
||||
length: number;
|
||||
item(index: number): Range;
|
||||
@@ -12873,63 +12832,6 @@ declare var MSStreamReader: {
|
||||
new(): MSStreamReader;
|
||||
}
|
||||
|
||||
interface MSTemplatePrinter {
|
||||
collate: boolean;
|
||||
copies: number;
|
||||
currentPage: boolean;
|
||||
currentPageAvail: boolean;
|
||||
duplex: boolean;
|
||||
footer: string;
|
||||
frameActive: boolean;
|
||||
frameActiveEnabled: boolean;
|
||||
frameAsShown: boolean;
|
||||
framesetDocument: boolean;
|
||||
header: string;
|
||||
headerFooterFont: string;
|
||||
marginBottom: number;
|
||||
marginLeft: number;
|
||||
marginRight: number;
|
||||
marginTop: number;
|
||||
orientation: string;
|
||||
pageFrom: number;
|
||||
pageHeight: number;
|
||||
pageTo: number;
|
||||
pageWidth: number;
|
||||
selectedPages: boolean;
|
||||
selection: boolean;
|
||||
selectionEnabled: boolean;
|
||||
unprintableBottom: number;
|
||||
unprintableLeft: number;
|
||||
unprintableRight: number;
|
||||
unprintableTop: number;
|
||||
usePrinterCopyCollate: boolean;
|
||||
createHeaderFooter(): MSHeaderFooter;
|
||||
deviceSupports(property: string): any;
|
||||
ensurePrintDialogDefaults(): boolean;
|
||||
getPageMarginBottom(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginBottomImportant(pageRule: CSSPageRule): boolean;
|
||||
getPageMarginLeft(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginLeftImportant(pageRule: CSSPageRule): boolean;
|
||||
getPageMarginRight(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginRightImportant(pageRule: CSSPageRule): boolean;
|
||||
getPageMarginTop(pageRule: CSSPageRule, pageWidth: number, pageHeight: number): any;
|
||||
getPageMarginTopImportant(pageRule: CSSPageRule): boolean;
|
||||
printBlankPage(): void;
|
||||
printNonNative(document: any): boolean;
|
||||
printNonNativeFrames(document: any, activeFrame: boolean): void;
|
||||
printPage(element: HTMLElement): void;
|
||||
showPageSetupDialog(): boolean;
|
||||
showPrintDialog(): boolean;
|
||||
startDoc(title: string): boolean;
|
||||
stopDoc(): void;
|
||||
updatePageStatus(status: number): void;
|
||||
}
|
||||
|
||||
declare var MSTemplatePrinter: {
|
||||
prototype: MSTemplatePrinter;
|
||||
new(): MSTemplatePrinter;
|
||||
}
|
||||
|
||||
interface MSWebViewAsyncOperation extends EventTarget {
|
||||
error: DOMError;
|
||||
oncomplete: (ev: Event) => any;
|
||||
@@ -13347,6 +13249,10 @@ declare var Node: {
|
||||
}
|
||||
|
||||
interface NodeFilter {
|
||||
acceptNode(n: Node): number;
|
||||
}
|
||||
|
||||
declare var NodeFilter: {
|
||||
FILTER_ACCEPT: number;
|
||||
FILTER_REJECT: number;
|
||||
FILTER_SKIP: number;
|
||||
@@ -13364,7 +13270,6 @@ interface NodeFilter {
|
||||
SHOW_PROCESSING_INSTRUCTION: number;
|
||||
SHOW_TEXT: number;
|
||||
}
|
||||
declare var NodeFilter: NodeFilter;
|
||||
|
||||
interface NodeIterator {
|
||||
expandEntityReferences: boolean;
|
||||
@@ -14074,7 +13979,6 @@ declare var SVGDescElement: {
|
||||
|
||||
interface SVGElement extends Element {
|
||||
id: string;
|
||||
className: any;
|
||||
onclick: (ev: MouseEvent) => any;
|
||||
ondblclick: (ev: MouseEvent) => any;
|
||||
onfocusin: (ev: FocusEvent) => any;
|
||||
@@ -14088,6 +13992,7 @@ interface SVGElement extends Element {
|
||||
ownerSVGElement: SVGSVGElement;
|
||||
viewportElement: SVGElement;
|
||||
xmlbase: string;
|
||||
className: any;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -16249,7 +16154,7 @@ declare var WEBGL_depth_texture: {
|
||||
}
|
||||
|
||||
interface WaveShaperNode extends AudioNode {
|
||||
curve: any;
|
||||
curve: Float32Array;
|
||||
oversample: string;
|
||||
}
|
||||
|
||||
@@ -16436,34 +16341,34 @@ interface WebGLRenderingContext {
|
||||
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;
|
||||
uniform1fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform1i(location: WebGLUniformLocation, x: number): void;
|
||||
uniform1iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniform2f(location: WebGLUniformLocation, x: number, y: number): void;
|
||||
uniform2fv(location: WebGLUniformLocation, v: any): void;
|
||||
uniform2fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform2i(location: WebGLUniformLocation, x: number, y: number): void;
|
||||
uniform2iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniform3f(location: WebGLUniformLocation, x: number, y: number, z: number): void;
|
||||
uniform3fv(location: WebGLUniformLocation, v: any): void;
|
||||
uniform3fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform3i(location: WebGLUniformLocation, x: number, y: number, z: number): void;
|
||||
uniform3iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniform4f(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
|
||||
uniform4fv(location: WebGLUniformLocation, v: any): void;
|
||||
uniform4fv(location: WebGLUniformLocation, v: Float32Array): void;
|
||||
uniform4i(location: WebGLUniformLocation, x: number, y: number, z: number, w: number): void;
|
||||
uniform4iv(location: WebGLUniformLocation, v: Int32Array): void;
|
||||
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
|
||||
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
|
||||
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: any): void;
|
||||
uniformMatrix2fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
|
||||
uniformMatrix3fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
|
||||
uniformMatrix4fv(location: WebGLUniformLocation, transpose: boolean, value: Float32Array): void;
|
||||
useProgram(program: WebGLProgram): void;
|
||||
validateProgram(program: WebGLProgram): void;
|
||||
vertexAttrib1f(indx: number, x: number): void;
|
||||
vertexAttrib1fv(indx: number, values: any): void;
|
||||
vertexAttrib1fv(indx: number, values: Float32Array): void;
|
||||
vertexAttrib2f(indx: number, x: number, y: number): void;
|
||||
vertexAttrib2fv(indx: number, values: any): void;
|
||||
vertexAttrib2fv(indx: number, values: Float32Array): void;
|
||||
vertexAttrib3f(indx: number, x: number, y: number, z: number): void;
|
||||
vertexAttrib3fv(indx: number, values: any): void;
|
||||
vertexAttrib3fv(indx: number, values: Float32Array): void;
|
||||
vertexAttrib4f(indx: number, x: number, y: number, z: number, w: number): void;
|
||||
vertexAttrib4fv(indx: number, values: any): void;
|
||||
vertexAttrib4fv(indx: number, values: Float32Array): void;
|
||||
vertexAttribPointer(indx: number, size: number, type: number, normalized: boolean, stride: number, offset: number): void;
|
||||
viewport(x: number, y: number, width: number, height: number): void;
|
||||
ACTIVE_ATTRIBUTES: number;
|
||||
@@ -17227,7 +17132,6 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
locationbar: BarProp;
|
||||
menubar: BarProp;
|
||||
msAnimationStartTime: number;
|
||||
msTemplatePrinter: MSTemplatePrinter;
|
||||
name: string;
|
||||
navigator: Navigator;
|
||||
offscreenBuffering: string | boolean;
|
||||
@@ -17964,7 +17868,6 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
|
||||
interface NodeListOf<TNode extends Node> extends NodeList {
|
||||
length: number;
|
||||
item(index: number): TNode;
|
||||
@@ -17985,8 +17888,6 @@ interface EventListenerObject {
|
||||
handleEvent(evt: Event): void;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface MessageEventInit extends EventInit {
|
||||
data?: any;
|
||||
origin?: string;
|
||||
@@ -18002,6 +17903,8 @@ interface ProgressEventInit extends EventInit {
|
||||
total?: number;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
|
||||
}
|
||||
@@ -18062,7 +17965,6 @@ declare var location: Location;
|
||||
declare var locationbar: BarProp;
|
||||
declare var menubar: BarProp;
|
||||
declare var msAnimationStartTime: number;
|
||||
declare var msTemplatePrinter: MSTemplatePrinter;
|
||||
declare var name: string;
|
||||
declare var navigator: Navigator;
|
||||
declare var offscreenBuffering: string | boolean;
|
||||
|
||||
Vendored
+3
-4
@@ -234,7 +234,7 @@ interface AudioBuffer {
|
||||
length: number;
|
||||
numberOfChannels: number;
|
||||
sampleRate: number;
|
||||
getChannelData(channel: number): any;
|
||||
getChannelData(channel: number): Float32Array;
|
||||
}
|
||||
|
||||
declare var AudioBuffer: {
|
||||
@@ -1111,7 +1111,6 @@ interface WorkerUtils extends Object, WindowBase64 {
|
||||
setTimeout(handler: any, timeout?: any, ...args: any[]): number;
|
||||
}
|
||||
|
||||
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
@@ -1126,8 +1125,6 @@ interface EventListenerObject {
|
||||
handleEvent(evt: Event): void;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface MessageEventInit extends EventInit {
|
||||
data?: any;
|
||||
origin?: string;
|
||||
@@ -1143,6 +1140,8 @@ interface ProgressEventInit extends EventInit {
|
||||
total?: number;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
|
||||
}
|
||||
|
||||
+8884
-8314
File diff suppressed because it is too large
Load Diff
+10198
-9516
File diff suppressed because it is too large
Load Diff
Vendored
+275
-254
@@ -68,253 +68,255 @@ declare namespace ts {
|
||||
PlusToken = 35,
|
||||
MinusToken = 36,
|
||||
AsteriskToken = 37,
|
||||
SlashToken = 38,
|
||||
PercentToken = 39,
|
||||
PlusPlusToken = 40,
|
||||
MinusMinusToken = 41,
|
||||
LessThanLessThanToken = 42,
|
||||
GreaterThanGreaterThanToken = 43,
|
||||
GreaterThanGreaterThanGreaterThanToken = 44,
|
||||
AmpersandToken = 45,
|
||||
BarToken = 46,
|
||||
CaretToken = 47,
|
||||
ExclamationToken = 48,
|
||||
TildeToken = 49,
|
||||
AmpersandAmpersandToken = 50,
|
||||
BarBarToken = 51,
|
||||
QuestionToken = 52,
|
||||
ColonToken = 53,
|
||||
AtToken = 54,
|
||||
EqualsToken = 55,
|
||||
PlusEqualsToken = 56,
|
||||
MinusEqualsToken = 57,
|
||||
AsteriskEqualsToken = 58,
|
||||
SlashEqualsToken = 59,
|
||||
PercentEqualsToken = 60,
|
||||
LessThanLessThanEqualsToken = 61,
|
||||
GreaterThanGreaterThanEqualsToken = 62,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 63,
|
||||
AmpersandEqualsToken = 64,
|
||||
BarEqualsToken = 65,
|
||||
CaretEqualsToken = 66,
|
||||
Identifier = 67,
|
||||
BreakKeyword = 68,
|
||||
CaseKeyword = 69,
|
||||
CatchKeyword = 70,
|
||||
ClassKeyword = 71,
|
||||
ConstKeyword = 72,
|
||||
ContinueKeyword = 73,
|
||||
DebuggerKeyword = 74,
|
||||
DefaultKeyword = 75,
|
||||
DeleteKeyword = 76,
|
||||
DoKeyword = 77,
|
||||
ElseKeyword = 78,
|
||||
EnumKeyword = 79,
|
||||
ExportKeyword = 80,
|
||||
ExtendsKeyword = 81,
|
||||
FalseKeyword = 82,
|
||||
FinallyKeyword = 83,
|
||||
ForKeyword = 84,
|
||||
FunctionKeyword = 85,
|
||||
IfKeyword = 86,
|
||||
ImportKeyword = 87,
|
||||
InKeyword = 88,
|
||||
InstanceOfKeyword = 89,
|
||||
NewKeyword = 90,
|
||||
NullKeyword = 91,
|
||||
ReturnKeyword = 92,
|
||||
SuperKeyword = 93,
|
||||
SwitchKeyword = 94,
|
||||
ThisKeyword = 95,
|
||||
ThrowKeyword = 96,
|
||||
TrueKeyword = 97,
|
||||
TryKeyword = 98,
|
||||
TypeOfKeyword = 99,
|
||||
VarKeyword = 100,
|
||||
VoidKeyword = 101,
|
||||
WhileKeyword = 102,
|
||||
WithKeyword = 103,
|
||||
ImplementsKeyword = 104,
|
||||
InterfaceKeyword = 105,
|
||||
LetKeyword = 106,
|
||||
PackageKeyword = 107,
|
||||
PrivateKeyword = 108,
|
||||
ProtectedKeyword = 109,
|
||||
PublicKeyword = 110,
|
||||
StaticKeyword = 111,
|
||||
YieldKeyword = 112,
|
||||
AbstractKeyword = 113,
|
||||
AsKeyword = 114,
|
||||
AnyKeyword = 115,
|
||||
AsyncKeyword = 116,
|
||||
AwaitKeyword = 117,
|
||||
BooleanKeyword = 118,
|
||||
ConstructorKeyword = 119,
|
||||
DeclareKeyword = 120,
|
||||
GetKeyword = 121,
|
||||
IsKeyword = 122,
|
||||
ModuleKeyword = 123,
|
||||
NamespaceKeyword = 124,
|
||||
RequireKeyword = 125,
|
||||
NumberKeyword = 126,
|
||||
SetKeyword = 127,
|
||||
StringKeyword = 128,
|
||||
SymbolKeyword = 129,
|
||||
TypeKeyword = 130,
|
||||
FromKeyword = 131,
|
||||
OfKeyword = 132,
|
||||
QualifiedName = 133,
|
||||
ComputedPropertyName = 134,
|
||||
TypeParameter = 135,
|
||||
Parameter = 136,
|
||||
Decorator = 137,
|
||||
PropertySignature = 138,
|
||||
PropertyDeclaration = 139,
|
||||
MethodSignature = 140,
|
||||
MethodDeclaration = 141,
|
||||
Constructor = 142,
|
||||
GetAccessor = 143,
|
||||
SetAccessor = 144,
|
||||
CallSignature = 145,
|
||||
ConstructSignature = 146,
|
||||
IndexSignature = 147,
|
||||
TypePredicate = 148,
|
||||
TypeReference = 149,
|
||||
FunctionType = 150,
|
||||
ConstructorType = 151,
|
||||
TypeQuery = 152,
|
||||
TypeLiteral = 153,
|
||||
ArrayType = 154,
|
||||
TupleType = 155,
|
||||
UnionType = 156,
|
||||
IntersectionType = 157,
|
||||
ParenthesizedType = 158,
|
||||
ObjectBindingPattern = 159,
|
||||
ArrayBindingPattern = 160,
|
||||
BindingElement = 161,
|
||||
ArrayLiteralExpression = 162,
|
||||
ObjectLiteralExpression = 163,
|
||||
PropertyAccessExpression = 164,
|
||||
ElementAccessExpression = 165,
|
||||
CallExpression = 166,
|
||||
NewExpression = 167,
|
||||
TaggedTemplateExpression = 168,
|
||||
TypeAssertionExpression = 169,
|
||||
ParenthesizedExpression = 170,
|
||||
FunctionExpression = 171,
|
||||
ArrowFunction = 172,
|
||||
DeleteExpression = 173,
|
||||
TypeOfExpression = 174,
|
||||
VoidExpression = 175,
|
||||
AwaitExpression = 176,
|
||||
PrefixUnaryExpression = 177,
|
||||
PostfixUnaryExpression = 178,
|
||||
BinaryExpression = 179,
|
||||
ConditionalExpression = 180,
|
||||
TemplateExpression = 181,
|
||||
YieldExpression = 182,
|
||||
SpreadElementExpression = 183,
|
||||
ClassExpression = 184,
|
||||
OmittedExpression = 185,
|
||||
ExpressionWithTypeArguments = 186,
|
||||
AsExpression = 187,
|
||||
TemplateSpan = 188,
|
||||
SemicolonClassElement = 189,
|
||||
Block = 190,
|
||||
VariableStatement = 191,
|
||||
EmptyStatement = 192,
|
||||
ExpressionStatement = 193,
|
||||
IfStatement = 194,
|
||||
DoStatement = 195,
|
||||
WhileStatement = 196,
|
||||
ForStatement = 197,
|
||||
ForInStatement = 198,
|
||||
ForOfStatement = 199,
|
||||
ContinueStatement = 200,
|
||||
BreakStatement = 201,
|
||||
ReturnStatement = 202,
|
||||
WithStatement = 203,
|
||||
SwitchStatement = 204,
|
||||
LabeledStatement = 205,
|
||||
ThrowStatement = 206,
|
||||
TryStatement = 207,
|
||||
DebuggerStatement = 208,
|
||||
VariableDeclaration = 209,
|
||||
VariableDeclarationList = 210,
|
||||
FunctionDeclaration = 211,
|
||||
ClassDeclaration = 212,
|
||||
InterfaceDeclaration = 213,
|
||||
TypeAliasDeclaration = 214,
|
||||
EnumDeclaration = 215,
|
||||
ModuleDeclaration = 216,
|
||||
ModuleBlock = 217,
|
||||
CaseBlock = 218,
|
||||
ImportEqualsDeclaration = 219,
|
||||
ImportDeclaration = 220,
|
||||
ImportClause = 221,
|
||||
NamespaceImport = 222,
|
||||
NamedImports = 223,
|
||||
ImportSpecifier = 224,
|
||||
ExportAssignment = 225,
|
||||
ExportDeclaration = 226,
|
||||
NamedExports = 227,
|
||||
ExportSpecifier = 228,
|
||||
MissingDeclaration = 229,
|
||||
ExternalModuleReference = 230,
|
||||
JsxElement = 231,
|
||||
JsxSelfClosingElement = 232,
|
||||
JsxOpeningElement = 233,
|
||||
JsxText = 234,
|
||||
JsxClosingElement = 235,
|
||||
JsxAttribute = 236,
|
||||
JsxSpreadAttribute = 237,
|
||||
JsxExpression = 238,
|
||||
CaseClause = 239,
|
||||
DefaultClause = 240,
|
||||
HeritageClause = 241,
|
||||
CatchClause = 242,
|
||||
PropertyAssignment = 243,
|
||||
ShorthandPropertyAssignment = 244,
|
||||
EnumMember = 245,
|
||||
SourceFile = 246,
|
||||
JSDocTypeExpression = 247,
|
||||
JSDocAllType = 248,
|
||||
JSDocUnknownType = 249,
|
||||
JSDocArrayType = 250,
|
||||
JSDocUnionType = 251,
|
||||
JSDocTupleType = 252,
|
||||
JSDocNullableType = 253,
|
||||
JSDocNonNullableType = 254,
|
||||
JSDocRecordType = 255,
|
||||
JSDocRecordMember = 256,
|
||||
JSDocTypeReference = 257,
|
||||
JSDocOptionalType = 258,
|
||||
JSDocFunctionType = 259,
|
||||
JSDocVariadicType = 260,
|
||||
JSDocConstructorType = 261,
|
||||
JSDocThisType = 262,
|
||||
JSDocComment = 263,
|
||||
JSDocTag = 264,
|
||||
JSDocParameterTag = 265,
|
||||
JSDocReturnTag = 266,
|
||||
JSDocTypeTag = 267,
|
||||
JSDocTemplateTag = 268,
|
||||
SyntaxList = 269,
|
||||
Count = 270,
|
||||
FirstAssignment = 55,
|
||||
LastAssignment = 66,
|
||||
FirstReservedWord = 68,
|
||||
LastReservedWord = 103,
|
||||
FirstKeyword = 68,
|
||||
LastKeyword = 132,
|
||||
FirstFutureReservedWord = 104,
|
||||
LastFutureReservedWord = 112,
|
||||
FirstTypeNode = 149,
|
||||
LastTypeNode = 158,
|
||||
AsteriskAsteriskToken = 38,
|
||||
SlashToken = 39,
|
||||
PercentToken = 40,
|
||||
PlusPlusToken = 41,
|
||||
MinusMinusToken = 42,
|
||||
LessThanLessThanToken = 43,
|
||||
GreaterThanGreaterThanToken = 44,
|
||||
GreaterThanGreaterThanGreaterThanToken = 45,
|
||||
AmpersandToken = 46,
|
||||
BarToken = 47,
|
||||
CaretToken = 48,
|
||||
ExclamationToken = 49,
|
||||
TildeToken = 50,
|
||||
AmpersandAmpersandToken = 51,
|
||||
BarBarToken = 52,
|
||||
QuestionToken = 53,
|
||||
ColonToken = 54,
|
||||
AtToken = 55,
|
||||
EqualsToken = 56,
|
||||
PlusEqualsToken = 57,
|
||||
MinusEqualsToken = 58,
|
||||
AsteriskEqualsToken = 59,
|
||||
AsteriskAsteriskEqualsToken = 60,
|
||||
SlashEqualsToken = 61,
|
||||
PercentEqualsToken = 62,
|
||||
LessThanLessThanEqualsToken = 63,
|
||||
GreaterThanGreaterThanEqualsToken = 64,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 65,
|
||||
AmpersandEqualsToken = 66,
|
||||
BarEqualsToken = 67,
|
||||
CaretEqualsToken = 68,
|
||||
Identifier = 69,
|
||||
BreakKeyword = 70,
|
||||
CaseKeyword = 71,
|
||||
CatchKeyword = 72,
|
||||
ClassKeyword = 73,
|
||||
ConstKeyword = 74,
|
||||
ContinueKeyword = 75,
|
||||
DebuggerKeyword = 76,
|
||||
DefaultKeyword = 77,
|
||||
DeleteKeyword = 78,
|
||||
DoKeyword = 79,
|
||||
ElseKeyword = 80,
|
||||
EnumKeyword = 81,
|
||||
ExportKeyword = 82,
|
||||
ExtendsKeyword = 83,
|
||||
FalseKeyword = 84,
|
||||
FinallyKeyword = 85,
|
||||
ForKeyword = 86,
|
||||
FunctionKeyword = 87,
|
||||
IfKeyword = 88,
|
||||
ImportKeyword = 89,
|
||||
InKeyword = 90,
|
||||
InstanceOfKeyword = 91,
|
||||
NewKeyword = 92,
|
||||
NullKeyword = 93,
|
||||
ReturnKeyword = 94,
|
||||
SuperKeyword = 95,
|
||||
SwitchKeyword = 96,
|
||||
ThisKeyword = 97,
|
||||
ThrowKeyword = 98,
|
||||
TrueKeyword = 99,
|
||||
TryKeyword = 100,
|
||||
TypeOfKeyword = 101,
|
||||
VarKeyword = 102,
|
||||
VoidKeyword = 103,
|
||||
WhileKeyword = 104,
|
||||
WithKeyword = 105,
|
||||
ImplementsKeyword = 106,
|
||||
InterfaceKeyword = 107,
|
||||
LetKeyword = 108,
|
||||
PackageKeyword = 109,
|
||||
PrivateKeyword = 110,
|
||||
ProtectedKeyword = 111,
|
||||
PublicKeyword = 112,
|
||||
StaticKeyword = 113,
|
||||
YieldKeyword = 114,
|
||||
AbstractKeyword = 115,
|
||||
AsKeyword = 116,
|
||||
AnyKeyword = 117,
|
||||
AsyncKeyword = 118,
|
||||
AwaitKeyword = 119,
|
||||
BooleanKeyword = 120,
|
||||
ConstructorKeyword = 121,
|
||||
DeclareKeyword = 122,
|
||||
GetKeyword = 123,
|
||||
IsKeyword = 124,
|
||||
ModuleKeyword = 125,
|
||||
NamespaceKeyword = 126,
|
||||
RequireKeyword = 127,
|
||||
NumberKeyword = 128,
|
||||
SetKeyword = 129,
|
||||
StringKeyword = 130,
|
||||
SymbolKeyword = 131,
|
||||
TypeKeyword = 132,
|
||||
FromKeyword = 133,
|
||||
OfKeyword = 134,
|
||||
QualifiedName = 135,
|
||||
ComputedPropertyName = 136,
|
||||
TypeParameter = 137,
|
||||
Parameter = 138,
|
||||
Decorator = 139,
|
||||
PropertySignature = 140,
|
||||
PropertyDeclaration = 141,
|
||||
MethodSignature = 142,
|
||||
MethodDeclaration = 143,
|
||||
Constructor = 144,
|
||||
GetAccessor = 145,
|
||||
SetAccessor = 146,
|
||||
CallSignature = 147,
|
||||
ConstructSignature = 148,
|
||||
IndexSignature = 149,
|
||||
TypePredicate = 150,
|
||||
TypeReference = 151,
|
||||
FunctionType = 152,
|
||||
ConstructorType = 153,
|
||||
TypeQuery = 154,
|
||||
TypeLiteral = 155,
|
||||
ArrayType = 156,
|
||||
TupleType = 157,
|
||||
UnionType = 158,
|
||||
IntersectionType = 159,
|
||||
ParenthesizedType = 160,
|
||||
ObjectBindingPattern = 161,
|
||||
ArrayBindingPattern = 162,
|
||||
BindingElement = 163,
|
||||
ArrayLiteralExpression = 164,
|
||||
ObjectLiteralExpression = 165,
|
||||
PropertyAccessExpression = 166,
|
||||
ElementAccessExpression = 167,
|
||||
CallExpression = 168,
|
||||
NewExpression = 169,
|
||||
TaggedTemplateExpression = 170,
|
||||
TypeAssertionExpression = 171,
|
||||
ParenthesizedExpression = 172,
|
||||
FunctionExpression = 173,
|
||||
ArrowFunction = 174,
|
||||
DeleteExpression = 175,
|
||||
TypeOfExpression = 176,
|
||||
VoidExpression = 177,
|
||||
AwaitExpression = 178,
|
||||
PrefixUnaryExpression = 179,
|
||||
PostfixUnaryExpression = 180,
|
||||
BinaryExpression = 181,
|
||||
ConditionalExpression = 182,
|
||||
TemplateExpression = 183,
|
||||
YieldExpression = 184,
|
||||
SpreadElementExpression = 185,
|
||||
ClassExpression = 186,
|
||||
OmittedExpression = 187,
|
||||
ExpressionWithTypeArguments = 188,
|
||||
AsExpression = 189,
|
||||
TemplateSpan = 190,
|
||||
SemicolonClassElement = 191,
|
||||
Block = 192,
|
||||
VariableStatement = 193,
|
||||
EmptyStatement = 194,
|
||||
ExpressionStatement = 195,
|
||||
IfStatement = 196,
|
||||
DoStatement = 197,
|
||||
WhileStatement = 198,
|
||||
ForStatement = 199,
|
||||
ForInStatement = 200,
|
||||
ForOfStatement = 201,
|
||||
ContinueStatement = 202,
|
||||
BreakStatement = 203,
|
||||
ReturnStatement = 204,
|
||||
WithStatement = 205,
|
||||
SwitchStatement = 206,
|
||||
LabeledStatement = 207,
|
||||
ThrowStatement = 208,
|
||||
TryStatement = 209,
|
||||
DebuggerStatement = 210,
|
||||
VariableDeclaration = 211,
|
||||
VariableDeclarationList = 212,
|
||||
FunctionDeclaration = 213,
|
||||
ClassDeclaration = 214,
|
||||
InterfaceDeclaration = 215,
|
||||
TypeAliasDeclaration = 216,
|
||||
EnumDeclaration = 217,
|
||||
ModuleDeclaration = 218,
|
||||
ModuleBlock = 219,
|
||||
CaseBlock = 220,
|
||||
ImportEqualsDeclaration = 221,
|
||||
ImportDeclaration = 222,
|
||||
ImportClause = 223,
|
||||
NamespaceImport = 224,
|
||||
NamedImports = 225,
|
||||
ImportSpecifier = 226,
|
||||
ExportAssignment = 227,
|
||||
ExportDeclaration = 228,
|
||||
NamedExports = 229,
|
||||
ExportSpecifier = 230,
|
||||
MissingDeclaration = 231,
|
||||
ExternalModuleReference = 232,
|
||||
JsxElement = 233,
|
||||
JsxSelfClosingElement = 234,
|
||||
JsxOpeningElement = 235,
|
||||
JsxText = 236,
|
||||
JsxClosingElement = 237,
|
||||
JsxAttribute = 238,
|
||||
JsxSpreadAttribute = 239,
|
||||
JsxExpression = 240,
|
||||
CaseClause = 241,
|
||||
DefaultClause = 242,
|
||||
HeritageClause = 243,
|
||||
CatchClause = 244,
|
||||
PropertyAssignment = 245,
|
||||
ShorthandPropertyAssignment = 246,
|
||||
EnumMember = 247,
|
||||
SourceFile = 248,
|
||||
JSDocTypeExpression = 249,
|
||||
JSDocAllType = 250,
|
||||
JSDocUnknownType = 251,
|
||||
JSDocArrayType = 252,
|
||||
JSDocUnionType = 253,
|
||||
JSDocTupleType = 254,
|
||||
JSDocNullableType = 255,
|
||||
JSDocNonNullableType = 256,
|
||||
JSDocRecordType = 257,
|
||||
JSDocRecordMember = 258,
|
||||
JSDocTypeReference = 259,
|
||||
JSDocOptionalType = 260,
|
||||
JSDocFunctionType = 261,
|
||||
JSDocVariadicType = 262,
|
||||
JSDocConstructorType = 263,
|
||||
JSDocThisType = 264,
|
||||
JSDocComment = 265,
|
||||
JSDocTag = 266,
|
||||
JSDocParameterTag = 267,
|
||||
JSDocReturnTag = 268,
|
||||
JSDocTypeTag = 269,
|
||||
JSDocTemplateTag = 270,
|
||||
SyntaxList = 271,
|
||||
Count = 272,
|
||||
FirstAssignment = 56,
|
||||
LastAssignment = 68,
|
||||
FirstReservedWord = 70,
|
||||
LastReservedWord = 105,
|
||||
FirstKeyword = 70,
|
||||
LastKeyword = 134,
|
||||
FirstFutureReservedWord = 106,
|
||||
LastFutureReservedWord = 114,
|
||||
FirstTypeNode = 151,
|
||||
LastTypeNode = 160,
|
||||
FirstPunctuation = 15,
|
||||
LastPunctuation = 66,
|
||||
LastPunctuation = 68,
|
||||
FirstToken = 0,
|
||||
LastToken = 132,
|
||||
LastToken = 134,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
@@ -322,8 +324,8 @@ declare namespace ts {
|
||||
FirstTemplateToken = 11,
|
||||
LastTemplateToken = 14,
|
||||
FirstBinaryOperator = 25,
|
||||
LastBinaryOperator = 66,
|
||||
FirstNode = 133,
|
||||
LastBinaryOperator = 68,
|
||||
FirstNode = 135,
|
||||
}
|
||||
const enum NodeFlags {
|
||||
Export = 1,
|
||||
@@ -343,6 +345,7 @@ declare namespace ts {
|
||||
OctalLiteral = 65536,
|
||||
Namespace = 131072,
|
||||
ExportContext = 262144,
|
||||
ContainsThis = 524288,
|
||||
Modifier = 2035,
|
||||
AccessibilityModifier = 112,
|
||||
BlockScoped = 49152,
|
||||
@@ -438,6 +441,8 @@ declare namespace ts {
|
||||
interface ShorthandPropertyAssignment extends ObjectLiteralElement {
|
||||
name: Identifier;
|
||||
questionToken?: Node;
|
||||
equalsToken?: Node;
|
||||
objectAssignmentInitializer?: Expression;
|
||||
}
|
||||
interface VariableLikeDeclaration extends Declaration {
|
||||
propertyName?: Identifier;
|
||||
@@ -530,18 +535,21 @@ declare namespace ts {
|
||||
interface UnaryExpression extends Expression {
|
||||
_unaryExpressionBrand: any;
|
||||
}
|
||||
interface PrefixUnaryExpression extends UnaryExpression {
|
||||
interface IncrementExpression extends UnaryExpression {
|
||||
_incrementExpressionBrand: any;
|
||||
}
|
||||
interface PrefixUnaryExpression extends IncrementExpression {
|
||||
operator: SyntaxKind;
|
||||
operand: UnaryExpression;
|
||||
}
|
||||
interface PostfixUnaryExpression extends PostfixExpression {
|
||||
interface PostfixUnaryExpression extends IncrementExpression {
|
||||
operand: LeftHandSideExpression;
|
||||
operator: SyntaxKind;
|
||||
}
|
||||
interface PostfixExpression extends UnaryExpression {
|
||||
_postfixExpressionBrand: any;
|
||||
}
|
||||
interface LeftHandSideExpression extends PostfixExpression {
|
||||
interface LeftHandSideExpression extends IncrementExpression {
|
||||
_leftHandSideExpressionBrand: any;
|
||||
}
|
||||
interface MemberExpression extends LeftHandSideExpression {
|
||||
@@ -1082,6 +1090,7 @@ declare namespace ts {
|
||||
decreaseIndent(): void;
|
||||
clear(): void;
|
||||
trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
|
||||
reportInaccessibleThisError(): void;
|
||||
}
|
||||
const enum TypeFormatFlags {
|
||||
None = 0,
|
||||
@@ -1202,6 +1211,7 @@ declare namespace ts {
|
||||
Instantiated = 131072,
|
||||
ObjectLiteral = 524288,
|
||||
ESSymbol = 16777216,
|
||||
ThisType = 33554432,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 80896,
|
||||
@@ -1223,6 +1233,7 @@ declare namespace ts {
|
||||
typeParameters: TypeParameter[];
|
||||
outerTypeParameters: TypeParameter[];
|
||||
localTypeParameters: TypeParameter[];
|
||||
thisType: TypeParameter;
|
||||
}
|
||||
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
||||
declaredProperties: Symbol[];
|
||||
@@ -1337,7 +1348,6 @@ declare namespace ts {
|
||||
watch?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
experimentalAsyncFunctions?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
moduleResolution?: ModuleResolutionKind;
|
||||
[option: string]: string | number | boolean;
|
||||
@@ -1348,6 +1358,8 @@ declare namespace ts {
|
||||
AMD = 2,
|
||||
UMD = 3,
|
||||
System = 4,
|
||||
ES6 = 5,
|
||||
ES2015 = 5,
|
||||
}
|
||||
const enum JsxEmit {
|
||||
None = 0,
|
||||
@@ -1366,6 +1378,7 @@ declare namespace ts {
|
||||
ES3 = 0,
|
||||
ES5 = 1,
|
||||
ES6 = 2,
|
||||
ES2015 = 2,
|
||||
Latest = 2,
|
||||
}
|
||||
const enum LanguageVariant {
|
||||
@@ -1417,7 +1430,8 @@ declare namespace ts {
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string) => void): FileWatcher;
|
||||
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
|
||||
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
@@ -1507,6 +1521,7 @@ declare namespace ts {
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function arrayStructurallyIsEqualTo<T>(array1: Array<T>, array2: Array<T>): boolean;
|
||||
}
|
||||
declare namespace ts {
|
||||
function getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
@@ -1542,7 +1557,7 @@ declare namespace ts {
|
||||
* @param fileName The path to the config file
|
||||
* @param jsonText The text of the config file
|
||||
*/
|
||||
function parseConfigFileText(fileName: string, jsonText: string): {
|
||||
function parseConfigFileTextToJson(fileName: string, jsonText: string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
@@ -1552,7 +1567,7 @@ declare namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
|
||||
}
|
||||
declare namespace ts {
|
||||
/** The version of the language service API */
|
||||
@@ -1775,6 +1790,12 @@ declare namespace ts {
|
||||
TabSize: number;
|
||||
NewLineCharacter: string;
|
||||
ConvertTabsToSpaces: boolean;
|
||||
IndentStyle: IndentStyle;
|
||||
}
|
||||
enum IndentStyle {
|
||||
None = 0,
|
||||
Block = 1,
|
||||
Smart = 2,
|
||||
}
|
||||
interface FormatCodeOptions extends EditorOptions {
|
||||
InsertSpaceAfterCommaDelimiter: boolean;
|
||||
|
||||
+11679
-10829
File diff suppressed because it is too large
Load Diff
Vendored
+275
-254
@@ -68,253 +68,255 @@ declare namespace ts {
|
||||
PlusToken = 35,
|
||||
MinusToken = 36,
|
||||
AsteriskToken = 37,
|
||||
SlashToken = 38,
|
||||
PercentToken = 39,
|
||||
PlusPlusToken = 40,
|
||||
MinusMinusToken = 41,
|
||||
LessThanLessThanToken = 42,
|
||||
GreaterThanGreaterThanToken = 43,
|
||||
GreaterThanGreaterThanGreaterThanToken = 44,
|
||||
AmpersandToken = 45,
|
||||
BarToken = 46,
|
||||
CaretToken = 47,
|
||||
ExclamationToken = 48,
|
||||
TildeToken = 49,
|
||||
AmpersandAmpersandToken = 50,
|
||||
BarBarToken = 51,
|
||||
QuestionToken = 52,
|
||||
ColonToken = 53,
|
||||
AtToken = 54,
|
||||
EqualsToken = 55,
|
||||
PlusEqualsToken = 56,
|
||||
MinusEqualsToken = 57,
|
||||
AsteriskEqualsToken = 58,
|
||||
SlashEqualsToken = 59,
|
||||
PercentEqualsToken = 60,
|
||||
LessThanLessThanEqualsToken = 61,
|
||||
GreaterThanGreaterThanEqualsToken = 62,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 63,
|
||||
AmpersandEqualsToken = 64,
|
||||
BarEqualsToken = 65,
|
||||
CaretEqualsToken = 66,
|
||||
Identifier = 67,
|
||||
BreakKeyword = 68,
|
||||
CaseKeyword = 69,
|
||||
CatchKeyword = 70,
|
||||
ClassKeyword = 71,
|
||||
ConstKeyword = 72,
|
||||
ContinueKeyword = 73,
|
||||
DebuggerKeyword = 74,
|
||||
DefaultKeyword = 75,
|
||||
DeleteKeyword = 76,
|
||||
DoKeyword = 77,
|
||||
ElseKeyword = 78,
|
||||
EnumKeyword = 79,
|
||||
ExportKeyword = 80,
|
||||
ExtendsKeyword = 81,
|
||||
FalseKeyword = 82,
|
||||
FinallyKeyword = 83,
|
||||
ForKeyword = 84,
|
||||
FunctionKeyword = 85,
|
||||
IfKeyword = 86,
|
||||
ImportKeyword = 87,
|
||||
InKeyword = 88,
|
||||
InstanceOfKeyword = 89,
|
||||
NewKeyword = 90,
|
||||
NullKeyword = 91,
|
||||
ReturnKeyword = 92,
|
||||
SuperKeyword = 93,
|
||||
SwitchKeyword = 94,
|
||||
ThisKeyword = 95,
|
||||
ThrowKeyword = 96,
|
||||
TrueKeyword = 97,
|
||||
TryKeyword = 98,
|
||||
TypeOfKeyword = 99,
|
||||
VarKeyword = 100,
|
||||
VoidKeyword = 101,
|
||||
WhileKeyword = 102,
|
||||
WithKeyword = 103,
|
||||
ImplementsKeyword = 104,
|
||||
InterfaceKeyword = 105,
|
||||
LetKeyword = 106,
|
||||
PackageKeyword = 107,
|
||||
PrivateKeyword = 108,
|
||||
ProtectedKeyword = 109,
|
||||
PublicKeyword = 110,
|
||||
StaticKeyword = 111,
|
||||
YieldKeyword = 112,
|
||||
AbstractKeyword = 113,
|
||||
AsKeyword = 114,
|
||||
AnyKeyword = 115,
|
||||
AsyncKeyword = 116,
|
||||
AwaitKeyword = 117,
|
||||
BooleanKeyword = 118,
|
||||
ConstructorKeyword = 119,
|
||||
DeclareKeyword = 120,
|
||||
GetKeyword = 121,
|
||||
IsKeyword = 122,
|
||||
ModuleKeyword = 123,
|
||||
NamespaceKeyword = 124,
|
||||
RequireKeyword = 125,
|
||||
NumberKeyword = 126,
|
||||
SetKeyword = 127,
|
||||
StringKeyword = 128,
|
||||
SymbolKeyword = 129,
|
||||
TypeKeyword = 130,
|
||||
FromKeyword = 131,
|
||||
OfKeyword = 132,
|
||||
QualifiedName = 133,
|
||||
ComputedPropertyName = 134,
|
||||
TypeParameter = 135,
|
||||
Parameter = 136,
|
||||
Decorator = 137,
|
||||
PropertySignature = 138,
|
||||
PropertyDeclaration = 139,
|
||||
MethodSignature = 140,
|
||||
MethodDeclaration = 141,
|
||||
Constructor = 142,
|
||||
GetAccessor = 143,
|
||||
SetAccessor = 144,
|
||||
CallSignature = 145,
|
||||
ConstructSignature = 146,
|
||||
IndexSignature = 147,
|
||||
TypePredicate = 148,
|
||||
TypeReference = 149,
|
||||
FunctionType = 150,
|
||||
ConstructorType = 151,
|
||||
TypeQuery = 152,
|
||||
TypeLiteral = 153,
|
||||
ArrayType = 154,
|
||||
TupleType = 155,
|
||||
UnionType = 156,
|
||||
IntersectionType = 157,
|
||||
ParenthesizedType = 158,
|
||||
ObjectBindingPattern = 159,
|
||||
ArrayBindingPattern = 160,
|
||||
BindingElement = 161,
|
||||
ArrayLiteralExpression = 162,
|
||||
ObjectLiteralExpression = 163,
|
||||
PropertyAccessExpression = 164,
|
||||
ElementAccessExpression = 165,
|
||||
CallExpression = 166,
|
||||
NewExpression = 167,
|
||||
TaggedTemplateExpression = 168,
|
||||
TypeAssertionExpression = 169,
|
||||
ParenthesizedExpression = 170,
|
||||
FunctionExpression = 171,
|
||||
ArrowFunction = 172,
|
||||
DeleteExpression = 173,
|
||||
TypeOfExpression = 174,
|
||||
VoidExpression = 175,
|
||||
AwaitExpression = 176,
|
||||
PrefixUnaryExpression = 177,
|
||||
PostfixUnaryExpression = 178,
|
||||
BinaryExpression = 179,
|
||||
ConditionalExpression = 180,
|
||||
TemplateExpression = 181,
|
||||
YieldExpression = 182,
|
||||
SpreadElementExpression = 183,
|
||||
ClassExpression = 184,
|
||||
OmittedExpression = 185,
|
||||
ExpressionWithTypeArguments = 186,
|
||||
AsExpression = 187,
|
||||
TemplateSpan = 188,
|
||||
SemicolonClassElement = 189,
|
||||
Block = 190,
|
||||
VariableStatement = 191,
|
||||
EmptyStatement = 192,
|
||||
ExpressionStatement = 193,
|
||||
IfStatement = 194,
|
||||
DoStatement = 195,
|
||||
WhileStatement = 196,
|
||||
ForStatement = 197,
|
||||
ForInStatement = 198,
|
||||
ForOfStatement = 199,
|
||||
ContinueStatement = 200,
|
||||
BreakStatement = 201,
|
||||
ReturnStatement = 202,
|
||||
WithStatement = 203,
|
||||
SwitchStatement = 204,
|
||||
LabeledStatement = 205,
|
||||
ThrowStatement = 206,
|
||||
TryStatement = 207,
|
||||
DebuggerStatement = 208,
|
||||
VariableDeclaration = 209,
|
||||
VariableDeclarationList = 210,
|
||||
FunctionDeclaration = 211,
|
||||
ClassDeclaration = 212,
|
||||
InterfaceDeclaration = 213,
|
||||
TypeAliasDeclaration = 214,
|
||||
EnumDeclaration = 215,
|
||||
ModuleDeclaration = 216,
|
||||
ModuleBlock = 217,
|
||||
CaseBlock = 218,
|
||||
ImportEqualsDeclaration = 219,
|
||||
ImportDeclaration = 220,
|
||||
ImportClause = 221,
|
||||
NamespaceImport = 222,
|
||||
NamedImports = 223,
|
||||
ImportSpecifier = 224,
|
||||
ExportAssignment = 225,
|
||||
ExportDeclaration = 226,
|
||||
NamedExports = 227,
|
||||
ExportSpecifier = 228,
|
||||
MissingDeclaration = 229,
|
||||
ExternalModuleReference = 230,
|
||||
JsxElement = 231,
|
||||
JsxSelfClosingElement = 232,
|
||||
JsxOpeningElement = 233,
|
||||
JsxText = 234,
|
||||
JsxClosingElement = 235,
|
||||
JsxAttribute = 236,
|
||||
JsxSpreadAttribute = 237,
|
||||
JsxExpression = 238,
|
||||
CaseClause = 239,
|
||||
DefaultClause = 240,
|
||||
HeritageClause = 241,
|
||||
CatchClause = 242,
|
||||
PropertyAssignment = 243,
|
||||
ShorthandPropertyAssignment = 244,
|
||||
EnumMember = 245,
|
||||
SourceFile = 246,
|
||||
JSDocTypeExpression = 247,
|
||||
JSDocAllType = 248,
|
||||
JSDocUnknownType = 249,
|
||||
JSDocArrayType = 250,
|
||||
JSDocUnionType = 251,
|
||||
JSDocTupleType = 252,
|
||||
JSDocNullableType = 253,
|
||||
JSDocNonNullableType = 254,
|
||||
JSDocRecordType = 255,
|
||||
JSDocRecordMember = 256,
|
||||
JSDocTypeReference = 257,
|
||||
JSDocOptionalType = 258,
|
||||
JSDocFunctionType = 259,
|
||||
JSDocVariadicType = 260,
|
||||
JSDocConstructorType = 261,
|
||||
JSDocThisType = 262,
|
||||
JSDocComment = 263,
|
||||
JSDocTag = 264,
|
||||
JSDocParameterTag = 265,
|
||||
JSDocReturnTag = 266,
|
||||
JSDocTypeTag = 267,
|
||||
JSDocTemplateTag = 268,
|
||||
SyntaxList = 269,
|
||||
Count = 270,
|
||||
FirstAssignment = 55,
|
||||
LastAssignment = 66,
|
||||
FirstReservedWord = 68,
|
||||
LastReservedWord = 103,
|
||||
FirstKeyword = 68,
|
||||
LastKeyword = 132,
|
||||
FirstFutureReservedWord = 104,
|
||||
LastFutureReservedWord = 112,
|
||||
FirstTypeNode = 149,
|
||||
LastTypeNode = 158,
|
||||
AsteriskAsteriskToken = 38,
|
||||
SlashToken = 39,
|
||||
PercentToken = 40,
|
||||
PlusPlusToken = 41,
|
||||
MinusMinusToken = 42,
|
||||
LessThanLessThanToken = 43,
|
||||
GreaterThanGreaterThanToken = 44,
|
||||
GreaterThanGreaterThanGreaterThanToken = 45,
|
||||
AmpersandToken = 46,
|
||||
BarToken = 47,
|
||||
CaretToken = 48,
|
||||
ExclamationToken = 49,
|
||||
TildeToken = 50,
|
||||
AmpersandAmpersandToken = 51,
|
||||
BarBarToken = 52,
|
||||
QuestionToken = 53,
|
||||
ColonToken = 54,
|
||||
AtToken = 55,
|
||||
EqualsToken = 56,
|
||||
PlusEqualsToken = 57,
|
||||
MinusEqualsToken = 58,
|
||||
AsteriskEqualsToken = 59,
|
||||
AsteriskAsteriskEqualsToken = 60,
|
||||
SlashEqualsToken = 61,
|
||||
PercentEqualsToken = 62,
|
||||
LessThanLessThanEqualsToken = 63,
|
||||
GreaterThanGreaterThanEqualsToken = 64,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 65,
|
||||
AmpersandEqualsToken = 66,
|
||||
BarEqualsToken = 67,
|
||||
CaretEqualsToken = 68,
|
||||
Identifier = 69,
|
||||
BreakKeyword = 70,
|
||||
CaseKeyword = 71,
|
||||
CatchKeyword = 72,
|
||||
ClassKeyword = 73,
|
||||
ConstKeyword = 74,
|
||||
ContinueKeyword = 75,
|
||||
DebuggerKeyword = 76,
|
||||
DefaultKeyword = 77,
|
||||
DeleteKeyword = 78,
|
||||
DoKeyword = 79,
|
||||
ElseKeyword = 80,
|
||||
EnumKeyword = 81,
|
||||
ExportKeyword = 82,
|
||||
ExtendsKeyword = 83,
|
||||
FalseKeyword = 84,
|
||||
FinallyKeyword = 85,
|
||||
ForKeyword = 86,
|
||||
FunctionKeyword = 87,
|
||||
IfKeyword = 88,
|
||||
ImportKeyword = 89,
|
||||
InKeyword = 90,
|
||||
InstanceOfKeyword = 91,
|
||||
NewKeyword = 92,
|
||||
NullKeyword = 93,
|
||||
ReturnKeyword = 94,
|
||||
SuperKeyword = 95,
|
||||
SwitchKeyword = 96,
|
||||
ThisKeyword = 97,
|
||||
ThrowKeyword = 98,
|
||||
TrueKeyword = 99,
|
||||
TryKeyword = 100,
|
||||
TypeOfKeyword = 101,
|
||||
VarKeyword = 102,
|
||||
VoidKeyword = 103,
|
||||
WhileKeyword = 104,
|
||||
WithKeyword = 105,
|
||||
ImplementsKeyword = 106,
|
||||
InterfaceKeyword = 107,
|
||||
LetKeyword = 108,
|
||||
PackageKeyword = 109,
|
||||
PrivateKeyword = 110,
|
||||
ProtectedKeyword = 111,
|
||||
PublicKeyword = 112,
|
||||
StaticKeyword = 113,
|
||||
YieldKeyword = 114,
|
||||
AbstractKeyword = 115,
|
||||
AsKeyword = 116,
|
||||
AnyKeyword = 117,
|
||||
AsyncKeyword = 118,
|
||||
AwaitKeyword = 119,
|
||||
BooleanKeyword = 120,
|
||||
ConstructorKeyword = 121,
|
||||
DeclareKeyword = 122,
|
||||
GetKeyword = 123,
|
||||
IsKeyword = 124,
|
||||
ModuleKeyword = 125,
|
||||
NamespaceKeyword = 126,
|
||||
RequireKeyword = 127,
|
||||
NumberKeyword = 128,
|
||||
SetKeyword = 129,
|
||||
StringKeyword = 130,
|
||||
SymbolKeyword = 131,
|
||||
TypeKeyword = 132,
|
||||
FromKeyword = 133,
|
||||
OfKeyword = 134,
|
||||
QualifiedName = 135,
|
||||
ComputedPropertyName = 136,
|
||||
TypeParameter = 137,
|
||||
Parameter = 138,
|
||||
Decorator = 139,
|
||||
PropertySignature = 140,
|
||||
PropertyDeclaration = 141,
|
||||
MethodSignature = 142,
|
||||
MethodDeclaration = 143,
|
||||
Constructor = 144,
|
||||
GetAccessor = 145,
|
||||
SetAccessor = 146,
|
||||
CallSignature = 147,
|
||||
ConstructSignature = 148,
|
||||
IndexSignature = 149,
|
||||
TypePredicate = 150,
|
||||
TypeReference = 151,
|
||||
FunctionType = 152,
|
||||
ConstructorType = 153,
|
||||
TypeQuery = 154,
|
||||
TypeLiteral = 155,
|
||||
ArrayType = 156,
|
||||
TupleType = 157,
|
||||
UnionType = 158,
|
||||
IntersectionType = 159,
|
||||
ParenthesizedType = 160,
|
||||
ObjectBindingPattern = 161,
|
||||
ArrayBindingPattern = 162,
|
||||
BindingElement = 163,
|
||||
ArrayLiteralExpression = 164,
|
||||
ObjectLiteralExpression = 165,
|
||||
PropertyAccessExpression = 166,
|
||||
ElementAccessExpression = 167,
|
||||
CallExpression = 168,
|
||||
NewExpression = 169,
|
||||
TaggedTemplateExpression = 170,
|
||||
TypeAssertionExpression = 171,
|
||||
ParenthesizedExpression = 172,
|
||||
FunctionExpression = 173,
|
||||
ArrowFunction = 174,
|
||||
DeleteExpression = 175,
|
||||
TypeOfExpression = 176,
|
||||
VoidExpression = 177,
|
||||
AwaitExpression = 178,
|
||||
PrefixUnaryExpression = 179,
|
||||
PostfixUnaryExpression = 180,
|
||||
BinaryExpression = 181,
|
||||
ConditionalExpression = 182,
|
||||
TemplateExpression = 183,
|
||||
YieldExpression = 184,
|
||||
SpreadElementExpression = 185,
|
||||
ClassExpression = 186,
|
||||
OmittedExpression = 187,
|
||||
ExpressionWithTypeArguments = 188,
|
||||
AsExpression = 189,
|
||||
TemplateSpan = 190,
|
||||
SemicolonClassElement = 191,
|
||||
Block = 192,
|
||||
VariableStatement = 193,
|
||||
EmptyStatement = 194,
|
||||
ExpressionStatement = 195,
|
||||
IfStatement = 196,
|
||||
DoStatement = 197,
|
||||
WhileStatement = 198,
|
||||
ForStatement = 199,
|
||||
ForInStatement = 200,
|
||||
ForOfStatement = 201,
|
||||
ContinueStatement = 202,
|
||||
BreakStatement = 203,
|
||||
ReturnStatement = 204,
|
||||
WithStatement = 205,
|
||||
SwitchStatement = 206,
|
||||
LabeledStatement = 207,
|
||||
ThrowStatement = 208,
|
||||
TryStatement = 209,
|
||||
DebuggerStatement = 210,
|
||||
VariableDeclaration = 211,
|
||||
VariableDeclarationList = 212,
|
||||
FunctionDeclaration = 213,
|
||||
ClassDeclaration = 214,
|
||||
InterfaceDeclaration = 215,
|
||||
TypeAliasDeclaration = 216,
|
||||
EnumDeclaration = 217,
|
||||
ModuleDeclaration = 218,
|
||||
ModuleBlock = 219,
|
||||
CaseBlock = 220,
|
||||
ImportEqualsDeclaration = 221,
|
||||
ImportDeclaration = 222,
|
||||
ImportClause = 223,
|
||||
NamespaceImport = 224,
|
||||
NamedImports = 225,
|
||||
ImportSpecifier = 226,
|
||||
ExportAssignment = 227,
|
||||
ExportDeclaration = 228,
|
||||
NamedExports = 229,
|
||||
ExportSpecifier = 230,
|
||||
MissingDeclaration = 231,
|
||||
ExternalModuleReference = 232,
|
||||
JsxElement = 233,
|
||||
JsxSelfClosingElement = 234,
|
||||
JsxOpeningElement = 235,
|
||||
JsxText = 236,
|
||||
JsxClosingElement = 237,
|
||||
JsxAttribute = 238,
|
||||
JsxSpreadAttribute = 239,
|
||||
JsxExpression = 240,
|
||||
CaseClause = 241,
|
||||
DefaultClause = 242,
|
||||
HeritageClause = 243,
|
||||
CatchClause = 244,
|
||||
PropertyAssignment = 245,
|
||||
ShorthandPropertyAssignment = 246,
|
||||
EnumMember = 247,
|
||||
SourceFile = 248,
|
||||
JSDocTypeExpression = 249,
|
||||
JSDocAllType = 250,
|
||||
JSDocUnknownType = 251,
|
||||
JSDocArrayType = 252,
|
||||
JSDocUnionType = 253,
|
||||
JSDocTupleType = 254,
|
||||
JSDocNullableType = 255,
|
||||
JSDocNonNullableType = 256,
|
||||
JSDocRecordType = 257,
|
||||
JSDocRecordMember = 258,
|
||||
JSDocTypeReference = 259,
|
||||
JSDocOptionalType = 260,
|
||||
JSDocFunctionType = 261,
|
||||
JSDocVariadicType = 262,
|
||||
JSDocConstructorType = 263,
|
||||
JSDocThisType = 264,
|
||||
JSDocComment = 265,
|
||||
JSDocTag = 266,
|
||||
JSDocParameterTag = 267,
|
||||
JSDocReturnTag = 268,
|
||||
JSDocTypeTag = 269,
|
||||
JSDocTemplateTag = 270,
|
||||
SyntaxList = 271,
|
||||
Count = 272,
|
||||
FirstAssignment = 56,
|
||||
LastAssignment = 68,
|
||||
FirstReservedWord = 70,
|
||||
LastReservedWord = 105,
|
||||
FirstKeyword = 70,
|
||||
LastKeyword = 134,
|
||||
FirstFutureReservedWord = 106,
|
||||
LastFutureReservedWord = 114,
|
||||
FirstTypeNode = 151,
|
||||
LastTypeNode = 160,
|
||||
FirstPunctuation = 15,
|
||||
LastPunctuation = 66,
|
||||
LastPunctuation = 68,
|
||||
FirstToken = 0,
|
||||
LastToken = 132,
|
||||
LastToken = 134,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
@@ -322,8 +324,8 @@ declare namespace ts {
|
||||
FirstTemplateToken = 11,
|
||||
LastTemplateToken = 14,
|
||||
FirstBinaryOperator = 25,
|
||||
LastBinaryOperator = 66,
|
||||
FirstNode = 133,
|
||||
LastBinaryOperator = 68,
|
||||
FirstNode = 135,
|
||||
}
|
||||
const enum NodeFlags {
|
||||
Export = 1,
|
||||
@@ -343,6 +345,7 @@ declare namespace ts {
|
||||
OctalLiteral = 65536,
|
||||
Namespace = 131072,
|
||||
ExportContext = 262144,
|
||||
ContainsThis = 524288,
|
||||
Modifier = 2035,
|
||||
AccessibilityModifier = 112,
|
||||
BlockScoped = 49152,
|
||||
@@ -438,6 +441,8 @@ declare namespace ts {
|
||||
interface ShorthandPropertyAssignment extends ObjectLiteralElement {
|
||||
name: Identifier;
|
||||
questionToken?: Node;
|
||||
equalsToken?: Node;
|
||||
objectAssignmentInitializer?: Expression;
|
||||
}
|
||||
interface VariableLikeDeclaration extends Declaration {
|
||||
propertyName?: Identifier;
|
||||
@@ -530,18 +535,21 @@ declare namespace ts {
|
||||
interface UnaryExpression extends Expression {
|
||||
_unaryExpressionBrand: any;
|
||||
}
|
||||
interface PrefixUnaryExpression extends UnaryExpression {
|
||||
interface IncrementExpression extends UnaryExpression {
|
||||
_incrementExpressionBrand: any;
|
||||
}
|
||||
interface PrefixUnaryExpression extends IncrementExpression {
|
||||
operator: SyntaxKind;
|
||||
operand: UnaryExpression;
|
||||
}
|
||||
interface PostfixUnaryExpression extends PostfixExpression {
|
||||
interface PostfixUnaryExpression extends IncrementExpression {
|
||||
operand: LeftHandSideExpression;
|
||||
operator: SyntaxKind;
|
||||
}
|
||||
interface PostfixExpression extends UnaryExpression {
|
||||
_postfixExpressionBrand: any;
|
||||
}
|
||||
interface LeftHandSideExpression extends PostfixExpression {
|
||||
interface LeftHandSideExpression extends IncrementExpression {
|
||||
_leftHandSideExpressionBrand: any;
|
||||
}
|
||||
interface MemberExpression extends LeftHandSideExpression {
|
||||
@@ -1082,6 +1090,7 @@ declare namespace ts {
|
||||
decreaseIndent(): void;
|
||||
clear(): void;
|
||||
trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void;
|
||||
reportInaccessibleThisError(): void;
|
||||
}
|
||||
const enum TypeFormatFlags {
|
||||
None = 0,
|
||||
@@ -1202,6 +1211,7 @@ declare namespace ts {
|
||||
Instantiated = 131072,
|
||||
ObjectLiteral = 524288,
|
||||
ESSymbol = 16777216,
|
||||
ThisType = 33554432,
|
||||
StringLike = 258,
|
||||
NumberLike = 132,
|
||||
ObjectType = 80896,
|
||||
@@ -1223,6 +1233,7 @@ declare namespace ts {
|
||||
typeParameters: TypeParameter[];
|
||||
outerTypeParameters: TypeParameter[];
|
||||
localTypeParameters: TypeParameter[];
|
||||
thisType: TypeParameter;
|
||||
}
|
||||
interface InterfaceTypeWithDeclaredMembers extends InterfaceType {
|
||||
declaredProperties: Symbol[];
|
||||
@@ -1337,7 +1348,6 @@ declare namespace ts {
|
||||
watch?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
experimentalAsyncFunctions?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
moduleResolution?: ModuleResolutionKind;
|
||||
[option: string]: string | number | boolean;
|
||||
@@ -1348,6 +1358,8 @@ declare namespace ts {
|
||||
AMD = 2,
|
||||
UMD = 3,
|
||||
System = 4,
|
||||
ES6 = 5,
|
||||
ES2015 = 5,
|
||||
}
|
||||
const enum JsxEmit {
|
||||
None = 0,
|
||||
@@ -1366,6 +1378,7 @@ declare namespace ts {
|
||||
ES3 = 0,
|
||||
ES5 = 1,
|
||||
ES6 = 2,
|
||||
ES2015 = 2,
|
||||
Latest = 2,
|
||||
}
|
||||
const enum LanguageVariant {
|
||||
@@ -1417,7 +1430,8 @@ declare namespace ts {
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string) => void): FileWatcher;
|
||||
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
|
||||
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
@@ -1507,6 +1521,7 @@ declare namespace ts {
|
||||
*/
|
||||
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
|
||||
function getTypeParameterOwner(d: Declaration): Declaration;
|
||||
function arrayStructurallyIsEqualTo<T>(array1: Array<T>, array2: Array<T>): boolean;
|
||||
}
|
||||
declare namespace ts {
|
||||
function getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
@@ -1542,7 +1557,7 @@ declare namespace ts {
|
||||
* @param fileName The path to the config file
|
||||
* @param jsonText The text of the config file
|
||||
*/
|
||||
function parseConfigFileText(fileName: string, jsonText: string): {
|
||||
function parseConfigFileTextToJson(fileName: string, jsonText: string): {
|
||||
config?: any;
|
||||
error?: Diagnostic;
|
||||
};
|
||||
@@ -1552,7 +1567,7 @@ declare namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
|
||||
}
|
||||
declare namespace ts {
|
||||
/** The version of the language service API */
|
||||
@@ -1775,6 +1790,12 @@ declare namespace ts {
|
||||
TabSize: number;
|
||||
NewLineCharacter: string;
|
||||
ConvertTabsToSpaces: boolean;
|
||||
IndentStyle: IndentStyle;
|
||||
}
|
||||
enum IndentStyle {
|
||||
None = 0,
|
||||
Block = 1,
|
||||
Smart = 2,
|
||||
}
|
||||
interface FormatCodeOptions extends EditorOptions {
|
||||
InsertSpaceAfterCommaDelimiter: boolean;
|
||||
|
||||
+11679
-10829
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.7.0",
|
||||
"version": "1.8.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/// <reference path="../../node_modules/tslint/typings/typescriptServices.d.ts" />
|
||||
/// <reference path="../../node_modules/tslint/lib/tslint.d.ts" />
|
||||
|
||||
|
||||
export class Rule extends Lint.Rules.AbstractRule {
|
||||
public static FAILURE_STRING = "The '|' and '&' operators must be surrounded by single spaces";
|
||||
|
||||
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
|
||||
return this.applyWithWalker(new TypeOperatorSpacingWalker(sourceFile, this.getOptions()));
|
||||
}
|
||||
}
|
||||
|
||||
class TypeOperatorSpacingWalker extends Lint.RuleWalker {
|
||||
public visitNode(node: ts.Node) {
|
||||
if (node.kind === ts.SyntaxKind.UnionType || node.kind === ts.SyntaxKind.IntersectionType) {
|
||||
let types = (<ts.UnionOrIntersectionTypeNode>node).types;
|
||||
let expectedStart = types[0].end + 2; // space, | or &
|
||||
for (let i = 1; i < types.length; i++) {
|
||||
let currentType = types[i];
|
||||
if (expectedStart !== currentType.pos || currentType.getLeadingTriviaWidth() !== 1) {
|
||||
const failure = this.createFailure(currentType.pos, currentType.getWidth(), Rule.FAILURE_STRING);
|
||||
this.addFailure(failure);
|
||||
}
|
||||
expectedStart = currentType.end + 2;
|
||||
}
|
||||
}
|
||||
super.visitNode(node);
|
||||
}
|
||||
}
|
||||
@@ -185,8 +185,9 @@ namespace ts {
|
||||
function declareSymbol(symbolTable: SymbolTable, parent: Symbol, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags): Symbol {
|
||||
Debug.assert(!hasDynamicName(node));
|
||||
|
||||
let isDefaultExport = node.flags & NodeFlags.Default;
|
||||
// The exported symbol for an export default function/class node is always named "default"
|
||||
let name = node.flags & NodeFlags.Default && parent ? "default" : getDeclarationName(node);
|
||||
let name = isDefaultExport && parent ? "default" : getDeclarationName(node);
|
||||
|
||||
let symbol: Symbol;
|
||||
if (name !== undefined) {
|
||||
@@ -227,6 +228,13 @@ namespace ts {
|
||||
let message = symbol.flags & SymbolFlags.BlockScopedVariable
|
||||
? Diagnostics.Cannot_redeclare_block_scoped_variable_0
|
||||
: Diagnostics.Duplicate_identifier_0;
|
||||
|
||||
forEach(symbol.declarations, declaration => {
|
||||
if (declaration.flags & NodeFlags.Default) {
|
||||
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
|
||||
}
|
||||
});
|
||||
|
||||
forEach(symbol.declarations, declaration => {
|
||||
file.bindDiagnostics.push(createDiagnosticForNode(declaration.name || declaration, message, getDisplayName(declaration)));
|
||||
});
|
||||
|
||||
+354
-287
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
/// <reference path="sys.ts"/>
|
||||
/// <reference path="types.ts"/>
|
||||
/// <reference path="core.ts"/>
|
||||
/// <reference path="diagnosticInformationMap.generated.ts"/>
|
||||
/// <reference path="scanner.ts"/>
|
||||
|
||||
namespace ts {
|
||||
@@ -88,10 +89,11 @@ namespace ts {
|
||||
"system": ModuleKind.System,
|
||||
"umd": ModuleKind.UMD,
|
||||
"es6": ModuleKind.ES6,
|
||||
"es2015": ModuleKind.ES2015,
|
||||
},
|
||||
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es6,
|
||||
description: Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015,
|
||||
paramType: Diagnostics.KIND,
|
||||
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es6
|
||||
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_or_es2015
|
||||
},
|
||||
{
|
||||
name: "newLine",
|
||||
@@ -216,10 +218,15 @@ namespace ts {
|
||||
{
|
||||
name: "target",
|
||||
shortName: "t",
|
||||
type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5, "es6": ScriptTarget.ES6 },
|
||||
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
|
||||
type: {
|
||||
"es3": ScriptTarget.ES3,
|
||||
"es5": ScriptTarget.ES5,
|
||||
"es6": ScriptTarget.ES6,
|
||||
"es2015": ScriptTarget.ES2015,
|
||||
},
|
||||
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental,
|
||||
paramType: Diagnostics.VERSION,
|
||||
error: Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES6
|
||||
error: Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015
|
||||
},
|
||||
{
|
||||
name: "version",
|
||||
@@ -233,11 +240,6 @@ namespace ts {
|
||||
type: "boolean",
|
||||
description: Diagnostics.Watch_input_files,
|
||||
},
|
||||
{
|
||||
name: "experimentalAsyncFunctions",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Enables_experimental_support_for_ES7_async_functions
|
||||
},
|
||||
{
|
||||
name: "experimentalDecorators",
|
||||
type: "boolean",
|
||||
@@ -400,7 +402,7 @@ namespace ts {
|
||||
catch (e) {
|
||||
return { error: createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };
|
||||
}
|
||||
return parseConfigFileText(fileName, text);
|
||||
return parseConfigFileTextToJson(fileName, text);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -408,7 +410,7 @@ namespace ts {
|
||||
* @param fileName The path to the config file
|
||||
* @param jsonText The text of the config file
|
||||
*/
|
||||
export function parseConfigFileText(fileName: string, jsonText: string): { config?: any; error?: Diagnostic } {
|
||||
export function parseConfigFileTextToJson(fileName: string, jsonText: string): { config?: any; error?: Diagnostic } {
|
||||
try {
|
||||
return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} };
|
||||
}
|
||||
@@ -420,63 +422,19 @@ namespace ts {
|
||||
/**
|
||||
* Parse the contents of a config file (tsconfig.json).
|
||||
* @param json The contents of the config file to parse
|
||||
* @param host Instance of ParseConfigHost used to enumerate files in folder.
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
export function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine {
|
||||
let errors: Diagnostic[] = [];
|
||||
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine {
|
||||
let { options, errors } = convertCompilerOptionsFromJson(json["compilerOptions"], basePath);
|
||||
|
||||
return {
|
||||
options: getCompilerOptions(),
|
||||
options,
|
||||
fileNames: getFileNames(),
|
||||
errors
|
||||
};
|
||||
|
||||
function getCompilerOptions(): CompilerOptions {
|
||||
let options: CompilerOptions = {};
|
||||
let optionNameMap: Map<CommandLineOption> = {};
|
||||
forEach(optionDeclarations, option => {
|
||||
optionNameMap[option.name] = option;
|
||||
});
|
||||
let jsonOptions = json["compilerOptions"];
|
||||
if (jsonOptions) {
|
||||
for (let id in jsonOptions) {
|
||||
if (hasProperty(optionNameMap, id)) {
|
||||
let opt = optionNameMap[id];
|
||||
let optType = opt.type;
|
||||
let value = jsonOptions[id];
|
||||
let expectedType = typeof optType === "string" ? optType : "string";
|
||||
if (typeof value === expectedType) {
|
||||
if (typeof optType !== "string") {
|
||||
let key = value.toLowerCase();
|
||||
if (hasProperty(optType, key)) {
|
||||
value = optType[key];
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic((<CommandLineOptionOfCustomType>opt).error));
|
||||
value = 0;
|
||||
}
|
||||
}
|
||||
if (opt.isFilePath) {
|
||||
value = normalizePath(combinePaths(basePath, value));
|
||||
if (value === "") {
|
||||
value = ".";
|
||||
}
|
||||
}
|
||||
options[opt.name] = value;
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType));
|
||||
}
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.Unknown_compiler_option_0, id));
|
||||
}
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
function getFileNames(): string[] {
|
||||
let fileNames: string[] = [];
|
||||
if (hasProperty(json, "files")) {
|
||||
@@ -511,4 +469,51 @@ namespace ts {
|
||||
return fileNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string): { options: CompilerOptions, errors: Diagnostic[] } {
|
||||
let options: CompilerOptions = {};
|
||||
let errors: Diagnostic[] = [];
|
||||
|
||||
if (!jsonOptions) {
|
||||
return { options, errors };
|
||||
}
|
||||
|
||||
let optionNameMap = arrayToMap(optionDeclarations, opt => opt.name);
|
||||
|
||||
for (let id in jsonOptions) {
|
||||
if (hasProperty(optionNameMap, id)) {
|
||||
let opt = optionNameMap[id];
|
||||
let optType = opt.type;
|
||||
let value = jsonOptions[id];
|
||||
let expectedType = typeof optType === "string" ? optType : "string";
|
||||
if (typeof value === expectedType) {
|
||||
if (typeof optType !== "string") {
|
||||
let key = value.toLowerCase();
|
||||
if (hasProperty(optType, key)) {
|
||||
value = optType[key];
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic((<CommandLineOptionOfCustomType>opt).error));
|
||||
value = 0;
|
||||
}
|
||||
}
|
||||
if (opt.isFilePath) {
|
||||
value = normalizePath(combinePaths(basePath, value));
|
||||
if (value === "") {
|
||||
value = ".";
|
||||
}
|
||||
}
|
||||
options[opt.name] = value;
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType));
|
||||
}
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnostic(Diagnostics.Unknown_compiler_option_0, id));
|
||||
}
|
||||
}
|
||||
|
||||
return { options, errors };
|
||||
}
|
||||
}
|
||||
|
||||
+44
-12
@@ -437,8 +437,12 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain {
|
||||
Debug.assert(!headChain.next);
|
||||
headChain.next = tailChain;
|
||||
let lastChain = headChain;
|
||||
while (lastChain.next) {
|
||||
lastChain = lastChain.next;
|
||||
}
|
||||
|
||||
lastChain.next = tailChain;
|
||||
return headChain;
|
||||
}
|
||||
|
||||
@@ -700,6 +704,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function getBaseFileName(path: string) {
|
||||
if (!path) {
|
||||
return undefined;
|
||||
}
|
||||
let i = path.lastIndexOf(directorySeparator);
|
||||
return i < 0 ? path : path.substring(i + 1);
|
||||
}
|
||||
@@ -722,6 +729,23 @@ namespace ts {
|
||||
* List of supported extensions in order of file resolution precedence.
|
||||
*/
|
||||
export const supportedExtensions = [".ts", ".tsx", ".d.ts"];
|
||||
/**
|
||||
* List of extensions that will be used to look for external modules.
|
||||
* This list is kept separate from supportedExtensions to for cases when we'll allow to include .js files in compilation,
|
||||
* but still would like to load only TypeScript files as modules
|
||||
*/
|
||||
export const moduleFileExtensions = supportedExtensions;
|
||||
|
||||
export function isSupportedSourceFileName(fileName: string) {
|
||||
if (!fileName) { return false; }
|
||||
|
||||
for (let extension of supportedExtensions) {
|
||||
if (fileExtensionIs(fileName, extension)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"];
|
||||
export function removeFileExtension(path: string): string {
|
||||
@@ -751,7 +775,7 @@ namespace ts {
|
||||
};
|
||||
|
||||
export interface ObjectAllocator {
|
||||
getNodeConstructor(kind: SyntaxKind): new () => Node;
|
||||
getNodeConstructor(kind: SyntaxKind): new (pos?: number, end?: number) => Node;
|
||||
getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol;
|
||||
getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type;
|
||||
getSignatureConstructor(): new (checker: TypeChecker) => Signature;
|
||||
@@ -772,15 +796,13 @@ namespace ts {
|
||||
|
||||
export let objectAllocator: ObjectAllocator = {
|
||||
getNodeConstructor: kind => {
|
||||
function Node() {
|
||||
function Node(pos: number, end: number) {
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = NodeFlags.None;
|
||||
this.parent = undefined;
|
||||
}
|
||||
Node.prototype = {
|
||||
kind: kind,
|
||||
pos: -1,
|
||||
end: -1,
|
||||
flags: 0,
|
||||
parent: undefined,
|
||||
};
|
||||
Node.prototype = { kind };
|
||||
return <any>Node;
|
||||
},
|
||||
getSymbolConstructor: () => <any>Symbol,
|
||||
@@ -817,4 +839,14 @@ namespace ts {
|
||||
Debug.assert(false, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function copyListRemovingItem<T>(item: T, list: T[]) {
|
||||
let copiedList: T[] = [];
|
||||
for (let e of list) {
|
||||
if (e !== item) {
|
||||
copiedList.push(e);
|
||||
}
|
||||
}
|
||||
return copiedList;
|
||||
}
|
||||
}
|
||||
@@ -627,7 +627,7 @@
|
||||
"category": "Error",
|
||||
"code": 1203
|
||||
},
|
||||
"Cannot compile modules into 'es6' when targeting 'ES5' or lower.": {
|
||||
"Cannot compile modules into 'es2015' when targeting 'ES5' or lower.": {
|
||||
"category": "Error",
|
||||
"code": 1204
|
||||
},
|
||||
@@ -783,10 +783,6 @@
|
||||
"category": "Error",
|
||||
"code": 1245
|
||||
},
|
||||
"Experimental support for async functions is a feature that is subject to change in a future release. Specify '--experimentalAsyncFunctions' to remove this warning.": {
|
||||
"category": "Error",
|
||||
"code": 1246
|
||||
},
|
||||
|
||||
"'with' statements are not allowed in an async function block.": {
|
||||
"category": "Error",
|
||||
@@ -800,6 +796,10 @@
|
||||
"category": "Error",
|
||||
"code": 1311
|
||||
},
|
||||
"'=' can only be used in an object literal property inside a destructuring assignment.": {
|
||||
"category": "Error",
|
||||
"code": 1312
|
||||
},
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2300
|
||||
@@ -1620,10 +1620,6 @@
|
||||
"category": "Error",
|
||||
"code":2517
|
||||
},
|
||||
"Only an ambient class can be merged with an interface.": {
|
||||
"category": "Error",
|
||||
"code": 2518
|
||||
},
|
||||
"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": {
|
||||
"category": "Error",
|
||||
"code": 2520
|
||||
@@ -1656,6 +1652,10 @@
|
||||
"category": "Error",
|
||||
"code": 2527
|
||||
},
|
||||
"A module cannot have multiple default exports.": {
|
||||
"category": "Error",
|
||||
"code": 2528
|
||||
},
|
||||
"JSX element attributes type '{0}' must be an object type.": {
|
||||
"category": "Error",
|
||||
"code": 2600
|
||||
@@ -1712,14 +1712,14 @@
|
||||
"category": "Error",
|
||||
"code": 2654
|
||||
},
|
||||
"Exported external package typings can only be in '.d.ts' files. Please contact the package author to update the package definition.": {
|
||||
"category": "Error",
|
||||
"code": 2655
|
||||
},
|
||||
"Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition.": {
|
||||
"category": "Error",
|
||||
"code": 2656
|
||||
},
|
||||
"JSX expressions must have one parent element": {
|
||||
"category": "Error",
|
||||
"code": 2657
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
@@ -2040,7 +2040,7 @@
|
||||
"category": "Error",
|
||||
"code": 5042
|
||||
},
|
||||
"Option 'isolatedModules' 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 'ES2015' or higher.": {
|
||||
"category": "Error",
|
||||
"code": 5047
|
||||
},
|
||||
@@ -2101,11 +2101,11 @@
|
||||
"category": "Message",
|
||||
"code": 6010
|
||||
},
|
||||
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)": {
|
||||
"category": "Message",
|
||||
"code": 6015
|
||||
},
|
||||
"Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es6'": {
|
||||
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)": {
|
||||
"category": "Message",
|
||||
"code": 6015
|
||||
},
|
||||
"Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'": {
|
||||
"category": "Message",
|
||||
"code": 6016
|
||||
},
|
||||
@@ -2189,14 +2189,14 @@
|
||||
"category": "Error",
|
||||
"code": 6045
|
||||
},
|
||||
"Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es6'.": {
|
||||
"Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', or 'es2015'.": {
|
||||
"category": "Error",
|
||||
"code": 6046
|
||||
},
|
||||
"Argument for '--target' option must be 'ES3', 'ES5', or 'ES6'.": {
|
||||
"category": "Error",
|
||||
"code": 6047
|
||||
},
|
||||
"Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'.": {
|
||||
"category": "Error",
|
||||
"code": 6047
|
||||
},
|
||||
"Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 6048
|
||||
@@ -2266,10 +2266,6 @@
|
||||
"category": "Message",
|
||||
"code": 6066
|
||||
},
|
||||
"Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower.": {
|
||||
"category": "Message",
|
||||
"code": 6067
|
||||
},
|
||||
"Enables experimental support for ES7 async functions.": {
|
||||
"category": "Message",
|
||||
"code": 6068
|
||||
@@ -2478,5 +2474,13 @@
|
||||
"A constructor cannot contain a 'super' call when its class extends 'null'": {
|
||||
"category": "Error",
|
||||
"code": 17005
|
||||
},
|
||||
"An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": {
|
||||
"category": "Error",
|
||||
"code": 17006
|
||||
},
|
||||
"A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses.": {
|
||||
"category": "Error",
|
||||
"code": 17007
|
||||
}
|
||||
}
|
||||
|
||||
+205
-91
@@ -1404,10 +1404,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emit(span.literal);
|
||||
}
|
||||
|
||||
function jsxEmitReact(node: JsxElement|JsxSelfClosingElement) {
|
||||
function jsxEmitReact(node: JsxElement | JsxSelfClosingElement) {
|
||||
/// Emit a tag name, which is either '"div"' for lower-cased names, or
|
||||
/// 'Div' for upper-cased or dotted names
|
||||
function emitTagName(name: Identifier|QualifiedName) {
|
||||
function emitTagName(name: Identifier | QualifiedName) {
|
||||
if (name.kind === SyntaxKind.Identifier && isIntrinsicJsxName((<Identifier>name).text)) {
|
||||
write("\"");
|
||||
emit(name);
|
||||
@@ -1557,7 +1557,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function jsxEmitPreserve(node: JsxElement|JsxSelfClosingElement) {
|
||||
function jsxEmitPreserve(node: JsxElement | JsxSelfClosingElement) {
|
||||
function emitJsxAttribute(node: JsxAttribute) {
|
||||
emit(node.name);
|
||||
if (node.initializer) {
|
||||
@@ -1572,7 +1572,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write("}");
|
||||
}
|
||||
|
||||
function emitAttributes(attribs: NodeArray<JsxAttribute|JsxSpreadAttribute>) {
|
||||
function emitAttributes(attribs: NodeArray<JsxAttribute | JsxSpreadAttribute>) {
|
||||
for (let i = 0, n = attribs.length; i < n; i++) {
|
||||
if (i > 0) {
|
||||
write(" ");
|
||||
@@ -1588,7 +1588,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function emitJsxOpeningOrSelfClosingElement(node: JsxOpeningElement|JsxSelfClosingElement) {
|
||||
function emitJsxOpeningOrSelfClosingElement(node: JsxOpeningElement | JsxSelfClosingElement) {
|
||||
write("<");
|
||||
emit(node.tagName);
|
||||
if (node.attributes.length > 0 || (node.kind === SyntaxKind.JsxSelfClosingElement)) {
|
||||
@@ -1769,34 +1769,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(".");
|
||||
}
|
||||
}
|
||||
else if (modulekind !== ModuleKind.ES6) {
|
||||
let declaration = resolver.getReferencedImportDeclaration(node);
|
||||
if (declaration) {
|
||||
if (declaration.kind === SyntaxKind.ImportClause) {
|
||||
// Identifier references default import
|
||||
write(getGeneratedNameForNode(<ImportDeclaration>declaration.parent));
|
||||
write(languageVersion === ScriptTarget.ES3 ? "[\"default\"]" : ".default");
|
||||
return;
|
||||
}
|
||||
else if (declaration.kind === SyntaxKind.ImportSpecifier) {
|
||||
// Identifier references named import
|
||||
write(getGeneratedNameForNode(<ImportDeclaration>declaration.parent.parent.parent));
|
||||
let name = (<ImportSpecifier>declaration).propertyName || (<ImportSpecifier>declaration).name;
|
||||
let identifier = getSourceTextOfNodeFromSourceFile(currentSourceFile, name);
|
||||
if (languageVersion === ScriptTarget.ES3 && identifier === "default") {
|
||||
write(`["default"]`);
|
||||
else {
|
||||
if (modulekind !== ModuleKind.ES6) {
|
||||
let declaration = resolver.getReferencedImportDeclaration(node);
|
||||
if (declaration) {
|
||||
if (declaration.kind === SyntaxKind.ImportClause) {
|
||||
// Identifier references default import
|
||||
write(getGeneratedNameForNode(<ImportDeclaration>declaration.parent));
|
||||
write(languageVersion === ScriptTarget.ES3 ? "[\"default\"]" : ".default");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
write(".");
|
||||
write(identifier);
|
||||
else if (declaration.kind === SyntaxKind.ImportSpecifier) {
|
||||
// Identifier references named import
|
||||
write(getGeneratedNameForNode(<ImportDeclaration>declaration.parent.parent.parent));
|
||||
let name = (<ImportSpecifier>declaration).propertyName || (<ImportSpecifier>declaration).name;
|
||||
let identifier = getSourceTextOfNodeFromSourceFile(currentSourceFile, name);
|
||||
if (languageVersion === ScriptTarget.ES3 && identifier === "default") {
|
||||
write(`["default"]`);
|
||||
}
|
||||
else {
|
||||
write(".");
|
||||
write(identifier);
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
declaration = resolver.getReferencedNestedRedeclaration(node);
|
||||
if (declaration) {
|
||||
write(getGeneratedNameForNode(declaration.name));
|
||||
return;
|
||||
|
||||
if (languageVersion !== ScriptTarget.ES6) {
|
||||
let declaration = resolver.getReferencedNestedRedeclaration(node);
|
||||
if (declaration) {
|
||||
write(getGeneratedNameForNode(declaration.name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2311,6 +2316,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(": ");
|
||||
emit(node.name);
|
||||
}
|
||||
|
||||
if (languageVersion >= ScriptTarget.ES6 && node.objectAssignmentInitializer) {
|
||||
write(" = ");
|
||||
emit(node.objectAssignmentInitializer);
|
||||
}
|
||||
}
|
||||
|
||||
function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean {
|
||||
@@ -2760,7 +2770,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
* we we emit variable statement 'var' should be dropped.
|
||||
*/
|
||||
function isSourceFileLevelDeclarationInSystemJsModule(node: Node, isExported: boolean): boolean {
|
||||
if (!node || languageVersion >= ScriptTarget.ES6 || !isCurrentFileSystemExternalModule()) {
|
||||
if (!node || !isCurrentFileSystemExternalModule()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2778,6 +2788,68 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit ES7 exponentiation operator downlevel using Math.pow
|
||||
* @param node a binary expression node containing exponentiationOperator (**, **=)
|
||||
*/
|
||||
function emitExponentiationOperator(node: BinaryExpression) {
|
||||
let leftHandSideExpression = node.left;
|
||||
if (node.operatorToken.kind === SyntaxKind.AsteriskAsteriskEqualsToken) {
|
||||
let synthesizedLHS: ElementAccessExpression | PropertyAccessExpression;
|
||||
let shouldEmitParentheses = false;
|
||||
if (isElementAccessExpression(leftHandSideExpression)) {
|
||||
shouldEmitParentheses = true;
|
||||
write("(");
|
||||
|
||||
synthesizedLHS = <ElementAccessExpression>createSynthesizedNode(SyntaxKind.ElementAccessExpression, /*startsOnNewLine*/ false);
|
||||
|
||||
let identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldEmitCommaBeforeAssignment*/ false);
|
||||
synthesizedLHS.expression = identifier;
|
||||
|
||||
if (leftHandSideExpression.argumentExpression.kind !== SyntaxKind.NumericLiteral &&
|
||||
leftHandSideExpression.argumentExpression.kind !== SyntaxKind.StringLiteral) {
|
||||
let tempArgumentExpression = createAndRecordTempVariable(TempFlags._i);
|
||||
(<ElementAccessExpression>synthesizedLHS).argumentExpression = tempArgumentExpression;
|
||||
emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, /*shouldEmitCommaBeforeAssignment*/ true);
|
||||
}
|
||||
else {
|
||||
(<ElementAccessExpression>synthesizedLHS).argumentExpression = leftHandSideExpression.argumentExpression;
|
||||
}
|
||||
write(", ");
|
||||
}
|
||||
else if (isPropertyAccessExpression(leftHandSideExpression)) {
|
||||
shouldEmitParentheses = true;
|
||||
write("(");
|
||||
synthesizedLHS = <PropertyAccessExpression>createSynthesizedNode(SyntaxKind.PropertyAccessExpression, /*startsOnNewLine*/ false);
|
||||
|
||||
let identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldemitCommaBeforeAssignment*/ false);
|
||||
synthesizedLHS.expression = identifier;
|
||||
|
||||
(<PropertyAccessExpression>synthesizedLHS).dotToken = leftHandSideExpression.dotToken;
|
||||
(<PropertyAccessExpression>synthesizedLHS).name = leftHandSideExpression.name;
|
||||
write(", ");
|
||||
}
|
||||
|
||||
emit(synthesizedLHS || leftHandSideExpression);
|
||||
write(" = ");
|
||||
write("Math.pow(");
|
||||
emit(synthesizedLHS || leftHandSideExpression);
|
||||
write(", ");
|
||||
emit(node.right);
|
||||
write(")");
|
||||
if (shouldEmitParentheses) {
|
||||
write(")");
|
||||
}
|
||||
}
|
||||
else {
|
||||
write("Math.pow(");
|
||||
emit(leftHandSideExpression);
|
||||
write(", ");
|
||||
emit(node.right);
|
||||
write(")");
|
||||
}
|
||||
}
|
||||
|
||||
function emitBinaryExpression(node: BinaryExpression) {
|
||||
if (languageVersion < ScriptTarget.ES6 && node.operatorToken.kind === SyntaxKind.EqualsToken &&
|
||||
(node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) {
|
||||
@@ -2795,12 +2867,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitNodeWithoutSourceMap(node.left);
|
||||
write(`", `);
|
||||
}
|
||||
emit(node.left);
|
||||
let indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== SyntaxKind.CommaToken ? " " : undefined);
|
||||
write(tokenToString(node.operatorToken.kind));
|
||||
let indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " ");
|
||||
emit(node.right);
|
||||
decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator);
|
||||
|
||||
if (node.operatorToken.kind === SyntaxKind.AsteriskAsteriskToken || node.operatorToken.kind === SyntaxKind.AsteriskAsteriskEqualsToken) {
|
||||
// Downleveled emit exponentiation operator using Math.pow
|
||||
emitExponentiationOperator(node);
|
||||
}
|
||||
else {
|
||||
emit(node.left);
|
||||
// Add indentation before emit the operator if the operator is on different line
|
||||
// For example:
|
||||
// 3
|
||||
// + 2;
|
||||
// emitted as
|
||||
// 3
|
||||
// + 2;
|
||||
let indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== SyntaxKind.CommaToken ? " " : undefined);
|
||||
write(tokenToString(node.operatorToken.kind));
|
||||
let indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " ");
|
||||
emit(node.right);
|
||||
decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator);
|
||||
}
|
||||
|
||||
if (exportChanged) {
|
||||
write(")");
|
||||
}
|
||||
@@ -3437,6 +3524,58 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(";");
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit an assignment to a given identifier, 'name', with a given expression, 'value'.
|
||||
* @param name an identifier as a left-hand-side operand of the assignment
|
||||
* @param value an expression as a right-hand-side operand of the assignment
|
||||
* @param shouldEmitCommaBeforeAssignment a boolean indicating whether to prefix an assignment with comma
|
||||
*/
|
||||
function emitAssignment(name: Identifier, value: Expression, shouldEmitCommaBeforeAssignment: boolean) {
|
||||
if (shouldEmitCommaBeforeAssignment) {
|
||||
write(", ");
|
||||
}
|
||||
|
||||
let exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name);
|
||||
|
||||
if (exportChanged) {
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(name);
|
||||
write(`", `);
|
||||
}
|
||||
|
||||
const isVariableDeclarationOrBindingElement =
|
||||
name.parent && (name.parent.kind === SyntaxKind.VariableDeclaration || name.parent.kind === SyntaxKind.BindingElement);
|
||||
|
||||
if (isVariableDeclarationOrBindingElement) {
|
||||
emitModuleMemberName(<Declaration>name.parent);
|
||||
}
|
||||
else {
|
||||
emit(name);
|
||||
}
|
||||
|
||||
write(" = ");
|
||||
emit(value);
|
||||
|
||||
if (exportChanged) {
|
||||
write(")");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create temporary variable, emit an assignment of the variable the given expression
|
||||
* @param expression an expression to assign to the newly created temporary variable
|
||||
* @param canDefineTempVariablesInPlace a boolean indicating whether you can define the temporary variable at an assignment location
|
||||
* @param shouldEmitCommaBeforeAssignment a boolean indicating whether an assignment should prefix with comma
|
||||
*/
|
||||
function emitTempVariableAssignment(expression: Expression, canDefineTempVariablesInPlace: boolean, shouldEmitCommaBeforeAssignment: boolean): Identifier {
|
||||
let identifier = createTempVariable(TempFlags.Auto);
|
||||
if (!canDefineTempVariablesInPlace) {
|
||||
recordTempDeclaration(identifier);
|
||||
}
|
||||
emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment);
|
||||
return identifier;
|
||||
}
|
||||
|
||||
function emitDestructuring(root: BinaryExpression | VariableDeclaration | ParameterDeclaration, isAssignmentExpressionStatement: boolean, value?: Expression) {
|
||||
let emitCount = 0;
|
||||
|
||||
@@ -3462,36 +3601,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitBindingElement(<BindingElement>root, value);
|
||||
}
|
||||
|
||||
function emitAssignment(name: Identifier, value: Expression) {
|
||||
if (emitCount++) {
|
||||
write(", ");
|
||||
}
|
||||
|
||||
const isVariableDeclarationOrBindingElement =
|
||||
name.parent && (name.parent.kind === SyntaxKind.VariableDeclaration || name.parent.kind === SyntaxKind.BindingElement);
|
||||
|
||||
let exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name);
|
||||
|
||||
if (exportChanged) {
|
||||
write(`${exportFunctionForFile}("`);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(name);
|
||||
write(`", `);
|
||||
}
|
||||
|
||||
if (isVariableDeclarationOrBindingElement) {
|
||||
emitModuleMemberName(<Declaration>name.parent);
|
||||
}
|
||||
else {
|
||||
emit(name);
|
||||
}
|
||||
|
||||
write(" = ");
|
||||
emit(value);
|
||||
|
||||
if (exportChanged) {
|
||||
write(")");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that there exists a declared identifier whose value holds the given expression.
|
||||
@@ -3507,11 +3616,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return expr;
|
||||
}
|
||||
|
||||
let identifier = createTempVariable(TempFlags.Auto);
|
||||
if (!canDefineTempVariablesInPlace) {
|
||||
recordTempDeclaration(identifier);
|
||||
}
|
||||
emitAssignment(identifier, expr);
|
||||
let identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0);
|
||||
emitCount++;
|
||||
return identifier;
|
||||
}
|
||||
|
||||
@@ -3574,7 +3680,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
for (let p of properties) {
|
||||
if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
let propName = <Identifier | LiteralExpression>(<PropertyAssignment>p).name;
|
||||
emitDestructuringAssignment((<PropertyAssignment>p).initializer || propName, createPropertyAccessForDestructuringProperty(value, propName));
|
||||
let target = p.kind === SyntaxKind.ShorthandPropertyAssignment ? <ShorthandPropertyAssignment>p : (<PropertyAssignment>p).initializer || propName;
|
||||
emitDestructuringAssignment(target, createPropertyAccessForDestructuringProperty(value, propName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3599,8 +3706,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function emitDestructuringAssignment(target: Expression, value: Expression) {
|
||||
if (target.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>target).operatorToken.kind === SyntaxKind.EqualsToken) {
|
||||
function emitDestructuringAssignment(target: Expression | ShorthandPropertyAssignment, value: Expression) {
|
||||
if (target.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
if ((<ShorthandPropertyAssignment>target).objectAssignmentInitializer) {
|
||||
value = createDefaultValueCheck(value, (<ShorthandPropertyAssignment>target).objectAssignmentInitializer);
|
||||
}
|
||||
target = (<ShorthandPropertyAssignment>target).name;
|
||||
}
|
||||
else if (target.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>target).operatorToken.kind === SyntaxKind.EqualsToken) {
|
||||
value = createDefaultValueCheck(value, (<BinaryExpression>target).right);
|
||||
target = (<BinaryExpression>target).left;
|
||||
}
|
||||
@@ -3611,7 +3724,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitArrayLiteralAssignment(<ArrayLiteralExpression>target, value);
|
||||
}
|
||||
else {
|
||||
emitAssignment(<Identifier>target, value);
|
||||
emitAssignment(<Identifier>target, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0);
|
||||
emitCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3680,7 +3794,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
else {
|
||||
emitAssignment(<Identifier>target.name, value);
|
||||
emitAssignment(<Identifier>target.name, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0);
|
||||
emitCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3785,7 +3900,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(";");
|
||||
}
|
||||
}
|
||||
if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) {
|
||||
if (modulekind !== ModuleKind.ES6 && node.parent === currentSourceFile) {
|
||||
forEach(node.declarationList.declarations, emitExportVariableAssignments);
|
||||
}
|
||||
}
|
||||
@@ -4011,7 +4126,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
emitSignatureAndBody(node);
|
||||
if (languageVersion < ScriptTarget.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile && node.name) {
|
||||
if (modulekind !== ModuleKind.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile && node.name) {
|
||||
emitExportMemberAssignments((<FunctionDeclaration>node).name);
|
||||
}
|
||||
|
||||
@@ -4687,6 +4802,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
else {
|
||||
emitClassLikeDeclarationForES6AndHigher(node);
|
||||
}
|
||||
if (modulekind !== ModuleKind.ES6 && node.parent === currentSourceFile && node.name) {
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassLikeDeclarationForES6AndHigher(node: ClassLikeDeclaration) {
|
||||
@@ -4785,8 +4903,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
// emit name if
|
||||
// - node has a name
|
||||
// - this is default export and target is not ES6 (for ES6 `export default` does not need to be compiled downlevel)
|
||||
if ((node.name || (node.flags & NodeFlags.Default && languageVersion < ScriptTarget.ES6)) && !thisNodeIsDecorated) {
|
||||
// - this is default export with static initializers
|
||||
if ((node.name || (node.flags & NodeFlags.Default && staticProperties.length > 0)) && !thisNodeIsDecorated) {
|
||||
write(" ");
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
@@ -4934,10 +5052,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
emitExportMemberAssignment(<ClassDeclaration>node);
|
||||
}
|
||||
|
||||
if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile && node.name) {
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassMemberPrefix(node: ClassLikeDeclaration, member: Node) {
|
||||
@@ -5509,7 +5623,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) {
|
||||
if (modulekind !== ModuleKind.ES6 && node.parent === currentSourceFile) {
|
||||
if (modulekind === ModuleKind.System && (node.flags & NodeFlags.Export)) {
|
||||
// write the call to exporter for enum
|
||||
writeLine();
|
||||
@@ -5645,8 +5759,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
/*
|
||||
* Some bundlers (SystemJS builder) sometimes want to rename dependencies.
|
||||
* Here we check if alternative name was provided for a given moduleName and return it if possible.
|
||||
* Some bundlers (SystemJS builder) sometimes want to rename dependencies.
|
||||
* Here we check if alternative name was provided for a given moduleName and return it if possible.
|
||||
*/
|
||||
function tryRenameExternalModule(moduleName: LiteralExpression): string {
|
||||
if (currentSourceFile.renamedDependencies && hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) {
|
||||
@@ -6848,7 +6962,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (isLineBreak(c)) {
|
||||
if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) {
|
||||
let part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1);
|
||||
result = (result ? result + "\" + ' ' + \"" : "") + part;
|
||||
result = (result ? result + "\" + ' ' + \"" : "") + escapeString(part);
|
||||
}
|
||||
firstNonWhitespace = -1;
|
||||
}
|
||||
@@ -6862,7 +6976,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
if (firstNonWhitespace !== -1) {
|
||||
let part = text.substr(firstNonWhitespace);
|
||||
result = (result ? result + "\" + ' ' + \"" : "") + part;
|
||||
result = (result ? result + "\" + ' ' + \"" : "") + escapeString(part);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
@@ -7074,7 +7188,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return shouldEmitEnumDeclaration(<EnumDeclaration>node);
|
||||
}
|
||||
|
||||
// If the node is emitted in specialized fashion, dont emit comments as this node will handle
|
||||
// If the node is emitted in specialized fashion, dont emit comments as this node will handle
|
||||
// emitting comments when emitting itself
|
||||
Debug.assert(!isSpecializedCommentHandling(node));
|
||||
|
||||
@@ -7132,7 +7246,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return emitTemplateSpan(<TemplateSpan>node);
|
||||
case SyntaxKind.JsxElement:
|
||||
case SyntaxKind.JsxSelfClosingElement:
|
||||
return emitJsxElement(<JsxElement|JsxSelfClosingElement>node);
|
||||
return emitJsxElement(<JsxElement | JsxSelfClosingElement>node);
|
||||
case SyntaxKind.JsxText:
|
||||
return emitJsxText(<JsxText>node);
|
||||
case SyntaxKind.JsxExpression:
|
||||
|
||||
+194
-34
@@ -2,15 +2,15 @@
|
||||
/// <reference path="utilities.ts"/>
|
||||
|
||||
namespace ts {
|
||||
let nodeConstructors = new Array<new () => Node>(SyntaxKind.Count);
|
||||
let nodeConstructors = new Array<new (pos: number, end: number) => Node>(SyntaxKind.Count);
|
||||
/* @internal */ export let parseTime = 0;
|
||||
|
||||
export function getNodeConstructor(kind: SyntaxKind): new () => Node {
|
||||
export function getNodeConstructor(kind: SyntaxKind): new (pos?: number, end?: number) => Node {
|
||||
return nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind));
|
||||
}
|
||||
|
||||
export function createNode(kind: SyntaxKind): Node {
|
||||
return new (getNodeConstructor(kind))();
|
||||
export function createNode(kind: SyntaxKind, pos?: number, end?: number): Node {
|
||||
return new (getNodeConstructor(kind))(pos, end);
|
||||
}
|
||||
|
||||
function visitNode<T>(cbNode: (node: Node) => T, node: Node): T {
|
||||
@@ -57,11 +57,17 @@ namespace ts {
|
||||
return visitNode(cbNode, (<TypeParameterDeclaration>node).name) ||
|
||||
visitNode(cbNode, (<TypeParameterDeclaration>node).constraint) ||
|
||||
visitNode(cbNode, (<TypeParameterDeclaration>node).expression);
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return visitNodes(cbNodes, node.decorators) ||
|
||||
visitNodes(cbNodes, node.modifiers) ||
|
||||
visitNode(cbNode, (<ShorthandPropertyAssignment>node).name) ||
|
||||
visitNode(cbNode, (<ShorthandPropertyAssignment>node).questionToken) ||
|
||||
visitNode(cbNode, (<ShorthandPropertyAssignment>node).equalsToken) ||
|
||||
visitNode(cbNode, (<ShorthandPropertyAssignment>node).objectAssignmentInitializer);
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
return visitNodes(cbNodes, node.decorators) ||
|
||||
@@ -987,14 +993,10 @@ namespace ts {
|
||||
|
||||
function createNode(kind: SyntaxKind, pos?: number): Node {
|
||||
nodeCount++;
|
||||
let node = new (nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)))();
|
||||
if (!(pos >= 0)) {
|
||||
pos = scanner.getStartPos();
|
||||
}
|
||||
|
||||
node.pos = pos;
|
||||
node.end = pos;
|
||||
return node;
|
||||
return new (nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)))(pos, pos);
|
||||
}
|
||||
|
||||
function finishNode<T extends Node>(node: T, end?: number): T {
|
||||
@@ -3025,7 +3027,31 @@ namespace ts {
|
||||
let newPrecedence = getBinaryOperatorPrecedence();
|
||||
|
||||
// Check the precedence to see if we should "take" this operator
|
||||
if (newPrecedence <= precedence) {
|
||||
// - For left associative operator (all operator but **), consume the operator,
|
||||
// recursively call the function below, and parse binaryExpression as a rightOperand
|
||||
// of the caller if the new precendence of the operator is greater then or equal to the current precendence.
|
||||
// For example:
|
||||
// a - b - c;
|
||||
// ^token; leftOperand = b. Return b to the caller as a rightOperand
|
||||
// a * b - c
|
||||
// ^token; leftOperand = b. Return b to the caller as a rightOperand
|
||||
// a - b * c;
|
||||
// ^token; leftOperand = b. Return b * c to the caller as a rightOperand
|
||||
// - For right associative operator (**), consume the operator, recursively call the function
|
||||
// and parse binaryExpression as a rightOperand of the caller if the new precendence of
|
||||
// the operator is strictly grater than the current precendence
|
||||
// For example:
|
||||
// a ** b ** c;
|
||||
// ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand
|
||||
// a - b ** c;
|
||||
// ^^token; leftOperand = b. Return b ** c to the caller as a rightOperand
|
||||
// a ** b - c
|
||||
// ^token; leftOperand = b. Return b to the caller as a rightOperand
|
||||
const consumeCurrentOperator = token === SyntaxKind.AsteriskAsteriskToken ?
|
||||
newPrecedence >= precedence :
|
||||
newPrecedence > precedence;
|
||||
|
||||
if (!consumeCurrentOperator) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3099,6 +3125,8 @@ namespace ts {
|
||||
case SyntaxKind.SlashToken:
|
||||
case SyntaxKind.PercentToken:
|
||||
return 10;
|
||||
case SyntaxKind.AsteriskAsteriskToken:
|
||||
return 11;
|
||||
}
|
||||
|
||||
// -1 is lower than all other precedences. Returning it will cause binary expression
|
||||
@@ -3125,28 +3153,29 @@ namespace ts {
|
||||
let node = <PrefixUnaryExpression>createNode(SyntaxKind.PrefixUnaryExpression);
|
||||
node.operator = token;
|
||||
nextToken();
|
||||
node.operand = parseUnaryExpressionOrHigher();
|
||||
node.operand = parseSimpleUnaryExpression();
|
||||
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseDeleteExpression() {
|
||||
let node = <DeleteExpression>createNode(SyntaxKind.DeleteExpression);
|
||||
nextToken();
|
||||
node.expression = parseUnaryExpressionOrHigher();
|
||||
node.expression = parseSimpleUnaryExpression();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseTypeOfExpression() {
|
||||
let node = <TypeOfExpression>createNode(SyntaxKind.TypeOfExpression);
|
||||
nextToken();
|
||||
node.expression = parseUnaryExpressionOrHigher();
|
||||
node.expression = parseSimpleUnaryExpression();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseVoidExpression() {
|
||||
let node = <VoidExpression>createNode(SyntaxKind.VoidExpression);
|
||||
nextToken();
|
||||
node.expression = parseUnaryExpressionOrHigher();
|
||||
node.expression = parseSimpleUnaryExpression();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -3166,22 +3195,63 @@ namespace ts {
|
||||
function parseAwaitExpression() {
|
||||
const node = <AwaitExpression>createNode(SyntaxKind.AwaitExpression);
|
||||
nextToken();
|
||||
node.expression = parseUnaryExpressionOrHigher();
|
||||
node.expression = parseSimpleUnaryExpression();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseUnaryExpressionOrHigher(): UnaryExpression {
|
||||
/**
|
||||
* Parse ES7 unary expression and await expression
|
||||
*
|
||||
* ES7 UnaryExpression:
|
||||
* 1) SimpleUnaryExpression[?yield]
|
||||
* 2) IncrementExpression[?yield] ** UnaryExpression[?yield]
|
||||
*/
|
||||
function parseUnaryExpressionOrHigher(): UnaryExpression | BinaryExpression {
|
||||
if (isAwaitExpression()) {
|
||||
return parseAwaitExpression();
|
||||
}
|
||||
|
||||
if (isIncrementExpression()) {
|
||||
let incrementExpression = parseIncrementExpression();
|
||||
return token === SyntaxKind.AsteriskAsteriskToken ?
|
||||
<BinaryExpression>parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) :
|
||||
incrementExpression;
|
||||
}
|
||||
|
||||
let unaryOperator = token;
|
||||
let simpleUnaryExpression = parseSimpleUnaryExpression();
|
||||
if (token === SyntaxKind.AsteriskAsteriskToken) {
|
||||
let diagnostic: Diagnostic;
|
||||
let start = skipTrivia(sourceText, simpleUnaryExpression.pos);
|
||||
if (simpleUnaryExpression.kind === SyntaxKind.TypeAssertionExpression) {
|
||||
parseErrorAtPosition(start, simpleUnaryExpression.end - start, Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
|
||||
}
|
||||
else {
|
||||
parseErrorAtPosition(start, simpleUnaryExpression.end - start, Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, tokenToString(unaryOperator));
|
||||
}
|
||||
}
|
||||
return simpleUnaryExpression;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse ES7 simple-unary expression or higher:
|
||||
*
|
||||
* ES7 SimpleUnaryExpression:
|
||||
* 1) IncrementExpression[?yield]
|
||||
* 2) delete UnaryExpression[?yield]
|
||||
* 3) void UnaryExpression[?yield]
|
||||
* 4) typeof UnaryExpression[?yield]
|
||||
* 5) + UnaryExpression[?yield]
|
||||
* 6) - UnaryExpression[?yield]
|
||||
* 7) ~ UnaryExpression[?yield]
|
||||
* 8) ! UnaryExpression[?yield]
|
||||
*/
|
||||
function parseSimpleUnaryExpression(): UnaryExpression {
|
||||
switch (token) {
|
||||
case SyntaxKind.PlusToken:
|
||||
case SyntaxKind.MinusToken:
|
||||
case SyntaxKind.TildeToken:
|
||||
case SyntaxKind.ExclamationToken:
|
||||
case SyntaxKind.PlusPlusToken:
|
||||
case SyntaxKind.MinusMinusToken:
|
||||
return parsePrefixUnaryExpression();
|
||||
case SyntaxKind.DeleteKeyword:
|
||||
return parseDeleteExpression();
|
||||
@@ -3190,19 +3260,73 @@ namespace ts {
|
||||
case SyntaxKind.VoidKeyword:
|
||||
return parseVoidExpression();
|
||||
case SyntaxKind.LessThanToken:
|
||||
if (sourceFile.languageVariant !== LanguageVariant.JSX) {
|
||||
return parseTypeAssertion();
|
||||
}
|
||||
if (lookAhead(nextTokenIsIdentifierOrKeyword)) {
|
||||
return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true);
|
||||
}
|
||||
// Fall through
|
||||
// This is modified UnaryExpression grammar in TypeScript
|
||||
// UnaryExpression (modified):
|
||||
// < type > UnaryExpression
|
||||
return parseTypeAssertion();
|
||||
default:
|
||||
return parsePostfixExpressionOrHigher();
|
||||
return parseIncrementExpression();
|
||||
}
|
||||
}
|
||||
|
||||
function parsePostfixExpressionOrHigher(): PostfixExpression {
|
||||
/**
|
||||
* Check if the current token can possibly be an ES7 increment expression.
|
||||
*
|
||||
* ES7 IncrementExpression:
|
||||
* LeftHandSideExpression[?Yield]
|
||||
* LeftHandSideExpression[?Yield][no LineTerminator here]++
|
||||
* LeftHandSideExpression[?Yield][no LineTerminator here]--
|
||||
* ++LeftHandSideExpression[?Yield]
|
||||
* --LeftHandSideExpression[?Yield]
|
||||
*/
|
||||
function isIncrementExpression(): boolean {
|
||||
// This function is called inside parseUnaryExpression to decide
|
||||
// whether to call parseSimpleUnaryExpression or call parseIncrmentExpression directly
|
||||
switch (token) {
|
||||
case SyntaxKind.PlusToken:
|
||||
case SyntaxKind.MinusToken:
|
||||
case SyntaxKind.TildeToken:
|
||||
case SyntaxKind.ExclamationToken:
|
||||
case SyntaxKind.DeleteKeyword:
|
||||
case SyntaxKind.TypeOfKeyword:
|
||||
case SyntaxKind.VoidKeyword:
|
||||
return false;
|
||||
case SyntaxKind.LessThanToken:
|
||||
// If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression
|
||||
if (sourceFile.languageVariant !== LanguageVariant.JSX) {
|
||||
return false;
|
||||
}
|
||||
// We are in JSX context and the token is part of JSXElement.
|
||||
// Fall through
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse ES7 IncrementExpression. IncrementExpression is used instead of ES6's PostFixExpression.
|
||||
*
|
||||
* ES7 IncrementExpression[yield]:
|
||||
* 1) LeftHandSideExpression[?yield]
|
||||
* 2) LeftHandSideExpression[?yield] [[no LineTerminator here]]++
|
||||
* 3) LeftHandSideExpression[?yield] [[no LineTerminator here]]--
|
||||
* 4) ++LeftHandSideExpression[?yield]
|
||||
* 5) --LeftHandSideExpression[?yield]
|
||||
* In TypeScript (2), (3) are parsed as PostfixUnaryExpression. (4), (5) are parsed as PrefixUnaryExpression
|
||||
*/
|
||||
function parseIncrementExpression(): IncrementExpression {
|
||||
if (token === SyntaxKind.PlusPlusToken || token === SyntaxKind.MinusMinusToken) {
|
||||
let node = <PrefixUnaryExpression>createNode(SyntaxKind.PrefixUnaryExpression);
|
||||
node.operator = token;
|
||||
nextToken();
|
||||
node.operand = parseLeftHandSideExpressionOrHigher();
|
||||
return finishNode(node);
|
||||
}
|
||||
else if (sourceFile.languageVariant === LanguageVariant.JSX && token === SyntaxKind.LessThanToken && lookAhead(nextTokenIsIdentifierOrKeyword)) {
|
||||
// JSXElement is part of primaryExpression
|
||||
return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true);
|
||||
}
|
||||
|
||||
let expression = parseLeftHandSideExpressionOrHigher();
|
||||
|
||||
Debug.assert(isLeftHandSideExpression(expression));
|
||||
@@ -3326,19 +3450,43 @@ namespace ts {
|
||||
|
||||
function parseJsxElementOrSelfClosingElement(inExpressionContext: boolean): JsxElement | JsxSelfClosingElement {
|
||||
let opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext);
|
||||
let result: JsxElement | JsxSelfClosingElement;
|
||||
if (opening.kind === SyntaxKind.JsxOpeningElement) {
|
||||
let node = <JsxElement>createNode(SyntaxKind.JsxElement, opening.pos);
|
||||
node.openingElement = opening;
|
||||
|
||||
node.children = parseJsxChildren(node.openingElement.tagName);
|
||||
node.closingElement = parseJsxClosingElement(inExpressionContext);
|
||||
return finishNode(node);
|
||||
result = finishNode(node);
|
||||
}
|
||||
else {
|
||||
Debug.assert(opening.kind === SyntaxKind.JsxSelfClosingElement);
|
||||
// Nothing else to do for self-closing elements
|
||||
return <JsxSelfClosingElement>opening;
|
||||
result = <JsxSelfClosingElement>opening;
|
||||
}
|
||||
|
||||
// If the user writes the invalid code '<div></div><div></div>' in an expression context (i.e. not wrapped in
|
||||
// an enclosing tag), we'll naively try to parse ^ this as a 'less than' operator and the remainder of the tag
|
||||
// as garbage, which will cause the formatter to badly mangle the JSX. Perform a speculative parse of a JSX
|
||||
// element if we see a < token so that we can wrap it in a synthetic binary expression so the formatter
|
||||
// does less damage and we can report a better error.
|
||||
// Since JSX elements are invalid < operands anyway, this lookahead parse will only occur in error scenarios
|
||||
// of one sort or another.
|
||||
if (inExpressionContext && token === SyntaxKind.LessThanToken) {
|
||||
let invalidElement = tryParse(() => parseJsxElementOrSelfClosingElement(/*inExpressionContext*/true));
|
||||
if (invalidElement) {
|
||||
parseErrorAtCurrentToken(Diagnostics.JSX_expressions_must_have_one_parent_element);
|
||||
let badNode = <BinaryExpression>createNode(SyntaxKind.BinaryExpression, result.pos);
|
||||
badNode.end = invalidElement.end;
|
||||
badNode.left = result;
|
||||
badNode.right = invalidElement;
|
||||
badNode.operatorToken = createMissingNode(SyntaxKind.CommaToken, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined);
|
||||
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
|
||||
return <JsxElement><Node>badNode;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseJsxText(): JsxText {
|
||||
@@ -3384,7 +3532,7 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseJsxOpeningOrSelfClosingElement(inExpressionContext: boolean): JsxOpeningElement|JsxSelfClosingElement {
|
||||
function parseJsxOpeningOrSelfClosingElement(inExpressionContext: boolean): JsxOpeningElement | JsxSelfClosingElement {
|
||||
let fullStart = scanner.getStartPos();
|
||||
|
||||
parseExpected(SyntaxKind.LessThanToken);
|
||||
@@ -3499,7 +3647,7 @@ namespace ts {
|
||||
parseExpected(SyntaxKind.LessThanToken);
|
||||
node.type = parseType();
|
||||
parseExpected(SyntaxKind.GreaterThanToken);
|
||||
node.expression = parseUnaryExpressionOrHigher();
|
||||
node.expression = parseSimpleUnaryExpression();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
@@ -3758,11 +3906,23 @@ namespace ts {
|
||||
return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken);
|
||||
}
|
||||
|
||||
// Parse to check if it is short-hand property assignment or normal property assignment
|
||||
if ((token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken) && tokenIsIdentifier) {
|
||||
// check if it is short-hand property assignment or normal property assignment
|
||||
// NOTE: if token is EqualsToken it is interpreted as CoverInitializedName production
|
||||
// CoverInitializedName[Yield] :
|
||||
// IdentifierReference[?Yield] Initializer[In, ?Yield]
|
||||
// this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern
|
||||
const isShorthandPropertyAssignment =
|
||||
tokenIsIdentifier && (token === SyntaxKind.CommaToken || token === SyntaxKind.CloseBraceToken || token === SyntaxKind.EqualsToken);
|
||||
|
||||
if (isShorthandPropertyAssignment) {
|
||||
let shorthandDeclaration = <ShorthandPropertyAssignment>createNode(SyntaxKind.ShorthandPropertyAssignment, fullStart);
|
||||
shorthandDeclaration.name = <Identifier>propertyName;
|
||||
shorthandDeclaration.questionToken = questionToken;
|
||||
const equalsToken = parseOptionalToken(SyntaxKind.EqualsToken);
|
||||
if (equalsToken) {
|
||||
shorthandDeclaration.equalsToken = equalsToken;
|
||||
shorthandDeclaration.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
||||
}
|
||||
return finishNode(shorthandDeclaration);
|
||||
}
|
||||
else {
|
||||
|
||||
+12
-26
@@ -12,7 +12,7 @@ namespace ts {
|
||||
|
||||
let emptyArray: any[] = [];
|
||||
|
||||
export const version = "1.7.0";
|
||||
export const version = "1.8.0";
|
||||
|
||||
export function findConfigFile(searchPath: string): string {
|
||||
let fileName = "tsconfig.json";
|
||||
@@ -53,13 +53,13 @@ namespace ts {
|
||||
if (getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) {
|
||||
let failedLookupLocations: string[] = [];
|
||||
let candidate = normalizePath(combinePaths(containingDirectory, moduleName));
|
||||
let resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
|
||||
let resolvedFileName = loadNodeModuleFromFile(candidate, failedLookupLocations, host);
|
||||
|
||||
if (resolvedFileName) {
|
||||
return { resolvedModule: { resolvedFileName }, failedLookupLocations };
|
||||
}
|
||||
|
||||
resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host);
|
||||
resolvedFileName = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host);
|
||||
return resolvedFileName
|
||||
? { resolvedModule: { resolvedFileName }, failedLookupLocations }
|
||||
: { resolvedModule: undefined, failedLookupLocations };
|
||||
@@ -69,13 +69,8 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function loadNodeModuleFromFile(candidate: string, loadOnlyDts: boolean, failedLookupLocation: string[], host: ModuleResolutionHost): string {
|
||||
if (loadOnlyDts) {
|
||||
return tryLoad(".d.ts");
|
||||
}
|
||||
else {
|
||||
return forEach(supportedExtensions, tryLoad);
|
||||
}
|
||||
function loadNodeModuleFromFile(candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string {
|
||||
return forEach(moduleFileExtensions, tryLoad);
|
||||
|
||||
function tryLoad(ext: string): string {
|
||||
let fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext;
|
||||
@@ -89,7 +84,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function loadNodeModuleFromDirectory(candidate: string, loadOnlyDts: boolean, failedLookupLocation: string[], host: ModuleResolutionHost): string {
|
||||
function loadNodeModuleFromDirectory(candidate: string, failedLookupLocation: string[], host: ModuleResolutionHost): string {
|
||||
let packageJsonPath = combinePaths(candidate, "package.json");
|
||||
if (host.fileExists(packageJsonPath)) {
|
||||
|
||||
@@ -105,7 +100,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (jsonContent.typings) {
|
||||
let result = loadNodeModuleFromFile(normalizePath(combinePaths(candidate, jsonContent.typings)), loadOnlyDts, failedLookupLocation, host);
|
||||
let result = loadNodeModuleFromFile(normalizePath(combinePaths(candidate, jsonContent.typings)), failedLookupLocation, host);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
@@ -116,7 +111,7 @@ namespace ts {
|
||||
failedLookupLocation.push(packageJsonPath);
|
||||
}
|
||||
|
||||
return loadNodeModuleFromFile(combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host);
|
||||
return loadNodeModuleFromFile(combinePaths(candidate, "index"), failedLookupLocation, host);
|
||||
}
|
||||
|
||||
function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations {
|
||||
@@ -127,12 +122,12 @@ namespace ts {
|
||||
if (baseName !== "node_modules") {
|
||||
let nodeModulesFolder = combinePaths(directory, "node_modules");
|
||||
let candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName));
|
||||
let result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
|
||||
let result = loadNodeModuleFromFile(candidate, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations };
|
||||
}
|
||||
|
||||
result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host);
|
||||
result = loadNodeModuleFromDirectory(candidate, failedLookupLocations, host);
|
||||
if (result) {
|
||||
return { resolvedModule: { resolvedFileName: result, isExternalLibraryImport: true }, failedLookupLocations };
|
||||
}
|
||||
@@ -868,10 +863,6 @@ namespace ts {
|
||||
let start = getTokenPosOfNode(file.imports[i], file);
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
|
||||
}
|
||||
else if (!fileExtensionIs(importedFile.fileName, ".d.ts")) {
|
||||
let start = getTokenPosOfNode(file.imports[i], file);
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_can_only_be_in_d_ts_files_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
}
|
||||
else if (importedFile.referencedFiles.length) {
|
||||
let firstRef = importedFile.referencedFiles[0];
|
||||
fileProcessingDiagnostics.add(createFileDiagnostic(importedFile, firstRef.pos, firstRef.end - firstRef.pos, Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition));
|
||||
@@ -1010,7 +1001,7 @@ namespace ts {
|
||||
let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined);
|
||||
if (options.isolatedModules) {
|
||||
if (!options.module && languageVersion < ScriptTarget.ES6) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher));
|
||||
}
|
||||
|
||||
let firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined);
|
||||
@@ -1027,7 +1018,7 @@ namespace ts {
|
||||
|
||||
// Cannot specify module gen target of es6 when below es6
|
||||
if (options.module === ModuleKind.ES6 && languageVersion < ScriptTarget.ES6) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_es6_when_targeting_ES5_or_lower));
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower));
|
||||
}
|
||||
|
||||
// there has to be common source directory if user specified --outdir || --sourceRoot
|
||||
@@ -1076,11 +1067,6 @@ namespace ts {
|
||||
!options.experimentalDecorators) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
}
|
||||
|
||||
if (options.experimentalAsyncFunctions &&
|
||||
options.target !== ScriptTarget.ES6) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ namespace ts {
|
||||
"=>": SyntaxKind.EqualsGreaterThanToken,
|
||||
"+": SyntaxKind.PlusToken,
|
||||
"-": SyntaxKind.MinusToken,
|
||||
"**": SyntaxKind.AsteriskAsteriskToken,
|
||||
"*": SyntaxKind.AsteriskToken,
|
||||
"/": SyntaxKind.SlashToken,
|
||||
"%": SyntaxKind.PercentToken,
|
||||
@@ -158,6 +159,7 @@ namespace ts {
|
||||
"+=": SyntaxKind.PlusEqualsToken,
|
||||
"-=": SyntaxKind.MinusEqualsToken,
|
||||
"*=": SyntaxKind.AsteriskEqualsToken,
|
||||
"**=": SyntaxKind.AsteriskAsteriskEqualsToken,
|
||||
"/=": SyntaxKind.SlashEqualsToken,
|
||||
"%=": SyntaxKind.PercentEqualsToken,
|
||||
"<<=": SyntaxKind.LessThanLessThanEqualsToken,
|
||||
@@ -1200,6 +1202,12 @@ namespace ts {
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.equals) {
|
||||
return pos += 2, token = SyntaxKind.AsteriskEqualsToken;
|
||||
}
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.asterisk) {
|
||||
if (text.charCodeAt(pos + 2) === CharacterCodes.equals) {
|
||||
return pos += 3, token = SyntaxKind.AsteriskAsteriskEqualsToken;
|
||||
}
|
||||
return pos += 2, token = SyntaxKind.AsteriskAsteriskToken;
|
||||
}
|
||||
return pos++, token = SyntaxKind.AsteriskToken;
|
||||
case CharacterCodes.plus:
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.plus) {
|
||||
|
||||
+134
-19
@@ -9,7 +9,8 @@ namespace ts {
|
||||
writesToTty?(): boolean;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string, removed: boolean) => void): FileWatcher;
|
||||
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
|
||||
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
@@ -21,6 +22,12 @@ namespace ts {
|
||||
exit(exitCode?: number): void;
|
||||
}
|
||||
|
||||
interface WatchedFile {
|
||||
fileName: string;
|
||||
callback: (fileName: string, removed?: boolean) => void;
|
||||
mtime: Date;
|
||||
}
|
||||
|
||||
export interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
@@ -194,6 +201,103 @@ namespace ts {
|
||||
const _os = require("os");
|
||||
const _tty = require("tty");
|
||||
|
||||
// average async stat takes about 30 microseconds
|
||||
// set chunk size to do 30 files in < 1 millisecond
|
||||
function createWatchedFileSet(interval = 2500, chunkSize = 30) {
|
||||
let watchedFiles: WatchedFile[] = [];
|
||||
let nextFileToCheck = 0;
|
||||
let watchTimer: any;
|
||||
|
||||
function getModifiedTime(fileName: string): Date {
|
||||
return _fs.statSync(fileName).mtime;
|
||||
}
|
||||
|
||||
function poll(checkedIndex: number) {
|
||||
let watchedFile = watchedFiles[checkedIndex];
|
||||
if (!watchedFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
_fs.stat(watchedFile.fileName, (err: any, stats: any) => {
|
||||
if (err) {
|
||||
watchedFile.callback(watchedFile.fileName);
|
||||
}
|
||||
else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) {
|
||||
watchedFile.mtime = getModifiedTime(watchedFile.fileName);
|
||||
watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// this implementation uses polling and
|
||||
// stat due to inconsistencies of fs.watch
|
||||
// and efficiency of stat on modern filesystems
|
||||
function startWatchTimer() {
|
||||
watchTimer = setInterval(() => {
|
||||
let count = 0;
|
||||
let nextToCheck = nextFileToCheck;
|
||||
let firstCheck = -1;
|
||||
while ((count < chunkSize) && (nextToCheck !== firstCheck)) {
|
||||
poll(nextToCheck);
|
||||
if (firstCheck < 0) {
|
||||
firstCheck = nextToCheck;
|
||||
}
|
||||
nextToCheck++;
|
||||
if (nextToCheck === watchedFiles.length) {
|
||||
nextToCheck = 0;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
nextFileToCheck = nextToCheck;
|
||||
}, interval);
|
||||
}
|
||||
|
||||
function addFile(fileName: string, callback: (fileName: string, removed?: boolean) => void): WatchedFile {
|
||||
let file: WatchedFile = {
|
||||
fileName,
|
||||
callback,
|
||||
mtime: getModifiedTime(fileName)
|
||||
};
|
||||
|
||||
watchedFiles.push(file);
|
||||
if (watchedFiles.length === 1) {
|
||||
startWatchTimer();
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
function removeFile(file: WatchedFile) {
|
||||
watchedFiles = copyListRemovingItem(file, watchedFiles);
|
||||
}
|
||||
|
||||
return {
|
||||
getModifiedTime: getModifiedTime,
|
||||
poll: poll,
|
||||
startWatchTimer: startWatchTimer,
|
||||
addFile: addFile,
|
||||
removeFile: removeFile
|
||||
};
|
||||
}
|
||||
|
||||
// REVIEW: for now this implementation uses polling.
|
||||
// The advantage of polling is that it works reliably
|
||||
// on all os and with network mounted files.
|
||||
// For 90 referenced files, the average time to detect
|
||||
// changes is 2*msInterval (by default 5 seconds).
|
||||
// The overhead of this is .04 percent (1/2500) with
|
||||
// average pause of < 1 millisecond (and max
|
||||
// pause less than 1.5 milliseconds); question is
|
||||
// do we anticipate reference sets in the 100s and
|
||||
// do we care about waiting 10-20 seconds to detect
|
||||
// changes for large reference sets? If so, do we want
|
||||
// to increase the chunk size or decrease the interval
|
||||
// time dynamically to match the large reference set?
|
||||
let watchedFileSet = createWatchedFileSet();
|
||||
|
||||
function isNode4OrLater(): Boolean {
|
||||
return parseInt(process.version.charAt(1)) >= 4;
|
||||
}
|
||||
|
||||
const platform: string = _os.platform();
|
||||
// win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive
|
||||
const useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin";
|
||||
@@ -279,25 +383,36 @@ namespace ts {
|
||||
readFile,
|
||||
writeFile,
|
||||
watchFile: (fileName, callback) => {
|
||||
// watchFile polls a file every 250ms, picking up file notifications.
|
||||
_fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
|
||||
|
||||
return {
|
||||
close() { _fs.unwatchFile(fileName, fileChanged); }
|
||||
};
|
||||
|
||||
function fileChanged(curr: any, prev: any) {
|
||||
// mtime.getTime() equals 0 if file was removed
|
||||
if (curr.mtime.getTime() === 0) {
|
||||
callback(fileName, /* removed */ true);
|
||||
return;
|
||||
}
|
||||
if (+curr.mtime <= +prev.mtime) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback(fileName, /* removed */ false);
|
||||
// Node 4.0 stablized the `fs.watch` function on Windows which avoids polling
|
||||
// and is more efficient than `fs.watchFile` (ref: https://github.com/nodejs/node/pull/2649
|
||||
// and https://github.com/Microsoft/TypeScript/issues/4643), therefore
|
||||
// if the current node.js version is newer than 4, use `fs.watch` instead.
|
||||
if (isNode4OrLater()) {
|
||||
// Note: in node the callback of fs.watch is given only the relative file name as a parameter
|
||||
return _fs.watch(fileName, (eventName: string, relativeFileName: string) => callback(fileName));
|
||||
}
|
||||
|
||||
let watchedFile = watchedFileSet.addFile(fileName, callback);
|
||||
return {
|
||||
close: () => watchedFileSet.removeFile(watchedFile)
|
||||
};
|
||||
},
|
||||
watchDirectory: (path, callback, recursive) => {
|
||||
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
||||
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
||||
return _fs.watch(
|
||||
path,
|
||||
{ persistent: true, recursive: !!recursive },
|
||||
(eventName: string, relativeFileName: string) => {
|
||||
// In watchDirectory we only care about adding and removing files (when event name is
|
||||
// "rename"); changes made within files are handled by corresponding fileWatchers (when
|
||||
// event name is "change")
|
||||
if (eventName === "rename") {
|
||||
// When deleting a file, the passed baseFileName is null
|
||||
callback(!relativeFileName ? relativeFileName : normalizePath(ts.combinePaths(path, relativeFileName)));
|
||||
};
|
||||
}
|
||||
);
|
||||
},
|
||||
resolvePath: function (path: string): string {
|
||||
return _path.resolve(path);
|
||||
|
||||
+101
-31
@@ -224,14 +224,22 @@ namespace ts {
|
||||
|
||||
export function executeCommandLine(args: string[]): void {
|
||||
let commandLine = parseCommandLine(args);
|
||||
let configFileName: string; // Configuration file name (if any)
|
||||
let configFileWatcher: FileWatcher; // Configuration file watcher
|
||||
let cachedProgram: Program; // Program cached from last compilation
|
||||
let rootFileNames: string[]; // Root fileNames for compilation
|
||||
let compilerOptions: CompilerOptions; // Compiler options for compilation
|
||||
let compilerHost: CompilerHost; // Compiler host
|
||||
let hostGetSourceFile: typeof compilerHost.getSourceFile; // getSourceFile method from default host
|
||||
let timerHandle: number; // Handle for 0.25s wait timer
|
||||
let configFileName: string; // Configuration file name (if any)
|
||||
let cachedConfigFileText: string; // Cached configuration file text, used for reparsing (if any)
|
||||
let configFileWatcher: FileWatcher; // Configuration file watcher
|
||||
let directoryWatcher: FileWatcher; // Directory watcher to monitor source file addition/removal
|
||||
let cachedProgram: Program; // Program cached from last compilation
|
||||
let rootFileNames: string[]; // Root fileNames for compilation
|
||||
let compilerOptions: CompilerOptions; // Compiler options for compilation
|
||||
let compilerHost: CompilerHost; // Compiler host
|
||||
let hostGetSourceFile: typeof compilerHost.getSourceFile; // getSourceFile method from default host
|
||||
let timerHandleForRecompilation: number; // Handle for 0.25s wait timer to trigger recompilation
|
||||
let timerHandleForDirectoryChanges: number; // Handle for 0.25s wait timer to trigger directory change handler
|
||||
|
||||
// This map stores and reuses results of fileExists check that happen inside 'createProgram'
|
||||
// This allows to save time in module resolution heavy scenarios when existence of the same file might be checked multiple times.
|
||||
let cachedExistingFiles: Map<boolean>;
|
||||
let hostFileExists: typeof compilerHost.fileExists;
|
||||
|
||||
if (commandLine.options.locale) {
|
||||
if (!isJSONSupported()) {
|
||||
@@ -295,28 +303,49 @@ namespace ts {
|
||||
if (configFileName) {
|
||||
configFileWatcher = sys.watchFile(configFileName, configFileChanged);
|
||||
}
|
||||
if (sys.watchDirectory && configFileName) {
|
||||
let directory = ts.getDirectoryPath(configFileName);
|
||||
directoryWatcher = sys.watchDirectory(
|
||||
// When the configFileName is just "tsconfig.json", the watched directory should be
|
||||
// the current direcotry; if there is a given "project" parameter, then the configFileName
|
||||
// is an absolute file name.
|
||||
directory == "" ? "." : directory,
|
||||
watchedDirectoryChanged, /*recursive*/ true);
|
||||
}
|
||||
}
|
||||
|
||||
performCompilation();
|
||||
|
||||
function parseConfigFile(): ParsedCommandLine {
|
||||
if (!cachedConfigFileText) {
|
||||
try {
|
||||
cachedConfigFileText = sys.readFile(configFileName);
|
||||
}
|
||||
catch (e) {
|
||||
let error = createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, configFileName, e.message);
|
||||
reportWatchDiagnostic(error);
|
||||
sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let result = parseConfigFileTextToJson(configFileName, cachedConfigFileText);
|
||||
let configObject = result.config;
|
||||
let configParseResult = parseJsonConfigFileContent(configObject, sys, getDirectoryPath(configFileName));
|
||||
if (configParseResult.errors.length > 0) {
|
||||
reportDiagnostics(configParseResult.errors);
|
||||
sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
return;
|
||||
}
|
||||
return configParseResult;
|
||||
}
|
||||
|
||||
// Invoked to perform initial compilation or re-compilation in watch mode
|
||||
function performCompilation() {
|
||||
|
||||
if (!cachedProgram) {
|
||||
if (configFileName) {
|
||||
|
||||
let result = readConfigFile(configFileName, sys.readFile);
|
||||
if (result.error) {
|
||||
reportWatchDiagnostic(result.error);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
|
||||
let configObject = result.config;
|
||||
let configParseResult = parseConfigFile(configObject, sys, getDirectoryPath(configFileName));
|
||||
if (configParseResult.errors.length > 0) {
|
||||
reportDiagnostics(configParseResult.errors);
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
let configParseResult = parseConfigFile();
|
||||
rootFileNames = configParseResult.fileNames;
|
||||
compilerOptions = extend(commandLine.options, configParseResult.options);
|
||||
}
|
||||
@@ -327,12 +356,18 @@ namespace ts {
|
||||
compilerHost = createCompilerHost(compilerOptions);
|
||||
hostGetSourceFile = compilerHost.getSourceFile;
|
||||
compilerHost.getSourceFile = getSourceFile;
|
||||
|
||||
hostFileExists = compilerHost.fileExists;
|
||||
compilerHost.fileExists = cachedFileExists;
|
||||
}
|
||||
|
||||
if (compilerOptions.diagnosticStyle === DiagnosticStyle.Pretty) {
|
||||
reportDiagnostic = reportDiagnosticWithColorAndContext;
|
||||
}
|
||||
|
||||
// reset the cache of existing files
|
||||
cachedExistingFiles = {};
|
||||
|
||||
let compileResult = compile(rootFileNames, compilerOptions, compilerHost);
|
||||
|
||||
if (!compilerOptions.watch) {
|
||||
@@ -343,6 +378,13 @@ namespace ts {
|
||||
reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes));
|
||||
}
|
||||
|
||||
function cachedFileExists(fileName: string): boolean {
|
||||
if (hasProperty(cachedExistingFiles, fileName)) {
|
||||
return cachedExistingFiles[fileName];
|
||||
}
|
||||
return cachedExistingFiles[fileName] = hostFileExists(fileName);
|
||||
}
|
||||
|
||||
function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) {
|
||||
// Return existing SourceFile object if one is available
|
||||
if (cachedProgram) {
|
||||
@@ -356,7 +398,7 @@ namespace ts {
|
||||
let sourceFile = hostGetSourceFile(fileName, languageVersion, onError);
|
||||
if (sourceFile && compilerOptions.watch) {
|
||||
// Attach a file watcher
|
||||
sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, (fileName, removed) => sourceFileChanged(sourceFile, removed));
|
||||
sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, (fileName: string, removed?: boolean) => sourceFileChanged(sourceFile, removed));
|
||||
}
|
||||
return sourceFile;
|
||||
}
|
||||
@@ -378,7 +420,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// If a source file changes, mark it as unwatched and start the recompilation timer
|
||||
function sourceFileChanged(sourceFile: SourceFile, removed: boolean) {
|
||||
function sourceFileChanged(sourceFile: SourceFile, removed?: boolean) {
|
||||
sourceFile.fileWatcher.close();
|
||||
sourceFile.fileWatcher = undefined;
|
||||
if (removed) {
|
||||
@@ -387,27 +429,55 @@ namespace ts {
|
||||
rootFileNames.splice(index, 1);
|
||||
}
|
||||
}
|
||||
startTimer();
|
||||
startTimerForRecompilation();
|
||||
}
|
||||
|
||||
// If the configuration file changes, forget cached program and start the recompilation timer
|
||||
function configFileChanged() {
|
||||
setCachedProgram(undefined);
|
||||
startTimer();
|
||||
cachedConfigFileText = undefined;
|
||||
startTimerForRecompilation();
|
||||
}
|
||||
|
||||
function watchedDirectoryChanged(fileName: string) {
|
||||
if (fileName && !ts.isSupportedSourceFileName(fileName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
startTimerForHandlingDirectoryChanges();
|
||||
}
|
||||
|
||||
function startTimerForHandlingDirectoryChanges() {
|
||||
if (timerHandleForDirectoryChanges) {
|
||||
clearTimeout(timerHandleForDirectoryChanges);
|
||||
}
|
||||
timerHandleForDirectoryChanges = setTimeout(directoryChangeHandler, 250);
|
||||
}
|
||||
|
||||
function directoryChangeHandler() {
|
||||
let parsedCommandLine = parseConfigFile();
|
||||
let newFileNames = ts.map(parsedCommandLine.fileNames, compilerHost.getCanonicalFileName);
|
||||
let canonicalRootFileNames = ts.map(rootFileNames, compilerHost.getCanonicalFileName);
|
||||
|
||||
// We check if the project file list has changed. If so, we just throw away the old program and start fresh.
|
||||
if (!arrayIsEqualTo(newFileNames && newFileNames.sort(), canonicalRootFileNames && canonicalRootFileNames.sort())) {
|
||||
setCachedProgram(undefined);
|
||||
startTimerForRecompilation();
|
||||
}
|
||||
}
|
||||
|
||||
// Upon detecting a file change, wait for 250ms and then perform a recompilation. This gives batch
|
||||
// operations (such as saving all modified files in an editor) a chance to complete before we kick
|
||||
// off a new compilation.
|
||||
function startTimer() {
|
||||
if (timerHandle) {
|
||||
clearTimeout(timerHandle);
|
||||
function startTimerForRecompilation() {
|
||||
if (timerHandleForRecompilation) {
|
||||
clearTimeout(timerHandleForRecompilation);
|
||||
}
|
||||
timerHandle = setTimeout(recompile, 250);
|
||||
timerHandleForRecompilation = setTimeout(recompile, 250);
|
||||
}
|
||||
|
||||
function recompile() {
|
||||
timerHandle = undefined;
|
||||
timerHandleForRecompilation = undefined;
|
||||
reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation));
|
||||
performCompilation();
|
||||
}
|
||||
@@ -596,7 +666,7 @@ namespace ts {
|
||||
|
||||
function writeConfigFile(options: CompilerOptions, fileNames: string[]) {
|
||||
let currentDirectory = sys.getCurrentDirectory();
|
||||
let file = combinePaths(currentDirectory, "tsconfig.json");
|
||||
let file = normalizePath(combinePaths(currentDirectory, "tsconfig.json"));
|
||||
if (sys.fileExists(file)) {
|
||||
reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file));
|
||||
}
|
||||
|
||||
+18
-7
@@ -64,6 +64,7 @@ namespace ts {
|
||||
PlusToken,
|
||||
MinusToken,
|
||||
AsteriskToken,
|
||||
AsteriskAsteriskToken,
|
||||
SlashToken,
|
||||
PercentToken,
|
||||
PlusPlusToken,
|
||||
@@ -86,6 +87,7 @@ namespace ts {
|
||||
PlusEqualsToken,
|
||||
MinusEqualsToken,
|
||||
AsteriskEqualsToken,
|
||||
AsteriskAsteriskEqualsToken,
|
||||
SlashEqualsToken,
|
||||
PercentEqualsToken,
|
||||
LessThanLessThanEqualsToken,
|
||||
@@ -359,6 +361,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export const enum NodeFlags {
|
||||
None = 0,
|
||||
Export = 0x00000001, // Declarations
|
||||
Ambient = 0x00000002, // Declarations
|
||||
Public = 0x00000010, // Property/Method
|
||||
@@ -562,6 +565,10 @@ namespace ts {
|
||||
export interface ShorthandPropertyAssignment extends ObjectLiteralElement {
|
||||
name: Identifier;
|
||||
questionToken?: Node;
|
||||
// used when ObjectLiteralExpression is used in ObjectAssignmentPattern
|
||||
// it is grammar error to appear in actual object initializer
|
||||
equalsToken?: Node;
|
||||
objectAssignmentInitializer?: Expression;
|
||||
}
|
||||
|
||||
// SyntaxKind.VariableDeclaration
|
||||
@@ -707,12 +714,16 @@ namespace ts {
|
||||
_unaryExpressionBrand: any;
|
||||
}
|
||||
|
||||
export interface PrefixUnaryExpression extends UnaryExpression {
|
||||
export interface IncrementExpression extends UnaryExpression {
|
||||
_incrementExpressionBrand: any;
|
||||
}
|
||||
|
||||
export interface PrefixUnaryExpression extends IncrementExpression {
|
||||
operator: SyntaxKind;
|
||||
operand: UnaryExpression;
|
||||
}
|
||||
|
||||
export interface PostfixUnaryExpression extends PostfixExpression {
|
||||
export interface PostfixUnaryExpression extends IncrementExpression {
|
||||
operand: LeftHandSideExpression;
|
||||
operator: SyntaxKind;
|
||||
}
|
||||
@@ -721,7 +732,7 @@ namespace ts {
|
||||
_postfixExpressionBrand: any;
|
||||
}
|
||||
|
||||
export interface LeftHandSideExpression extends PostfixExpression {
|
||||
export interface LeftHandSideExpression extends IncrementExpression {
|
||||
_leftHandSideExpressionBrand: any;
|
||||
}
|
||||
|
||||
@@ -1295,7 +1306,7 @@ namespace ts {
|
||||
getCurrentDirectory(): string;
|
||||
}
|
||||
|
||||
export interface ParseConfigHost extends ModuleResolutionHost {
|
||||
export interface ParseConfigHost {
|
||||
readDirectory(rootDir: string, extension: string, exclude: string[]): string[];
|
||||
}
|
||||
|
||||
@@ -1598,7 +1609,6 @@ namespace 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;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
getReferencedValueDeclaration(reference: Identifier): Declaration;
|
||||
getTypeReferenceSerializationKind(typeName: EntityName): TypeReferenceSerializationKind;
|
||||
isOptionalParameter(node: ParameterDeclaration): boolean;
|
||||
@@ -2078,7 +2088,6 @@ namespace ts {
|
||||
watch?: boolean;
|
||||
isolatedModules?: boolean;
|
||||
experimentalDecorators?: boolean;
|
||||
experimentalAsyncFunctions?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
moduleResolution?: ModuleResolutionKind;
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
@@ -2096,6 +2105,7 @@ namespace ts {
|
||||
UMD = 3,
|
||||
System = 4,
|
||||
ES6 = 5,
|
||||
ES2015 = ES6,
|
||||
}
|
||||
|
||||
export const enum JsxEmit {
|
||||
@@ -2121,12 +2131,13 @@ namespace ts {
|
||||
ES3 = 0,
|
||||
ES5 = 1,
|
||||
ES6 = 2,
|
||||
ES2015 = ES6,
|
||||
Latest = ES6,
|
||||
}
|
||||
|
||||
export const enum LanguageVariant {
|
||||
Standard,
|
||||
JSX
|
||||
JSX,
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
||||
+18
-10
@@ -82,17 +82,17 @@ namespace ts {
|
||||
return node.end - node.pos;
|
||||
}
|
||||
|
||||
export function arrayIsEqualTo<T>(arr1: T[], arr2: T[], comparer?: (a: T, b: T) => boolean): boolean {
|
||||
if (!arr1 || !arr2) {
|
||||
return arr1 === arr2;
|
||||
export function arrayIsEqualTo<T>(array1: T[], array2: T[], equaler?: (a: T, b: T) => boolean): boolean {
|
||||
if (!array1 || !array2) {
|
||||
return array1 === array2;
|
||||
}
|
||||
|
||||
if (arr1.length !== arr2.length) {
|
||||
if (array1.length !== array2.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < arr1.length; ++i) {
|
||||
let equals = comparer ? comparer(arr1[i], arr2[i]) : arr1[i] === arr2[i];
|
||||
for (let i = 0; i < array1.length; ++i) {
|
||||
let equals = equaler ? equaler(array1[i], array2[i]) : array1[i] === array2[i];
|
||||
if (!equals) {
|
||||
return false;
|
||||
}
|
||||
@@ -896,6 +896,14 @@ namespace ts {
|
||||
return nodeIsDecorated(node) || childIsDecorated(node);
|
||||
}
|
||||
|
||||
export function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression {
|
||||
return node.kind === SyntaxKind.PropertyAccessExpression;
|
||||
}
|
||||
|
||||
export function isElementAccessExpression(node: Node): node is ElementAccessExpression {
|
||||
return node.kind === SyntaxKind.ElementAccessExpression;
|
||||
}
|
||||
|
||||
export function isExpression(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.SuperKeyword:
|
||||
@@ -1414,7 +1422,7 @@ namespace ts {
|
||||
* where Symbol is literally the word "Symbol", and name is any identifierName
|
||||
*/
|
||||
export function isWellKnownSymbolSyntactically(node: Expression): boolean {
|
||||
return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((<PropertyAccessExpression>node).expression);
|
||||
return isPropertyAccessExpression(node) && isESSymbolIdentifier(node.expression);
|
||||
}
|
||||
|
||||
export function getPropertyNameForPropertyNameNode(name: DeclarationName): string {
|
||||
@@ -1497,7 +1505,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node {
|
||||
let node = <SynthesizedNode>createNode(kind);
|
||||
let node = <SynthesizedNode>createNode(kind, /* pos */ -1, /* end */ -1);
|
||||
node.startsOnNewLine = startsOnNewLine;
|
||||
return node;
|
||||
}
|
||||
@@ -2047,8 +2055,8 @@ namespace ts {
|
||||
if (node.kind === SyntaxKind.Identifier) {
|
||||
return true;
|
||||
}
|
||||
else if (node.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
return isSupportedExpressionWithTypeArgumentsRest((<PropertyAccessExpression>node).expression);
|
||||
else if (isPropertyAccessExpression(node)) {
|
||||
return isSupportedExpressionWithTypeArgumentsRest(node.expression);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
||||
@@ -100,6 +100,8 @@ namespace FourSlash {
|
||||
end: number;
|
||||
}
|
||||
|
||||
export import IndentStyle = ts.IndentStyle;
|
||||
|
||||
let entityMap: ts.Map<string> = {
|
||||
"&": "&",
|
||||
"\"": """,
|
||||
@@ -309,6 +311,7 @@ namespace FourSlash {
|
||||
TabSize: 4,
|
||||
NewLineCharacter: Harness.IO.newLine(),
|
||||
ConvertTabsToSpaces: true,
|
||||
IndentStyle: ts.IndentStyle.Smart,
|
||||
InsertSpaceAfterCommaDelimiter: true,
|
||||
InsertSpaceAfterSemicolonInForStatements: true,
|
||||
InsertSpaceBeforeAndAfterBinaryOperators: true,
|
||||
@@ -588,14 +591,21 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyCompletionListItemsCountIsGreaterThan(count: number) {
|
||||
public verifyCompletionListItemsCountIsGreaterThan(count: number, negative: boolean) {
|
||||
this.taoInvalidReason = "verifyCompletionListItemsCountIsGreaterThan NYI";
|
||||
|
||||
let completions = this.getCompletionListAtCaret();
|
||||
let itemsCount = completions.entries.length;
|
||||
|
||||
if (itemsCount <= count) {
|
||||
this.raiseError(`Expected completion list items count to be greater than ${count}, but is actually ${itemsCount}`);
|
||||
if (negative) {
|
||||
if (itemsCount > count) {
|
||||
this.raiseError(`Expected completion list items count to not be greater than ${count}, but is actually ${itemsCount}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (itemsCount <= count) {
|
||||
this.raiseError(`Expected completion list items count to be greater than ${count}, but is actually ${itemsCount}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1695,24 +1705,28 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
private getIndentation(fileName: string, position: number): number {
|
||||
return this.languageService.getIndentationAtPosition(fileName, position, this.formatCodeOptions);
|
||||
private getIndentation(fileName: string, position: number, indentStyle: ts.IndentStyle): number {
|
||||
|
||||
let formatOptions = ts.clone(this.formatCodeOptions);
|
||||
formatOptions.IndentStyle = indentStyle;
|
||||
|
||||
return this.languageService.getIndentationAtPosition(fileName, position, formatOptions);
|
||||
}
|
||||
|
||||
public verifyIndentationAtCurrentPosition(numberOfSpaces: number) {
|
||||
public verifyIndentationAtCurrentPosition(numberOfSpaces: number, indentStyle: ts.IndentStyle = ts.IndentStyle.Smart) {
|
||||
this.taoInvalidReason = "verifyIndentationAtCurrentPosition NYI";
|
||||
|
||||
let actual = this.getIndentation(this.activeFile.fileName, this.currentCaretPosition);
|
||||
let actual = this.getIndentation(this.activeFile.fileName, this.currentCaretPosition, indentStyle);
|
||||
let lineCol = this.getLineColStringAtPosition(this.currentCaretPosition);
|
||||
if (actual !== numberOfSpaces) {
|
||||
this.raiseError(`verifyIndentationAtCurrentPosition failed at ${lineCol} - expected: ${numberOfSpaces}, actual: ${actual}`);
|
||||
}
|
||||
}
|
||||
|
||||
public verifyIndentationAtPosition(fileName: string, position: number, numberOfSpaces: number) {
|
||||
public verifyIndentationAtPosition(fileName: string, position: number, numberOfSpaces: number, indentStyle: ts.IndentStyle = ts.IndentStyle.Smart) {
|
||||
this.taoInvalidReason = "verifyIndentationAtPosition NYI";
|
||||
|
||||
let actual = this.getIndentation(fileName, position);
|
||||
let actual = this.getIndentation(fileName, position, indentStyle);
|
||||
let lineCol = this.getLineColStringAtPosition(position);
|
||||
if (actual !== numberOfSpaces) {
|
||||
this.raiseError(`verifyIndentationAtPosition failed at ${lineCol} - expected: ${numberOfSpaces}, actual: ${actual}`);
|
||||
|
||||
@@ -274,7 +274,9 @@ namespace Utils {
|
||||
|
||||
case "flags":
|
||||
// Print out flags with their enum names.
|
||||
o[propertyName] = getNodeFlagName(n.flags);
|
||||
if (n.flags) {
|
||||
o[propertyName] = getNodeFlagName(n.flags);
|
||||
}
|
||||
break;
|
||||
|
||||
case "parserContextFlags":
|
||||
|
||||
@@ -572,6 +572,10 @@ namespace Harness.LanguageService {
|
||||
return { close() { } };
|
||||
}
|
||||
|
||||
watchDirectory(path: string, callback: (path: string) => void, recursive?: boolean): ts.FileWatcher {
|
||||
return { close() { } };
|
||||
}
|
||||
|
||||
close(): void {
|
||||
}
|
||||
|
||||
@@ -614,7 +618,9 @@ namespace Harness.LanguageService {
|
||||
// This host is just a proxy for the clientHost, it uses the client
|
||||
// host to answer server queries about files on disk
|
||||
let serverHost = new SessionServerHost(clientHost);
|
||||
let server = new ts.server.Session(serverHost, Buffer.byteLength, process.hrtime, serverHost);
|
||||
let server = new ts.server.Session(serverHost,
|
||||
Buffer ? Buffer.byteLength : (string: string, encoding?: string) => string.length,
|
||||
process.hrtime, serverHost);
|
||||
|
||||
// Fake the connection between the client and the server
|
||||
serverHost.writeMessage = client.onMessage.bind(client);
|
||||
|
||||
@@ -78,8 +78,8 @@ namespace RWC {
|
||||
let tsconfigFile = ts.forEach(ioLog.filesRead, f => isTsConfigFile(f) ? f : undefined);
|
||||
if (tsconfigFile) {
|
||||
let tsconfigFileContents = getHarnessCompilerInputUnit(tsconfigFile.path);
|
||||
let parsedTsconfigFileContents = ts.parseConfigFileText(tsconfigFile.path, tsconfigFileContents.content);
|
||||
let configParseResult = ts.parseConfigFile(parsedTsconfigFileContents.config, Harness.IO, ts.getDirectoryPath(tsconfigFile.path));
|
||||
let parsedTsconfigFileContents = ts.parseConfigFileTextToJson(tsconfigFile.path, tsconfigFileContents.content);
|
||||
let configParseResult = ts.parseJsonConfigFileContent(parsedTsconfigFileContents.config, Harness.IO, ts.getDirectoryPath(tsconfigFile.path));
|
||||
fileNames = configParseResult.fileNames;
|
||||
opts.options = ts.extend(opts.options, configParseResult.options);
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1210,7 +1210,7 @@ interface ArrayBuffer {
|
||||
interface ArrayBufferConstructor {
|
||||
prototype: ArrayBuffer;
|
||||
new (byteLength: number): ArrayBuffer;
|
||||
isView(arg: any): boolean;
|
||||
isView(arg: any): arg is ArrayBufferView;
|
||||
}
|
||||
declare var ArrayBuffer: ArrayBufferConstructor;
|
||||
|
||||
|
||||
Vendored
+9
-7
@@ -1067,7 +1067,7 @@ declare var CanvasPattern: {
|
||||
|
||||
interface CanvasRenderingContext2D {
|
||||
canvas: HTMLCanvasElement;
|
||||
fillStyle: any;
|
||||
fillStyle: string | CanvasGradient | CanvasPattern;
|
||||
font: string;
|
||||
globalAlpha: number;
|
||||
globalCompositeOperation: string;
|
||||
@@ -1082,7 +1082,7 @@ interface CanvasRenderingContext2D {
|
||||
shadowColor: string;
|
||||
shadowOffsetX: number;
|
||||
shadowOffsetY: number;
|
||||
strokeStyle: any;
|
||||
strokeStyle: string | CanvasGradient | CanvasPattern;
|
||||
textAlign: string;
|
||||
textBaseline: string;
|
||||
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
|
||||
@@ -7893,6 +7893,10 @@ declare var Node: {
|
||||
}
|
||||
|
||||
interface NodeFilter {
|
||||
acceptNode(n: Node): number;
|
||||
}
|
||||
|
||||
declare var NodeFilter: {
|
||||
FILTER_ACCEPT: number;
|
||||
FILTER_REJECT: number;
|
||||
FILTER_SKIP: number;
|
||||
@@ -7910,7 +7914,6 @@ interface NodeFilter {
|
||||
SHOW_PROCESSING_INSTRUCTION: number;
|
||||
SHOW_TEXT: number;
|
||||
}
|
||||
declare var NodeFilter: NodeFilter;
|
||||
|
||||
interface NodeIterator {
|
||||
expandEntityReferences: boolean;
|
||||
@@ -8620,7 +8623,6 @@ declare var SVGDescElement: {
|
||||
|
||||
interface SVGElement extends Element {
|
||||
id: string;
|
||||
className: any;
|
||||
onclick: (ev: MouseEvent) => any;
|
||||
ondblclick: (ev: MouseEvent) => any;
|
||||
onfocusin: (ev: FocusEvent) => any;
|
||||
@@ -8634,6 +8636,7 @@ interface SVGElement extends Element {
|
||||
ownerSVGElement: SVGSVGElement;
|
||||
viewportElement: SVGElement;
|
||||
xmlbase: string;
|
||||
className: any;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -12509,7 +12512,6 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
|
||||
interface NodeListOf<TNode extends Node> extends NodeList {
|
||||
length: number;
|
||||
item(index: number): TNode;
|
||||
@@ -12530,8 +12532,6 @@ interface EventListenerObject {
|
||||
handleEvent(evt: Event): void;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface MessageEventInit extends EventInit {
|
||||
data?: any;
|
||||
origin?: string;
|
||||
@@ -12547,6 +12547,8 @@ interface ProgressEventInit extends EventInit {
|
||||
total?: number;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
|
||||
}
|
||||
|
||||
Vendored
+2
-3
@@ -894,7 +894,6 @@ interface WorkerUtils extends Object, WindowBase64 {
|
||||
setTimeout(handler: any, timeout?: any, ...args: any[]): number;
|
||||
}
|
||||
|
||||
|
||||
interface BlobPropertyBag {
|
||||
type?: string;
|
||||
endings?: string;
|
||||
@@ -909,8 +908,6 @@ interface EventListenerObject {
|
||||
handleEvent(evt: Event): void;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface MessageEventInit extends EventInit {
|
||||
data?: any;
|
||||
origin?: string;
|
||||
@@ -926,6 +923,8 @@ interface ProgressEventInit extends EventInit {
|
||||
total?: number;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
|
||||
}
|
||||
|
||||
+209
-56
@@ -78,19 +78,19 @@ namespace ts.server {
|
||||
return this.snap().getChangeRange(oldSnapshot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface TimestampedResolvedModule extends ResolvedModuleWithFailedLookupLocations {
|
||||
lastCheckTime: number;
|
||||
lastCheckTime: number;
|
||||
}
|
||||
|
||||
|
||||
export class LSHost implements ts.LanguageServiceHost {
|
||||
ls: ts.LanguageService = null;
|
||||
compilationSettings: ts.CompilerOptions;
|
||||
filenameToScript: ts.Map<ScriptInfo> = {};
|
||||
roots: ScriptInfo[] = [];
|
||||
private resolvedModuleNames: ts.FileMap<Map<TimestampedResolvedModule>>;
|
||||
private resolvedModuleNames: ts.FileMap<Map<TimestampedResolvedModule>>;
|
||||
private moduleResolutionHost: ts.ModuleResolutionHost;
|
||||
|
||||
|
||||
constructor(public host: ServerHost, public project: Project) {
|
||||
this.resolvedModuleNames = ts.createFileMap<Map<TimestampedResolvedModule>>(ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames))
|
||||
this.moduleResolutionHost = {
|
||||
@@ -98,15 +98,15 @@ namespace ts.server {
|
||||
readFile: fileName => this.host.readFile(fileName)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resolveModuleNames(moduleNames: string[], containingFile: string): ResolvedModule[] {
|
||||
let currentResolutionsInFile = this.resolvedModuleNames.get(containingFile);
|
||||
|
||||
|
||||
let newResolutions: Map<TimestampedResolvedModule> = {};
|
||||
let resolvedModules: ResolvedModule[] = [];
|
||||
|
||||
|
||||
let compilerOptions = this.getCompilationSettings();
|
||||
|
||||
|
||||
for (let moduleName of moduleNames) {
|
||||
// check if this is a duplicate entry in the list
|
||||
let resolution = lookUp(newResolutions, moduleName);
|
||||
@@ -122,21 +122,21 @@ namespace ts.server {
|
||||
newResolutions[moduleName] = resolution;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ts.Debug.assert(resolution !== undefined);
|
||||
|
||||
|
||||
resolvedModules.push(resolution.resolvedModule);
|
||||
}
|
||||
|
||||
// replace old results with a new one
|
||||
this.resolvedModuleNames.set(containingFile, newResolutions);
|
||||
return resolvedModules;
|
||||
|
||||
|
||||
function moduleResolutionIsValid(resolution: TimestampedResolvedModule): boolean {
|
||||
if (!resolution) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (resolution.resolvedModule) {
|
||||
// TODO: consider checking failedLookupLocations
|
||||
// TODO: use lastCheckTime to track expiration for module name resolution
|
||||
@@ -147,7 +147,7 @@ namespace ts.server {
|
||||
// after all there is no point to invalidate it if we have no idea where to look for the module.
|
||||
return resolution.failedLookupLocations.length === 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getDefaultLibFileName() {
|
||||
var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath()));
|
||||
@@ -224,12 +224,13 @@ namespace ts.server {
|
||||
this.roots.push(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
removeRoot(info: ScriptInfo) {
|
||||
var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName);
|
||||
if (scriptInfo) {
|
||||
this.filenameToScript[info.fileName] = undefined;
|
||||
this.roots = copyListRemovingItem(info, this.roots);
|
||||
this.resolvedModuleNames.remove(info.fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,6 +355,9 @@ namespace ts.server {
|
||||
compilerService: CompilerService;
|
||||
projectFilename: string;
|
||||
projectFileWatcher: FileWatcher;
|
||||
directoryWatcher: FileWatcher;
|
||||
// Used to keep track of what directories are watched for this project
|
||||
directoriesWatchedForTsconfig: string[] = [];
|
||||
program: ts.Program;
|
||||
filenameToSourceFile: ts.Map<ts.SourceFile> = {};
|
||||
updateGraphSeq = 0;
|
||||
@@ -377,6 +381,10 @@ namespace ts.server {
|
||||
return this.projectService.openFile(filename, false);
|
||||
}
|
||||
|
||||
getRootFiles() {
|
||||
return this.compilerService.host.roots.map(info => info.fileName);
|
||||
}
|
||||
|
||||
getFileNames() {
|
||||
let sourceFiles = this.program.getSourceFiles();
|
||||
return sourceFiles.map(sourceFile => sourceFile.fileName);
|
||||
@@ -429,13 +437,11 @@ namespace ts.server {
|
||||
|
||||
// add a root file to project
|
||||
addRoot(info: ScriptInfo) {
|
||||
info.defaultProject = this;
|
||||
this.compilerService.host.addRoot(info);
|
||||
}
|
||||
|
||||
// remove a root file from project
|
||||
removeRoot(info: ScriptInfo) {
|
||||
info.defaultProject = undefined;
|
||||
this.compilerService.host.removeRoot(info);
|
||||
}
|
||||
|
||||
@@ -491,7 +497,13 @@ namespace ts.server {
|
||||
openFilesReferenced: ScriptInfo[] = [];
|
||||
// open files that are roots of a configured project
|
||||
openFileRootsConfigured: ScriptInfo[] = [];
|
||||
// a path to directory watcher map that detects added tsconfig files
|
||||
directoryWatchersForTsconfig: ts.Map<FileWatcher> = {};
|
||||
// count of how many projects are using the directory watcher. If the
|
||||
// number becomes 0 for a watcher, then we should close it.
|
||||
directoryWatchersRefCount: ts.Map<number> = {};
|
||||
hostConfiguration: HostConfiguration;
|
||||
timerForDetectingProjectFilelistChanges: Map<NodeJS.Timer> = {};
|
||||
|
||||
constructor(public host: ServerHost, public psLogger: Logger, public eventHandler?: ProjectServiceEventHandler) {
|
||||
// ts.disableIncrementalParsing = true;
|
||||
@@ -532,8 +544,83 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the callback function when a watched directory has added or removed source code files.
|
||||
* @param project the project that associates with this directory watcher
|
||||
* @param fileName the absolute file name that changed in watched directory
|
||||
*/
|
||||
directoryWatchedForSourceFilesChanged(project: Project, fileName: string) {
|
||||
// If a change was made inside "folder/file", node will trigger the callback twice:
|
||||
// one with the fileName being "folder/file", and the other one with "folder".
|
||||
// We don't respond to the second one.
|
||||
if (fileName && !ts.isSupportedSourceFileName(fileName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.log("Detected source file changes: " + fileName);
|
||||
this.startTimerForDetectingProjectFilelistChanges(project);
|
||||
}
|
||||
|
||||
startTimerForDetectingProjectFilelistChanges(project: Project) {
|
||||
if (this.timerForDetectingProjectFilelistChanges[project.projectFilename]) {
|
||||
clearTimeout(this.timerForDetectingProjectFilelistChanges[project.projectFilename]);
|
||||
}
|
||||
this.timerForDetectingProjectFilelistChanges[project.projectFilename] = setTimeout(
|
||||
() => this.handleProjectFilelistChanges(project),
|
||||
250
|
||||
);
|
||||
}
|
||||
|
||||
handleProjectFilelistChanges(project: Project) {
|
||||
let { succeeded, projectOptions, error } = this.configFileToProjectOptions(project.projectFilename);
|
||||
let newRootFiles = projectOptions.files.map((f => this.getCanonicalFileName(f)));
|
||||
let currentRootFiles = project.getRootFiles().map((f => this.getCanonicalFileName(f)));
|
||||
|
||||
// We check if the project file list has changed. If so, we update the project.
|
||||
if (!arrayIsEqualTo(currentRootFiles && currentRootFiles.sort(), newRootFiles && newRootFiles.sort())) {
|
||||
// For configured projects, the change is made outside the tsconfig file, and
|
||||
// it is not likely to affect the project for other files opened by the client. We can
|
||||
// just update the current project.
|
||||
this.updateConfiguredProject(project);
|
||||
|
||||
// Call updateProjectStructure to clean up inferred projects we may have
|
||||
// created for the new files
|
||||
this.updateProjectStructure();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the callback function when a watched directory has an added tsconfig file.
|
||||
*/
|
||||
directoryWatchedForTsconfigChanged(fileName: string) {
|
||||
if (ts.getBaseFileName(fileName) != "tsconfig.json") {
|
||||
this.log(fileName + " is not tsconfig.json");
|
||||
return;
|
||||
}
|
||||
|
||||
this.log("Detected newly added tsconfig file: " + fileName);
|
||||
|
||||
let { succeeded, projectOptions, error } = this.configFileToProjectOptions(fileName);
|
||||
let rootFilesInTsconfig = projectOptions.files.map(f => this.getCanonicalFileName(f));
|
||||
let openFileRoots = this.openFileRoots.map(s => this.getCanonicalFileName(s.fileName));
|
||||
|
||||
// We should only care about the new tsconfig file if it contains any
|
||||
// opened root files of existing inferred projects
|
||||
for (let openFileRoot of openFileRoots) {
|
||||
if (rootFilesInTsconfig.indexOf(openFileRoot) >= 0) {
|
||||
this.reloadProjects();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getCanonicalFileName(fileName: string) {
|
||||
let name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
|
||||
return ts.normalizePath(name);
|
||||
}
|
||||
|
||||
watchedProjectConfigFileChanged(project: Project) {
|
||||
this.log("Config File Changed: " + project.projectFilename);
|
||||
this.log("Config file changed: " + project.projectFilename);
|
||||
this.updateConfiguredProject(project);
|
||||
this.updateProjectStructure();
|
||||
}
|
||||
@@ -567,11 +654,29 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
createInferredProject(root: ScriptInfo) {
|
||||
var iproj = new Project(this);
|
||||
iproj.addRoot(root);
|
||||
iproj.finishGraph();
|
||||
this.inferredProjects.push(iproj);
|
||||
return iproj;
|
||||
var project = new Project(this);
|
||||
project.addRoot(root);
|
||||
|
||||
let currentPath = ts.getDirectoryPath(root.fileName);
|
||||
let parentPath = ts.getDirectoryPath(currentPath);
|
||||
while (currentPath != parentPath) {
|
||||
if (!project.projectService.directoryWatchersForTsconfig[currentPath]) {
|
||||
this.log("Add watcher for: " + currentPath);
|
||||
project.projectService.directoryWatchersForTsconfig[currentPath] =
|
||||
this.host.watchDirectory(currentPath, fileName => this.directoryWatchedForTsconfigChanged(fileName));
|
||||
project.projectService.directoryWatchersRefCount[currentPath] = 1;
|
||||
}
|
||||
else {
|
||||
project.projectService.directoryWatchersRefCount[currentPath] += 1;
|
||||
}
|
||||
project.directoriesWatchedForTsconfig.push(currentPath);
|
||||
currentPath = parentPath;
|
||||
parentPath = ts.getDirectoryPath(parentPath);
|
||||
}
|
||||
|
||||
project.finishGraph();
|
||||
this.inferredProjects.push(project);
|
||||
return project;
|
||||
}
|
||||
|
||||
fileDeletedInFilesystem(info: ScriptInfo) {
|
||||
@@ -585,6 +690,9 @@ namespace ts.server {
|
||||
if (!info.isOpen) {
|
||||
this.filenameToScriptInfo[info.fileName] = undefined;
|
||||
var referencingProjects = this.findReferencingProjects(info);
|
||||
if (info.defaultProject) {
|
||||
info.defaultProject.removeRoot(info);
|
||||
}
|
||||
for (var i = 0, len = referencingProjects.length; i < len; i++) {
|
||||
referencingProjects[i].removeReferencedFile(info);
|
||||
}
|
||||
@@ -615,9 +723,24 @@ namespace ts.server {
|
||||
this.configuredProjects = configuredProjects;
|
||||
}
|
||||
|
||||
removeConfiguredProject(project: Project) {
|
||||
project.projectFileWatcher.close();
|
||||
this.configuredProjects = copyListRemovingItem(project, this.configuredProjects);
|
||||
removeProject(project: Project) {
|
||||
this.log("remove project: " + project.getRootFiles().toString());
|
||||
if (project.isConfiguredProject()) {
|
||||
project.projectFileWatcher.close();
|
||||
project.directoryWatcher.close();
|
||||
this.configuredProjects = copyListRemovingItem(project, this.configuredProjects);
|
||||
}
|
||||
else {
|
||||
for (let directory of project.directoriesWatchedForTsconfig) {
|
||||
// if the ref count for this directory watcher drops to 0, it's time to close it
|
||||
if (!(--project.projectService.directoryWatchersRefCount[directory])) {
|
||||
this.log("Close directory watcher for: " + directory);
|
||||
project.projectService.directoryWatchersForTsconfig[directory].close();
|
||||
delete project.projectService.directoryWatchersForTsconfig[directory];
|
||||
}
|
||||
}
|
||||
this.inferredProjects = copyListRemovingItem(project, this.inferredProjects);
|
||||
}
|
||||
|
||||
let fileNames = project.getFileNames();
|
||||
for (let fileName of fileNames) {
|
||||
@@ -659,8 +782,7 @@ namespace ts.server {
|
||||
// if r referenced by the new project
|
||||
if (info.defaultProject.getSourceFile(r)) {
|
||||
// remove project rooted at r
|
||||
this.inferredProjects =
|
||||
copyListRemovingItem(r.defaultProject, this.inferredProjects);
|
||||
this.removeProject(r.defaultProject);
|
||||
// put r in referenced open file list
|
||||
this.openFilesReferenced.push(r);
|
||||
// set default project of r to the new project
|
||||
@@ -683,6 +805,11 @@ namespace ts.server {
|
||||
* @param info The file that has been closed or newly configured
|
||||
*/
|
||||
closeOpenFile(info: ScriptInfo) {
|
||||
// Closing file should trigger re-reading the file content from disk. This is
|
||||
// because the user may chose to discard the buffer content before saving
|
||||
// to the disk, and the server's version of the file can be out of sync.
|
||||
info.svc.reloadFromFile(info.fileName);
|
||||
|
||||
var openFileRoots: ScriptInfo[] = [];
|
||||
var removedProject: Project;
|
||||
for (var i = 0, len = this.openFileRoots.length; i < len; i++) {
|
||||
@@ -713,19 +840,14 @@ namespace ts.server {
|
||||
this.openFileRootsConfigured = openFileRootsConfigured;
|
||||
}
|
||||
if (removedProject) {
|
||||
if (removedProject.isConfiguredProject()) {
|
||||
this.configuredProjects = copyListRemovingItem(removedProject, this.configuredProjects);
|
||||
}
|
||||
else {
|
||||
this.inferredProjects = copyListRemovingItem(removedProject, this.inferredProjects);
|
||||
}
|
||||
this.removeProject(removedProject);
|
||||
var openFilesReferenced: ScriptInfo[] = [];
|
||||
var orphanFiles: ScriptInfo[] = [];
|
||||
// for all open, referenced files f
|
||||
for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) {
|
||||
var f = this.openFilesReferenced[i];
|
||||
// if f was referenced by the removed project, remember it
|
||||
if (f.defaultProject === removedProject) {
|
||||
if (f.defaultProject === removedProject || !f.defaultProject) {
|
||||
f.defaultProject = undefined;
|
||||
orphanFiles.push(f);
|
||||
}
|
||||
@@ -769,7 +891,11 @@ namespace ts.server {
|
||||
return referencingProjects;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function rebuilds the project for every file opened by the client
|
||||
*/
|
||||
reloadProjects() {
|
||||
this.log("reload projects.");
|
||||
// First check if there is new tsconfig file added for inferred project roots
|
||||
for (let info of this.openFileRoots) {
|
||||
this.openOrUpdateConfiguredProjectForFile(info.fileName);
|
||||
@@ -830,14 +956,25 @@ namespace ts.server {
|
||||
var rootFile = this.openFileRoots[i];
|
||||
var rootedProject = rootFile.defaultProject;
|
||||
var referencingProjects = this.findReferencingProjects(rootFile, rootedProject);
|
||||
if (referencingProjects.length === 0) {
|
||||
rootFile.defaultProject = rootedProject;
|
||||
openFileRoots.push(rootFile);
|
||||
|
||||
if (rootFile.defaultProject && rootFile.defaultProject.isConfiguredProject()) {
|
||||
// If the root file has already been added into a configured project,
|
||||
// meaning the original inferred project is gone already.
|
||||
if (!rootedProject.isConfiguredProject()) {
|
||||
this.removeProject(rootedProject);
|
||||
}
|
||||
this.openFileRootsConfigured.push(rootFile);
|
||||
}
|
||||
else {
|
||||
// remove project from inferred projects list because root captured
|
||||
this.inferredProjects = copyListRemovingItem(rootedProject, this.inferredProjects);
|
||||
this.openFilesReferenced.push(rootFile);
|
||||
if (referencingProjects.length === 0) {
|
||||
rootFile.defaultProject = rootedProject;
|
||||
openFileRoots.push(rootFile);
|
||||
}
|
||||
else {
|
||||
// remove project from inferred projects list because root captured
|
||||
this.removeProject(rootedProject);
|
||||
this.openFilesReferenced.push(rootFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.openFileRoots = openFileRoots;
|
||||
@@ -922,6 +1059,11 @@ namespace ts.server {
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function tries to search for a tsconfig.json for the given file. If we found it,
|
||||
* we first detect if there is already a configured project created for it: if so, we re-read
|
||||
* the tsconfig file content and update the project; otherwise we create a new one.
|
||||
*/
|
||||
openOrUpdateConfiguredProjectForFile(fileName: string) {
|
||||
let searchPath = ts.normalizePath(getDirectoryPath(fileName));
|
||||
this.log("Search path: " + searchPath, "Info");
|
||||
@@ -1041,17 +1183,17 @@ namespace ts.server {
|
||||
// file references will be relative to dirPath (or absolute)
|
||||
var dirPath = ts.getDirectoryPath(configFilename);
|
||||
var contents = this.host.readFile(configFilename)
|
||||
var rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.parseConfigFileText(configFilename, contents);
|
||||
var rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.parseConfigFileTextToJson(configFilename, contents);
|
||||
if (rawConfig.error) {
|
||||
return { succeeded: false, error: rawConfig.error };
|
||||
}
|
||||
else {
|
||||
var parsedCommandLine = ts.parseConfigFile(rawConfig.config, this.host, dirPath);
|
||||
var parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath);
|
||||
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
|
||||
return { succeeded: false, error: { errorMsg: "tsconfig option errors" } };
|
||||
}
|
||||
else if (parsedCommandLine.fileNames == null) {
|
||||
return { succeeded: false, error: { errorMsg: "no files found" } }
|
||||
return { succeeded: false, error: { errorMsg: "no files found" } };
|
||||
}
|
||||
else {
|
||||
var projectOptions: ProjectOptions = {
|
||||
@@ -1070,27 +1212,32 @@ namespace ts.server {
|
||||
return error;
|
||||
}
|
||||
else {
|
||||
let proj = this.createProject(configFilename, projectOptions);
|
||||
for (let i = 0, len = projectOptions.files.length; i < len; i++) {
|
||||
let rootFilename = projectOptions.files[i];
|
||||
let project = this.createProject(configFilename, projectOptions);
|
||||
for (let rootFilename of projectOptions.files) {
|
||||
if (this.host.fileExists(rootFilename)) {
|
||||
let info = this.openFile(rootFilename, /*openedByClient*/ clientFileName == rootFilename);
|
||||
proj.addRoot(info);
|
||||
project.addRoot(info);
|
||||
}
|
||||
else {
|
||||
return { errorMsg: "specified file " + rootFilename + " not found" };
|
||||
}
|
||||
}
|
||||
proj.finishGraph();
|
||||
proj.projectFileWatcher = this.host.watchFile(configFilename, _ => this.watchedProjectConfigFileChanged(proj));
|
||||
return { success: true, project: proj };
|
||||
project.finishGraph();
|
||||
project.projectFileWatcher = this.host.watchFile(configFilename, _ => this.watchedProjectConfigFileChanged(project));
|
||||
this.log("Add recursive watcher for: " + ts.getDirectoryPath(configFilename));
|
||||
project.directoryWatcher = this.host.watchDirectory(
|
||||
ts.getDirectoryPath(configFilename),
|
||||
path => this.directoryWatchedForSourceFilesChanged(project, path),
|
||||
/*recursive*/ true
|
||||
);
|
||||
return { success: true, project: project };
|
||||
}
|
||||
}
|
||||
|
||||
updateConfiguredProject(project: Project) {
|
||||
if (!this.host.fileExists(project.projectFilename)) {
|
||||
this.log("Config file deleted");
|
||||
this.removeConfiguredProject(project);
|
||||
this.removeProject(project);
|
||||
}
|
||||
else {
|
||||
let { succeeded, projectOptions, error } = this.configFileToProjectOptions(project.projectFilename);
|
||||
@@ -1105,7 +1252,9 @@ namespace ts.server {
|
||||
|
||||
for (let fileName of fileNamesToRemove) {
|
||||
let info = this.getScriptInfo(fileName);
|
||||
project.removeRoot(info);
|
||||
if (info) {
|
||||
project.removeRoot(info);
|
||||
}
|
||||
}
|
||||
|
||||
for (let fileName of fileNamesToAdd) {
|
||||
@@ -1119,11 +1268,15 @@ namespace ts.server {
|
||||
if (info.isOpen) {
|
||||
if (this.openFileRoots.indexOf(info) >= 0) {
|
||||
this.openFileRoots = copyListRemovingItem(info, this.openFileRoots);
|
||||
if (info.defaultProject && !info.defaultProject.isConfiguredProject()) {
|
||||
this.removeProject(info.defaultProject);
|
||||
}
|
||||
}
|
||||
if (this.openFilesReferenced.indexOf(info) >= 0) {
|
||||
this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced);
|
||||
}
|
||||
this.openFileRootsConfigured.push(info);
|
||||
info.defaultProject = project;
|
||||
}
|
||||
}
|
||||
project.addRoot(info);
|
||||
@@ -1177,6 +1330,7 @@ namespace ts.server {
|
||||
TabSize: 4,
|
||||
NewLineCharacter: ts.sys ? ts.sys.newLine : '\n',
|
||||
ConvertTabsToSpaces: true,
|
||||
IndentStyle: ts.IndentStyle.Smart,
|
||||
InsertSpaceAfterCommaDelimiter: true,
|
||||
InsertSpaceAfterSemicolonInForStatements: true,
|
||||
InsertSpaceBeforeAndAfterBinaryOperators: true,
|
||||
@@ -1187,7 +1341,6 @@ namespace ts.server {
|
||||
PlaceOpenBraceOnNewLineForFunctions: false,
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: false,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface LineCollection {
|
||||
@@ -1217,9 +1370,9 @@ namespace ts.server {
|
||||
goSubtree: boolean;
|
||||
done: boolean;
|
||||
leaf(relativeStart: number, relativeLength: number, lineCollection: LineLeaf): void;
|
||||
pre? (relativeStart: number, relativeLength: number, lineCollection: LineCollection,
|
||||
pre?(relativeStart: number, relativeLength: number, lineCollection: LineCollection,
|
||||
parent: LineNode, nodeType: CharRangeSection): LineCollection;
|
||||
post? (relativeStart: number, relativeLength: number, lineCollection: LineCollection,
|
||||
post?(relativeStart: number, relativeLength: number, lineCollection: LineCollection,
|
||||
parent: LineNode, nodeType: CharRangeSection): LineCollection;
|
||||
}
|
||||
|
||||
|
||||
+34
-112
@@ -83,113 +83,24 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
interface WatchedFile {
|
||||
fileName: string;
|
||||
callback: (fileName: string, removed: boolean) => void;
|
||||
mtime: Date;
|
||||
}
|
||||
|
||||
class WatchedFileSet {
|
||||
private watchedFiles: WatchedFile[] = [];
|
||||
private nextFileToCheck = 0;
|
||||
private watchTimer: NodeJS.Timer;
|
||||
|
||||
// average async stat takes about 30 microseconds
|
||||
// set chunk size to do 30 files in < 1 millisecond
|
||||
constructor(public interval = 2500, public chunkSize = 30) {
|
||||
}
|
||||
|
||||
private static copyListRemovingItem<T>(item: T, list: T[]) {
|
||||
var copiedList: T[] = [];
|
||||
for (var i = 0, len = list.length; i < len; i++) {
|
||||
if (list[i] != item) {
|
||||
copiedList.push(list[i]);
|
||||
}
|
||||
}
|
||||
return copiedList;
|
||||
}
|
||||
|
||||
private static getModifiedTime(fileName: string): Date {
|
||||
return fs.statSync(fileName).mtime;
|
||||
}
|
||||
|
||||
private poll(checkedIndex: number) {
|
||||
var watchedFile = this.watchedFiles[checkedIndex];
|
||||
if (!watchedFile) {
|
||||
return;
|
||||
}
|
||||
|
||||
fs.stat(watchedFile.fileName,(err, stats) => {
|
||||
if (err) {
|
||||
watchedFile.callback(watchedFile.fileName, /* removed */ false);
|
||||
}
|
||||
else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) {
|
||||
watchedFile.mtime = WatchedFileSet.getModifiedTime(watchedFile.fileName);
|
||||
watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// this implementation uses polling and
|
||||
// stat due to inconsistencies of fs.watch
|
||||
// and efficiency of stat on modern filesystems
|
||||
private startWatchTimer() {
|
||||
this.watchTimer = setInterval(() => {
|
||||
var count = 0;
|
||||
var nextToCheck = this.nextFileToCheck;
|
||||
var firstCheck = -1;
|
||||
while ((count < this.chunkSize) && (nextToCheck !== firstCheck)) {
|
||||
this.poll(nextToCheck);
|
||||
if (firstCheck < 0) {
|
||||
firstCheck = nextToCheck;
|
||||
}
|
||||
nextToCheck++;
|
||||
if (nextToCheck === this.watchedFiles.length) {
|
||||
nextToCheck = 0;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
this.nextFileToCheck = nextToCheck;
|
||||
}, this.interval);
|
||||
}
|
||||
|
||||
addFile(fileName: string, callback: (fileName: string, removed: boolean) => void ): WatchedFile {
|
||||
var file: WatchedFile = {
|
||||
fileName,
|
||||
callback,
|
||||
mtime: WatchedFileSet.getModifiedTime(fileName)
|
||||
};
|
||||
|
||||
this.watchedFiles.push(file);
|
||||
if (this.watchedFiles.length === 1) {
|
||||
this.startWatchTimer();
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
removeFile(file: WatchedFile) {
|
||||
this.watchedFiles = WatchedFileSet.copyListRemovingItem(file, this.watchedFiles);
|
||||
}
|
||||
}
|
||||
|
||||
class IOSession extends Session {
|
||||
constructor(host: ServerHost, logger: ts.server.Logger) {
|
||||
super(host, Buffer.byteLength, process.hrtime, logger);
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.projectService.log("Exiting...","Info");
|
||||
this.projectService.log("Exiting...", "Info");
|
||||
this.projectService.closeLog();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
listen() {
|
||||
rl.on('line',(input: string) => {
|
||||
rl.on('line', (input: string) => {
|
||||
var message = input.trim();
|
||||
this.onMessage(message);
|
||||
});
|
||||
|
||||
rl.on('close',() => {
|
||||
rl.on('close', () => {
|
||||
this.exit();
|
||||
});
|
||||
}
|
||||
@@ -244,31 +155,42 @@ namespace ts.server {
|
||||
|
||||
var logger = createLoggerFromEnv();
|
||||
|
||||
// REVIEW: for now this implementation uses polling.
|
||||
// The advantage of polling is that it works reliably
|
||||
// on all os and with network mounted files.
|
||||
// For 90 referenced files, the average time to detect
|
||||
// changes is 2*msInterval (by default 5 seconds).
|
||||
// The overhead of this is .04 percent (1/2500) with
|
||||
// average pause of < 1 millisecond (and max
|
||||
// pause less than 1.5 milliseconds); question is
|
||||
// do we anticipate reference sets in the 100s and
|
||||
// do we care about waiting 10-20 seconds to detect
|
||||
// changes for large reference sets? If so, do we want
|
||||
// to increase the chunk size or decrease the interval
|
||||
// time dynamically to match the large reference set?
|
||||
var watchedFileSet = new WatchedFileSet();
|
||||
ts.sys.watchFile = function (fileName, callback) {
|
||||
var watchedFile = watchedFileSet.addFile(fileName, callback);
|
||||
return {
|
||||
close: () => watchedFileSet.removeFile(watchedFile)
|
||||
let pending: string[] = [];
|
||||
function queueMessage(s: string) {
|
||||
pending.push(s);
|
||||
if (pending.length === 1) {
|
||||
drain();
|
||||
}
|
||||
}
|
||||
|
||||
function drain() {
|
||||
Debug.assert(pending.length > 0);
|
||||
writeBuffer(new Buffer(pending[0], "utf8"), 0);
|
||||
}
|
||||
|
||||
function writeBuffer(buffer: Buffer, offset: number) {
|
||||
const toWrite = buffer.length - offset;
|
||||
fs.write(1, buffer, offset, toWrite, undefined, (err, written, buffer) => {
|
||||
if (toWrite > written) {
|
||||
writeBuffer(buffer, offset + written);
|
||||
}
|
||||
else {
|
||||
Debug.assert(pending.length > 0);
|
||||
pending.shift();
|
||||
if (pending.length > 0) {
|
||||
drain();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Override sys.write because fs.writeSync is not reliable on Node 4
|
||||
ts.sys.write = (s: string) => queueMessage(s);
|
||||
|
||||
};
|
||||
var ioSession = new IOSession(ts.sys, logger);
|
||||
process.on('uncaughtException', function(err: Error) {
|
||||
ioSession.logError(err, "unknown");
|
||||
});
|
||||
// Start listening
|
||||
ioSession.listen();
|
||||
}
|
||||
}
|
||||
+26
-11
@@ -21,6 +21,21 @@ namespace ts.server {
|
||||
return spaceCache[n];
|
||||
}
|
||||
|
||||
export function generateIndentString(n: number, editorOptions: EditorOptions): string {
|
||||
if (editorOptions.ConvertTabsToSpaces) {
|
||||
return generateSpaces(n);
|
||||
} else {
|
||||
var result = "";
|
||||
for (var i = 0; i < Math.floor(n / editorOptions.TabSize); i++) {
|
||||
result += "\t";
|
||||
}
|
||||
for (var i = 0; i < n % editorOptions.TabSize; i++) {
|
||||
result += " ";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
interface FileStart {
|
||||
file: string;
|
||||
start: ILineInfo;
|
||||
@@ -606,28 +621,27 @@ namespace ts.server {
|
||||
TabSize: formatOptions.TabSize,
|
||||
NewLineCharacter: "\n",
|
||||
ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces,
|
||||
IndentStyle: ts.IndentStyle.Smart,
|
||||
};
|
||||
var indentPosition =
|
||||
compilerService.languageService.getIndentationAtPosition(file, position, editorOptions);
|
||||
var preferredIndent = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions);
|
||||
var hasIndent = 0;
|
||||
for (var i = 0, len = lineText.length; i < len; i++) {
|
||||
if (lineText.charAt(i) == " ") {
|
||||
indentPosition--;
|
||||
hasIndent++;
|
||||
}
|
||||
else if (lineText.charAt(i) == "\t") {
|
||||
indentPosition -= editorOptions.IndentSize;
|
||||
hasIndent += editorOptions.TabSize;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (indentPosition > 0) {
|
||||
var spaces = generateSpaces(indentPosition);
|
||||
edits.push({ span: ts.createTextSpanFromBounds(position, position), newText: spaces });
|
||||
}
|
||||
else if (indentPosition < 0) {
|
||||
// i points to the first non whitespace character
|
||||
if (preferredIndent !== hasIndent) {
|
||||
var firstNoWhiteSpacePosition = lineInfo.offset + i;
|
||||
edits.push({
|
||||
span: ts.createTextSpanFromBounds(position, position - indentPosition),
|
||||
newText: ""
|
||||
span: ts.createTextSpanFromBounds(lineInfo.offset, firstNoWhiteSpacePosition),
|
||||
newText: generateIndentString(preferredIndent, editorOptions)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -779,6 +793,7 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
private closeClientFile(fileName: string) {
|
||||
if (!fileName) { return; }
|
||||
var file = ts.normalizePath(fileName);
|
||||
this.projectService.closeClientFile(file);
|
||||
}
|
||||
|
||||
@@ -695,8 +695,8 @@ namespace ts.formatting {
|
||||
let tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos);
|
||||
if (isTokenInRange) {
|
||||
let rangeHasError = rangeContainsError(currentTokenInfo.token);
|
||||
// save prevStartLine since processRange will overwrite this value with current ones
|
||||
let prevStartLine = previousRangeStartLine;
|
||||
// save previousRange since processRange will overwrite this value with current one
|
||||
let savePreviousRange = previousRange;
|
||||
lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation);
|
||||
if (rangeHasError) {
|
||||
// do not indent comments\token if token range overlaps with some error
|
||||
@@ -707,7 +707,9 @@ namespace ts.formatting {
|
||||
indentToken = lineAdded;
|
||||
}
|
||||
else {
|
||||
indentToken = lastTriviaWasNewLine && tokenStart.line !== prevStartLine;
|
||||
// indent token only if end line of previous range does not match start line of the token
|
||||
const prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line;
|
||||
indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ namespace ts.formatting {
|
||||
public SpaceBetweenYieldOrYieldStarAndOperand: Rule;
|
||||
|
||||
// Async functions
|
||||
public SpaceBetweenAsyncAndOpenParen: Rule;
|
||||
public SpaceBetweenAsyncAndFunctionKeyword: Rule;
|
||||
|
||||
// Template strings
|
||||
@@ -369,6 +370,7 @@ namespace ts.formatting {
|
||||
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));
|
||||
|
||||
// Async-await
|
||||
this.SpaceBetweenAsyncAndOpenParen = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsArrowFunctionContext, Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
this.SpaceBetweenAsyncAndFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.AsyncKeyword, SyntaxKind.FunctionKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||
|
||||
// template string
|
||||
@@ -402,7 +404,7 @@ namespace ts.formatting {
|
||||
this.NoSpaceBeforeOpenParenInFuncCall,
|
||||
this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator,
|
||||
this.SpaceAfterVoidOperator,
|
||||
this.SpaceBetweenAsyncAndFunctionKeyword,
|
||||
this.SpaceBetweenAsyncAndOpenParen, this.SpaceBetweenAsyncAndFunctionKeyword,
|
||||
this.SpaceBetweenTagAndTemplateString, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail,
|
||||
|
||||
// TypeScript-specific rules
|
||||
@@ -703,6 +705,10 @@ namespace ts.formatting {
|
||||
return context.currentTokenSpan.kind !== SyntaxKind.CommaToken;
|
||||
}
|
||||
|
||||
static IsArrowFunctionContext(context: FormattingContext): boolean {
|
||||
return context.contextNode.kind === SyntaxKind.ArrowFunction;
|
||||
}
|
||||
|
||||
static IsSameLineTokenContext(context: FormattingContext): boolean {
|
||||
return context.TokensAreOnSameLine();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@ namespace ts.formatting {
|
||||
return 0; // past EOF
|
||||
}
|
||||
|
||||
// no indentation when the indent style is set to none,
|
||||
// so we can return fast
|
||||
if (options.IndentStyle === IndentStyle.None) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let precedingToken = findPrecedingToken(position, sourceFile);
|
||||
if (!precedingToken) {
|
||||
return 0;
|
||||
@@ -26,6 +32,26 @@ namespace ts.formatting {
|
||||
|
||||
let lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
|
||||
|
||||
// indentation is first non-whitespace character in a previous line
|
||||
// for block indentation, we should look for a line which contains something that's not
|
||||
// whitespace.
|
||||
if (options.IndentStyle === IndentStyle.Block) {
|
||||
|
||||
// move backwards until we find a line with a non-whitespace character,
|
||||
// then find the first non-whitespace character for that line.
|
||||
let current = position;
|
||||
while (current > 0){
|
||||
let char = sourceFile.text.charCodeAt(current);
|
||||
if (!isWhiteSpace(char) && !isLineBreak(char)) {
|
||||
break;
|
||||
}
|
||||
current--;
|
||||
}
|
||||
|
||||
let lineStart = ts.getLineStartPositionForPosition(current, sourceFile);
|
||||
return SmartIndenter.findFirstNonWhitespaceColumn(lineStart, current, sourceFile, options);
|
||||
}
|
||||
|
||||
if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) {
|
||||
// previous token is comma that separates items in list - find the previous item and try to derive indentation from it
|
||||
let actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);
|
||||
@@ -218,7 +244,7 @@ namespace ts.formatting {
|
||||
function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter {
|
||||
return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile));
|
||||
}
|
||||
|
||||
|
||||
export function childStartsOnTheSameLineWithElseInIfStatement(parent: Node, child: TextRangeWithKind, childStartLine: number, sourceFile: SourceFile): boolean {
|
||||
if (parent.kind === SyntaxKind.IfStatement && (<IfStatement>parent).elseStatement === child) {
|
||||
let elseKeyword = findChildOfKind(parent, SyntaxKind.ElseKeyword, sourceFile);
|
||||
@@ -319,7 +345,7 @@ namespace ts.formatting {
|
||||
}
|
||||
|
||||
return Value.Unknown;
|
||||
|
||||
|
||||
function getStartingExpression(node: PropertyAccessExpression | CallExpression | ElementAccessExpression) {
|
||||
while (true) {
|
||||
switch (node.kind) {
|
||||
@@ -465,4 +491,4 @@ namespace ts.formatting {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+53
-16
@@ -174,9 +174,7 @@ namespace ts {
|
||||
let jsDocCompletionEntries: CompletionEntry[];
|
||||
|
||||
function createNode(kind: SyntaxKind, pos: number, end: number, flags: NodeFlags, parent?: Node): NodeObject {
|
||||
let node = <NodeObject> new (getNodeConstructor(kind))();
|
||||
node.pos = pos;
|
||||
node.end = end;
|
||||
let node = <NodeObject> new (getNodeConstructor(kind))(pos, end);
|
||||
node.flags = flags;
|
||||
node.parent = parent;
|
||||
return node;
|
||||
@@ -1189,6 +1187,13 @@ namespace ts {
|
||||
TabSize: number;
|
||||
NewLineCharacter: string;
|
||||
ConvertTabsToSpaces: boolean;
|
||||
IndentStyle: IndentStyle;
|
||||
}
|
||||
|
||||
export enum IndentStyle {
|
||||
None = 0,
|
||||
Block = 1,
|
||||
Smart = 2,
|
||||
}
|
||||
|
||||
export interface FormatCodeOptions extends EditorOptions {
|
||||
@@ -1850,8 +1855,8 @@ namespace ts {
|
||||
// so pass --noResolve to avoid reporting missing file errors.
|
||||
options.noResolve = true;
|
||||
|
||||
// Parse
|
||||
let inputFileName = transpileOptions.fileName || "module.ts";
|
||||
// if jsx is specified then treat file as .tsx
|
||||
let inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts");
|
||||
let sourceFile = createSourceFile(inputFileName, input, options.target);
|
||||
if (transpileOptions.moduleName) {
|
||||
sourceFile.moduleName = transpileOptions.moduleName;
|
||||
@@ -3105,6 +3110,7 @@ namespace ts {
|
||||
let node = currentToken;
|
||||
let isRightOfDot = false;
|
||||
let isRightOfOpenTag = false;
|
||||
let isStartingCloseTag = false;
|
||||
|
||||
let location = getTouchingPropertyName(sourceFile, position);
|
||||
if (contextToken) {
|
||||
@@ -3130,9 +3136,14 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (kind === SyntaxKind.LessThanToken && sourceFile.languageVariant === LanguageVariant.JSX) {
|
||||
isRightOfOpenTag = true;
|
||||
location = contextToken;
|
||||
else if (sourceFile.languageVariant === LanguageVariant.JSX) {
|
||||
if (kind === SyntaxKind.LessThanToken) {
|
||||
isRightOfOpenTag = true;
|
||||
location = contextToken;
|
||||
}
|
||||
else if (kind === SyntaxKind.SlashToken && contextToken.parent.kind === SyntaxKind.JsxClosingElement) {
|
||||
isStartingCloseTag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3155,6 +3166,13 @@ namespace ts {
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
}
|
||||
else if (isStartingCloseTag) {
|
||||
let tagName = (<JsxElement>contextToken.parent.parent).openingElement.tagName;
|
||||
symbols = [typeChecker.getSymbolAtLocation(tagName)];
|
||||
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
}
|
||||
else {
|
||||
// For JavaScript or TypeScript, if we're not after a dot, then just try to get the
|
||||
// global symbols in scope. These results should be valid for either language as
|
||||
@@ -3311,11 +3329,29 @@ namespace ts {
|
||||
let start = new Date().getTime();
|
||||
let result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
|
||||
isSolelyIdentifierDefinitionLocation(contextToken) ||
|
||||
isDotOfNumericLiteral(contextToken);
|
||||
isDotOfNumericLiteral(contextToken) ||
|
||||
isInJsxText(contextToken);
|
||||
log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start));
|
||||
return result;
|
||||
}
|
||||
|
||||
function isInJsxText(contextToken: Node): boolean {
|
||||
if (contextToken.kind === SyntaxKind.JsxText) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (contextToken.kind === SyntaxKind.GreaterThanToken && contextToken.parent) {
|
||||
if (contextToken.parent.kind === SyntaxKind.JsxOpeningElement) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (contextToken.parent.kind === SyntaxKind.JsxClosingElement || contextToken.parent.kind === SyntaxKind.JsxSelfClosingElement) {
|
||||
return contextToken.parent.parent && contextToken.parent.parent.kind === SyntaxKind.JsxElement;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isNewIdentifierDefinitionLocation(previousToken: Node): boolean {
|
||||
if (previousToken) {
|
||||
let containingNodeKind = previousToken.parent.kind;
|
||||
@@ -4105,8 +4141,9 @@ namespace ts {
|
||||
let useConstructSignatures = callExpression.kind === SyntaxKind.NewExpression || callExpression.expression.kind === SyntaxKind.SuperKeyword;
|
||||
let allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
|
||||
|
||||
if (!contains(allSignatures, signature.target || signature)) {
|
||||
// Get the first signature if there
|
||||
if (!contains(allSignatures, signature.target) && !contains(allSignatures, signature)) {
|
||||
// Get the first signature if there is one -- allSignatures may contain
|
||||
// either the original signature or its target, so check for either
|
||||
signature = allSignatures.length ? allSignatures[0] : undefined;
|
||||
}
|
||||
|
||||
@@ -7928,14 +7965,14 @@ namespace ts {
|
||||
function initializeServices() {
|
||||
objectAllocator = {
|
||||
getNodeConstructor: kind => {
|
||||
function Node() {
|
||||
function Node(pos: number, end: number) {
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = NodeFlags.None;
|
||||
this.parent = undefined;
|
||||
}
|
||||
let proto = kind === SyntaxKind.SourceFile ? new SourceFileObject() : new NodeObject();
|
||||
proto.kind = kind;
|
||||
proto.pos = -1;
|
||||
proto.end = -1;
|
||||
proto.flags = 0;
|
||||
proto.parent = undefined;
|
||||
Node.prototype = proto;
|
||||
return <any>Node;
|
||||
},
|
||||
|
||||
@@ -990,7 +990,7 @@ namespace ts {
|
||||
() => {
|
||||
let text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength());
|
||||
|
||||
let result = parseConfigFileText(fileName, text);
|
||||
let result = parseConfigFileTextToJson(fileName, text);
|
||||
|
||||
if (result.error) {
|
||||
return {
|
||||
@@ -1000,7 +1000,7 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
var configFile = parseConfigFile(result.config, this.host, getDirectoryPath(normalizeSlashes(fileName)));
|
||||
var configFile = parseJsonConfigFileContent(result.config, this.host, getDirectoryPath(normalizeSlashes(fileName)));
|
||||
|
||||
return {
|
||||
options: configFile.options,
|
||||
|
||||
@@ -75,26 +75,26 @@ function delint(sourceFile) {
|
||||
delintNode(sourceFile);
|
||||
function delintNode(node) {
|
||||
switch (node.kind) {
|
||||
case 197 /* ForStatement */:
|
||||
case 198 /* ForInStatement */:
|
||||
case 196 /* WhileStatement */:
|
||||
case 195 /* DoStatement */:
|
||||
if (node.statement.kind !== 190 /* Block */) {
|
||||
case 199 /* ForStatement */:
|
||||
case 200 /* ForInStatement */:
|
||||
case 198 /* WhileStatement */:
|
||||
case 197 /* DoStatement */:
|
||||
if (node.statement.kind !== 192 /* Block */) {
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 194 /* IfStatement */:
|
||||
case 196 /* IfStatement */:
|
||||
var ifStatement = node;
|
||||
if (ifStatement.thenStatement.kind !== 190 /* Block */) {
|
||||
if (ifStatement.thenStatement.kind !== 192 /* Block */) {
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
ifStatement.elseStatement.kind !== 190 /* Block */ &&
|
||||
ifStatement.elseStatement.kind !== 194 /* IfStatement */) {
|
||||
ifStatement.elseStatement.kind !== 192 /* Block */ &&
|
||||
ifStatement.elseStatement.kind !== 196 /* IfStatement */) {
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 179 /* BinaryExpression */:
|
||||
case 181 /* BinaryExpression */:
|
||||
var op = node.operatorToken.kind;
|
||||
if (op === 30 /* EqualsEqualsToken */ || op == 31 /* ExclamationEqualsToken */) {
|
||||
report(node, "Use '===' and '!=='.");
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [ambientClassMergesOverloadsWithInterface.ts]
|
||||
declare class C {
|
||||
baz(): any;
|
||||
foo(n: number): any;
|
||||
}
|
||||
interface C {
|
||||
foo(n: number): any;
|
||||
bar(): any;
|
||||
}
|
||||
|
||||
|
||||
//// [ambientClassMergesOverloadsWithInterface.js]
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/ambientClassMergesOverloadsWithInterface.ts ===
|
||||
declare class C {
|
||||
>C : Symbol(C, Decl(ambientClassMergesOverloadsWithInterface.ts, 0, 0), Decl(ambientClassMergesOverloadsWithInterface.ts, 3, 1))
|
||||
|
||||
baz(): any;
|
||||
>baz : Symbol(baz, Decl(ambientClassMergesOverloadsWithInterface.ts, 0, 17))
|
||||
|
||||
foo(n: number): any;
|
||||
>foo : Symbol(foo, Decl(ambientClassMergesOverloadsWithInterface.ts, 1, 15), Decl(ambientClassMergesOverloadsWithInterface.ts, 4, 13))
|
||||
>n : Symbol(n, Decl(ambientClassMergesOverloadsWithInterface.ts, 2, 8))
|
||||
}
|
||||
interface C {
|
||||
>C : Symbol(C, Decl(ambientClassMergesOverloadsWithInterface.ts, 0, 0), Decl(ambientClassMergesOverloadsWithInterface.ts, 3, 1))
|
||||
|
||||
foo(n: number): any;
|
||||
>foo : Symbol(foo, Decl(ambientClassMergesOverloadsWithInterface.ts, 1, 15), Decl(ambientClassMergesOverloadsWithInterface.ts, 4, 13))
|
||||
>n : Symbol(n, Decl(ambientClassMergesOverloadsWithInterface.ts, 5, 8))
|
||||
|
||||
bar(): any;
|
||||
>bar : Symbol(bar, Decl(ambientClassMergesOverloadsWithInterface.ts, 5, 24))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
=== tests/cases/compiler/ambientClassMergesOverloadsWithInterface.ts ===
|
||||
declare class C {
|
||||
>C : C
|
||||
|
||||
baz(): any;
|
||||
>baz : () => any
|
||||
|
||||
foo(n: number): any;
|
||||
>foo : { (n: number): any; (n: number): any; }
|
||||
>n : number
|
||||
}
|
||||
interface C {
|
||||
>C : C
|
||||
|
||||
foo(n: number): any;
|
||||
>foo : { (n: number): any; (n: number): any; }
|
||||
>n : number
|
||||
|
||||
bar(): any;
|
||||
>bar : () => any
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [arrayBufferIsViewNarrowsType.ts]
|
||||
var obj: Object;
|
||||
if (ArrayBuffer.isView(obj)) {
|
||||
// isView should be a guard that narrows type to ArrayBufferView.
|
||||
var ab: ArrayBufferView = obj;
|
||||
}
|
||||
|
||||
//// [arrayBufferIsViewNarrowsType.js]
|
||||
var obj;
|
||||
if (ArrayBuffer.isView(obj)) {
|
||||
// isView should be a guard that narrows type to ArrayBufferView.
|
||||
var ab = obj;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
=== tests/cases/compiler/arrayBufferIsViewNarrowsType.ts ===
|
||||
var obj: Object;
|
||||
>obj : Symbol(obj, Decl(arrayBufferIsViewNarrowsType.ts, 0, 3))
|
||||
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
|
||||
if (ArrayBuffer.isView(obj)) {
|
||||
>ArrayBuffer.isView : Symbol(ArrayBufferConstructor.isView, Decl(lib.d.ts, --, --))
|
||||
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>isView : Symbol(ArrayBufferConstructor.isView, Decl(lib.d.ts, --, --))
|
||||
>obj : Symbol(obj, Decl(arrayBufferIsViewNarrowsType.ts, 0, 3))
|
||||
|
||||
// isView should be a guard that narrows type to ArrayBufferView.
|
||||
var ab: ArrayBufferView = obj;
|
||||
>ab : Symbol(ab, Decl(arrayBufferIsViewNarrowsType.ts, 3, 7))
|
||||
>ArrayBufferView : Symbol(ArrayBufferView, Decl(lib.d.ts, --, --))
|
||||
>obj : Symbol(obj, Decl(arrayBufferIsViewNarrowsType.ts, 0, 3))
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/arrayBufferIsViewNarrowsType.ts ===
|
||||
var obj: Object;
|
||||
>obj : Object
|
||||
>Object : Object
|
||||
|
||||
if (ArrayBuffer.isView(obj)) {
|
||||
>ArrayBuffer.isView(obj) : boolean
|
||||
>ArrayBuffer.isView : (arg: any) => arg is ArrayBufferView
|
||||
>ArrayBuffer : ArrayBufferConstructor
|
||||
>isView : (arg: any) => arg is ArrayBufferView
|
||||
>obj : Object
|
||||
|
||||
// isView should be a guard that narrows type to ArrayBufferView.
|
||||
var ab: ArrayBufferView = obj;
|
||||
>ab : ArrayBufferView
|
||||
>ArrayBufferView : ArrayBufferView
|
||||
>obj : ArrayBufferView
|
||||
}
|
||||
@@ -2,9 +2,13 @@ tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2322: Type '{ [index: st
|
||||
Property 'one' is missing in type '{ [index: string]: any; }'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2322: Type '{ [index: number]: any; }' is not assignable to type '{ one: number; }'.
|
||||
Property 'one' is missing in type '{ [index: number]: any; }'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(8,1): error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
|
||||
Index signature is missing in type 'String'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
|
||||
Index signature is missing in type 'Boolean'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompat1.ts (2 errors) ====
|
||||
==== tests/cases/compiler/assignmentCompat1.ts (4 errors) ====
|
||||
var x = { one: 1 };
|
||||
var y: { [index: string]: any };
|
||||
var z: { [index: number]: any };
|
||||
@@ -18,4 +22,14 @@ tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2322: Type '{ [index: nu
|
||||
!!! error TS2322: Type '{ [index: number]: any; }' is not assignable to type '{ one: number; }'.
|
||||
!!! error TS2322: Property 'one' is missing in type '{ [index: number]: any; }'.
|
||||
z = x; // Ok because index signature type is any
|
||||
y = "foo"; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
|
||||
!!! error TS2322: Index signature is missing in type 'String'.
|
||||
z = "foo"; // OK, string has numeric indexer
|
||||
z = false; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
|
||||
!!! error TS2322: Index signature is missing in type 'Boolean'.
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@ x = y; // Error
|
||||
y = x; // Ok because index signature type is any
|
||||
x = z; // Error
|
||||
z = x; // Ok because index signature type is any
|
||||
y = "foo"; // Error
|
||||
z = "foo"; // OK, string has numeric indexer
|
||||
z = false; // Error
|
||||
|
||||
|
||||
|
||||
//// [assignmentCompat1.js]
|
||||
@@ -16,3 +20,6 @@ x = y; // Error
|
||||
y = x; // Ok because index signature type is any
|
||||
x = z; // Error
|
||||
z = x; // Ok because index signature type is any
|
||||
y = "foo"; // Error
|
||||
z = "foo"; // OK, string has numeric indexer
|
||||
z = false; // Error
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(6,16): error TS1055: Type '{}' is not a valid async function return type.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(7,16): error TS1055: Type 'any' is not a valid async function return type.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(8,16): error TS1055: Type 'number' is not a valid async function return type.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(9,16): error TS1055: Type 'PromiseLike<void>' is not a valid async function return type.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(10,16): error TS1055: Type 'typeof Thenable' is not a valid async function return type.
|
||||
Type 'Thenable' is not assignable to type 'PromiseLike<any>'.
|
||||
Types of property 'then' are incompatible.
|
||||
Type '() => void' is not assignable to type '{ <TResult>(onfulfilled?: (value: any) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>; <TResult>(onfulfilled?: (value: any) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>; }'.
|
||||
Type 'void' is not assignable to type 'PromiseLike<any>'.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(17,16): error TS1059: Return expression in async function does not have a valid callable 'then' member.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts(23,25): error TS1058: Operand for 'await' does not have a valid callable 'then' member.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts (7 errors) ====
|
||||
declare class Thenable { then(): void; }
|
||||
declare let a: any;
|
||||
declare let obj: { then: string; };
|
||||
declare let thenable: Thenable;
|
||||
async function fn1() { } // valid: Promise<void>
|
||||
async function fn2(): { } { } // error
|
||||
~~~
|
||||
!!! error TS1055: Type '{}' is not a valid async function return type.
|
||||
async function fn3(): any { } // error
|
||||
~~~
|
||||
!!! error TS1055: Type 'any' is not a valid async function return type.
|
||||
async function fn4(): number { } // error
|
||||
~~~
|
||||
!!! error TS1055: Type 'number' is not a valid async function return type.
|
||||
async function fn5(): PromiseLike<void> { } // error
|
||||
~~~
|
||||
!!! error TS1055: Type 'PromiseLike<void>' is not a valid async function return type.
|
||||
async function fn6(): Thenable { } // error
|
||||
~~~
|
||||
!!! error TS1055: Type 'typeof Thenable' is not a valid async function return type.
|
||||
!!! error TS1055: Type 'Thenable' is not assignable to type 'PromiseLike<any>'.
|
||||
!!! error TS1055: Types of property 'then' are incompatible.
|
||||
!!! error TS1055: Type '() => void' is not assignable to type '{ <TResult>(onfulfilled?: (value: any) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>; <TResult>(onfulfilled?: (value: any) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>; }'.
|
||||
!!! error TS1055: Type 'void' is not assignable to type 'PromiseLike<any>'.
|
||||
async function fn7() { return; } // valid: Promise<void>
|
||||
async function fn8() { return 1; } // valid: Promise<number>
|
||||
async function fn9() { return null; } // valid: Promise<any>
|
||||
async function fn10() { return undefined; } // valid: Promise<any>
|
||||
async function fn11() { return a; } // valid: Promise<any>
|
||||
async function fn12() { return obj; } // valid: Promise<{ then: string; }>
|
||||
async function fn13() { return thenable; } // error
|
||||
~~~~
|
||||
!!! error TS1059: Return expression in async function does not have a valid callable 'then' member.
|
||||
async function fn14() { await 1; } // valid: Promise<void>
|
||||
async function fn15() { await null; } // valid: Promise<void>
|
||||
async function fn16() { await undefined; } // valid: Promise<void>
|
||||
async function fn17() { await a; } // valid: Promise<void>
|
||||
async function fn18() { await obj; } // valid: Promise<void>
|
||||
async function fn19() { await thenable; } // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1058: Operand for 'await' does not have a valid callable 'then' member.
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
//// [asyncFunctionDeclaration15_es6.ts]
|
||||
declare class Thenable { then(): void; }
|
||||
declare let a: any;
|
||||
declare let obj: { then: string; };
|
||||
declare let thenable: Thenable;
|
||||
async function fn1() { } // valid: Promise<void>
|
||||
async function fn2(): { } { } // error
|
||||
async function fn3(): any { } // error
|
||||
async function fn4(): number { } // error
|
||||
async function fn5(): PromiseLike<void> { } // error
|
||||
async function fn6(): Thenable { } // error
|
||||
async function fn7() { return; } // valid: Promise<void>
|
||||
async function fn8() { return 1; } // valid: Promise<number>
|
||||
async function fn9() { return null; } // valid: Promise<any>
|
||||
async function fn10() { return undefined; } // valid: Promise<any>
|
||||
async function fn11() { return a; } // valid: Promise<any>
|
||||
async function fn12() { return obj; } // valid: Promise<{ then: string; }>
|
||||
async function fn13() { return thenable; } // error
|
||||
async function fn14() { await 1; } // valid: Promise<void>
|
||||
async function fn15() { await null; } // valid: Promise<void>
|
||||
async function fn16() { await undefined; } // valid: Promise<void>
|
||||
async function fn17() { await a; } // valid: Promise<void>
|
||||
async function fn18() { await obj; } // valid: Promise<void>
|
||||
async function fn19() { await thenable; } // error
|
||||
|
||||
|
||||
//// [asyncFunctionDeclaration15_es6.js]
|
||||
function fn1() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
} // valid: Promise<void>
|
||||
function fn2() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
} // error
|
||||
function fn3() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
} // error
|
||||
function fn4() {
|
||||
return __awaiter(this, void 0, Promise, function* () { });
|
||||
} // error
|
||||
function fn5() {
|
||||
return __awaiter(this, void 0, PromiseLike, function* () { });
|
||||
} // error
|
||||
function fn6() {
|
||||
return __awaiter(this, void 0, Thenable, function* () { });
|
||||
} // error
|
||||
function fn7() {
|
||||
return __awaiter(this, void 0, Promise, function* () { return; });
|
||||
} // valid: Promise<void>
|
||||
function fn8() {
|
||||
return __awaiter(this, void 0, Promise, function* () { return 1; });
|
||||
} // valid: Promise<number>
|
||||
function fn9() {
|
||||
return __awaiter(this, void 0, Promise, function* () { return null; });
|
||||
} // valid: Promise<any>
|
||||
function fn10() {
|
||||
return __awaiter(this, void 0, Promise, function* () { return undefined; });
|
||||
} // valid: Promise<any>
|
||||
function fn11() {
|
||||
return __awaiter(this, void 0, Promise, function* () { return a; });
|
||||
} // valid: Promise<any>
|
||||
function fn12() {
|
||||
return __awaiter(this, void 0, Promise, function* () { return obj; });
|
||||
} // valid: Promise<{ then: string; }>
|
||||
function fn13() {
|
||||
return __awaiter(this, void 0, Promise, function* () { return thenable; });
|
||||
} // error
|
||||
function fn14() {
|
||||
return __awaiter(this, void 0, Promise, function* () { yield 1; });
|
||||
} // valid: Promise<void>
|
||||
function fn15() {
|
||||
return __awaiter(this, void 0, Promise, function* () { yield null; });
|
||||
} // valid: Promise<void>
|
||||
function fn16() {
|
||||
return __awaiter(this, void 0, Promise, function* () { yield undefined; });
|
||||
} // valid: Promise<void>
|
||||
function fn17() {
|
||||
return __awaiter(this, void 0, Promise, function* () { yield a; });
|
||||
} // valid: Promise<void>
|
||||
function fn18() {
|
||||
return __awaiter(this, void 0, Promise, function* () { yield obj; });
|
||||
} // valid: Promise<void>
|
||||
function fn19() {
|
||||
return __awaiter(this, void 0, Promise, function* () { yield thenable; });
|
||||
} // error
|
||||
@@ -1,24 +1,18 @@
|
||||
tests/cases/compiler/augmentedTypesClass2.ts(4,7): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/augmentedTypesClass2.ts(10,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/augmentedTypesClass2.ts(16,7): error TS2300: Duplicate identifier 'c33'.
|
||||
tests/cases/compiler/augmentedTypesClass2.ts(21,6): error TS2300: Duplicate identifier 'c33'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/augmentedTypesClass2.ts (4 errors) ====
|
||||
==== tests/cases/compiler/augmentedTypesClass2.ts (2 errors) ====
|
||||
// Checking class with other things in type space not value space
|
||||
|
||||
// class then interface
|
||||
class c11 { // error
|
||||
~~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
class c11 {
|
||||
foo() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
interface c11 { // error
|
||||
~~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
interface c11 {
|
||||
bar(): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Checking class with other things in type space not value space
|
||||
|
||||
// class then interface
|
||||
class c11 { // error
|
||||
class c11 {
|
||||
foo() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
interface c11 { // error
|
||||
interface c11 {
|
||||
bar(): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
tests/cases/compiler/augmentedTypesInterface.ts(12,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/augmentedTypesInterface.ts(16,7): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/augmentedTypesInterface.ts(23,11): error TS2300: Duplicate identifier 'i3'.
|
||||
tests/cases/compiler/augmentedTypesInterface.ts(26,6): error TS2300: Duplicate identifier 'i3'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/augmentedTypesInterface.ts (4 errors) ====
|
||||
==== tests/cases/compiler/augmentedTypesInterface.ts (2 errors) ====
|
||||
// interface then interface
|
||||
|
||||
interface i {
|
||||
@@ -16,15 +14,11 @@ tests/cases/compiler/augmentedTypesInterface.ts(26,6): error TS2300: Duplicate i
|
||||
}
|
||||
|
||||
// interface then class
|
||||
interface i2 { // error
|
||||
~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
interface i2 {
|
||||
foo(): void;
|
||||
}
|
||||
|
||||
class i2 { // error
|
||||
~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
class i2 {
|
||||
bar() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ interface i {
|
||||
}
|
||||
|
||||
// interface then class
|
||||
interface i2 { // error
|
||||
interface i2 {
|
||||
foo(): void;
|
||||
}
|
||||
|
||||
class i2 { // error
|
||||
class i2 {
|
||||
bar() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(2,13): error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(58,20): error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(65,20): error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(100,12): error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
|
||||
|
||||
==== tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts (4 errors) ====
|
||||
function foo0() {
|
||||
let a = x;
|
||||
~
|
||||
!!! error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo1() {
|
||||
let a = () => x;
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo2() {
|
||||
let a = function () { return x; }
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo3() {
|
||||
class X {
|
||||
m() { return x;}
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo4() {
|
||||
let y = class {
|
||||
m() { return x; }
|
||||
};
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo5() {
|
||||
let x = () => y;
|
||||
let y = () => x;
|
||||
}
|
||||
|
||||
function foo6() {
|
||||
function f() {
|
||||
return x;
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo7() {
|
||||
class A {
|
||||
a = x;
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo8() {
|
||||
let y = class {
|
||||
a = x;
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo9() {
|
||||
let y = class {
|
||||
static a = x;
|
||||
~
|
||||
!!! error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo10() {
|
||||
class A {
|
||||
static a = x;
|
||||
~
|
||||
!!! error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo11() {
|
||||
function f () {
|
||||
let y = class {
|
||||
static a = x;
|
||||
}
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo12() {
|
||||
function f () {
|
||||
let y = class {
|
||||
a;
|
||||
constructor() {
|
||||
this.a = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo13() {
|
||||
let a = {
|
||||
get a() { return x }
|
||||
}
|
||||
let x
|
||||
}
|
||||
|
||||
function foo14() {
|
||||
let a = {
|
||||
a: x
|
||||
~
|
||||
!!! error TS2448: Block-scoped variable 'x' used before its declaration.
|
||||
}
|
||||
let x
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
//// [blockScopedVariablesUseBeforeDef.ts]
|
||||
function foo0() {
|
||||
let a = x;
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo1() {
|
||||
let a = () => x;
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo2() {
|
||||
let a = function () { return x; }
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo3() {
|
||||
class X {
|
||||
m() { return x;}
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo4() {
|
||||
let y = class {
|
||||
m() { return x; }
|
||||
};
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo5() {
|
||||
let x = () => y;
|
||||
let y = () => x;
|
||||
}
|
||||
|
||||
function foo6() {
|
||||
function f() {
|
||||
return x;
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo7() {
|
||||
class A {
|
||||
a = x;
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo8() {
|
||||
let y = class {
|
||||
a = x;
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo9() {
|
||||
let y = class {
|
||||
static a = x;
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo10() {
|
||||
class A {
|
||||
static a = x;
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo11() {
|
||||
function f () {
|
||||
let y = class {
|
||||
static a = x;
|
||||
}
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo12() {
|
||||
function f () {
|
||||
let y = class {
|
||||
a;
|
||||
constructor() {
|
||||
this.a = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
let x;
|
||||
}
|
||||
|
||||
function foo13() {
|
||||
let a = {
|
||||
get a() { return x }
|
||||
}
|
||||
let x
|
||||
}
|
||||
|
||||
function foo14() {
|
||||
let a = {
|
||||
a: x
|
||||
}
|
||||
let x
|
||||
}
|
||||
|
||||
//// [blockScopedVariablesUseBeforeDef.js]
|
||||
function foo0() {
|
||||
var a = x;
|
||||
var x;
|
||||
}
|
||||
function foo1() {
|
||||
var a = function () { return x; };
|
||||
var x;
|
||||
}
|
||||
function foo2() {
|
||||
var a = function () { return x; };
|
||||
var x;
|
||||
}
|
||||
function foo3() {
|
||||
var X = (function () {
|
||||
function X() {
|
||||
}
|
||||
X.prototype.m = function () { return x; };
|
||||
return X;
|
||||
})();
|
||||
var x;
|
||||
}
|
||||
function foo4() {
|
||||
var y = (function () {
|
||||
function class_1() {
|
||||
}
|
||||
class_1.prototype.m = function () { return x; };
|
||||
return class_1;
|
||||
})();
|
||||
var x;
|
||||
}
|
||||
function foo5() {
|
||||
var x = function () { return y; };
|
||||
var y = function () { return x; };
|
||||
}
|
||||
function foo6() {
|
||||
function f() {
|
||||
return x;
|
||||
}
|
||||
var x;
|
||||
}
|
||||
function foo7() {
|
||||
var A = (function () {
|
||||
function A() {
|
||||
this.a = x;
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var x;
|
||||
}
|
||||
function foo8() {
|
||||
var y = (function () {
|
||||
function class_2() {
|
||||
this.a = x;
|
||||
}
|
||||
return class_2;
|
||||
})();
|
||||
var x;
|
||||
}
|
||||
function foo9() {
|
||||
var y = (function () {
|
||||
function class_3() {
|
||||
}
|
||||
class_3.a = x;
|
||||
return class_3;
|
||||
})();
|
||||
var x;
|
||||
}
|
||||
function foo10() {
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.a = x;
|
||||
return A;
|
||||
})();
|
||||
var x;
|
||||
}
|
||||
function foo11() {
|
||||
function f() {
|
||||
var y = (function () {
|
||||
function class_4() {
|
||||
}
|
||||
class_4.a = x;
|
||||
return class_4;
|
||||
})();
|
||||
}
|
||||
var x;
|
||||
}
|
||||
function foo12() {
|
||||
function f() {
|
||||
var y = (function () {
|
||||
function class_5() {
|
||||
this.a = x;
|
||||
}
|
||||
return class_5;
|
||||
})();
|
||||
}
|
||||
var x;
|
||||
}
|
||||
function foo13() {
|
||||
var a = {
|
||||
get a() { return x; }
|
||||
};
|
||||
var x;
|
||||
}
|
||||
function foo14() {
|
||||
var a = {
|
||||
a: x
|
||||
};
|
||||
var x;
|
||||
}
|
||||
@@ -1,7 +1,3 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(7,16): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(8,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(10,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(11,16): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(13,16): error TS2300: Duplicate identifier 'CC1'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(14,7): error TS2300: Duplicate identifier 'CC1'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(16,7): error TS2300: Duplicate identifier 'CC2'.
|
||||
@@ -20,7 +16,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts(39,1): error TS2511: Cannot create an instance of the abstract class 'DCC1'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts (20 errors) ====
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMergedDeclaration.ts (16 errors) ====
|
||||
abstract class CM {}
|
||||
module CM {}
|
||||
|
||||
@@ -28,18 +24,10 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst
|
||||
abstract class MC {}
|
||||
|
||||
abstract class CI {}
|
||||
~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
interface CI {}
|
||||
~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
|
||||
interface IC {}
|
||||
~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
abstract class IC {}
|
||||
~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
|
||||
abstract class CC1 {}
|
||||
~~~
|
||||
|
||||
@@ -1,37 +1,25 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(1,7): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(1,11): error TS2300: Duplicate identifier 'foo'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(2,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(2,15): error TS2300: Duplicate identifier 'foo'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(5,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(6,9): error TS2300: Duplicate identifier 'bar'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(9,15): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts(10,9): error TS2300: Duplicate identifier 'bar'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts (8 errors) ====
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAndInterfaceWithSameName.ts (4 errors) ====
|
||||
class C { foo: string; }
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'foo'.
|
||||
interface C { foo: string; } // error
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
interface C { foo: string; }
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'foo'.
|
||||
|
||||
module M {
|
||||
class D {
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
bar: string;
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'bar'.
|
||||
}
|
||||
|
||||
interface D { // error
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
interface D {
|
||||
bar: string;
|
||||
~~~
|
||||
!!! error TS2300: Duplicate identifier 'bar'.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
//// [classAndInterfaceWithSameName.ts]
|
||||
class C { foo: string; }
|
||||
interface C { foo: string; } // error
|
||||
interface C { foo: string; }
|
||||
|
||||
module M {
|
||||
class D {
|
||||
bar: string;
|
||||
}
|
||||
|
||||
interface D { // error
|
||||
interface D {
|
||||
bar: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
tests/cases/compiler/clinterfaces.ts(2,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/clinterfaces.ts(3,15): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/clinterfaces.ts(4,15): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/clinterfaces.ts(5,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/clinterfaces.ts(8,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/clinterfaces.ts(12,7): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/clinterfaces.ts(16,7): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/clinterfaces.ts(20,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
|
||||
|
||||
==== tests/cases/compiler/clinterfaces.ts (8 errors) ====
|
||||
module M {
|
||||
class C { }
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
interface C { }
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
interface D { }
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
class D { }
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
}
|
||||
|
||||
interface Foo<T> {
|
||||
~~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
a: string;
|
||||
}
|
||||
|
||||
class Foo<T>{
|
||||
~~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
b: number;
|
||||
}
|
||||
|
||||
class Bar<T>{
|
||||
~~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
b: number;
|
||||
}
|
||||
|
||||
interface Bar<T> {
|
||||
~~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
a: string;
|
||||
}
|
||||
|
||||
export = Foo;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
=== tests/cases/compiler/clinterfaces.ts ===
|
||||
module M {
|
||||
>M : Symbol(M, Decl(clinterfaces.ts, 0, 0))
|
||||
|
||||
class C { }
|
||||
>C : Symbol(C, Decl(clinterfaces.ts, 0, 10), Decl(clinterfaces.ts, 1, 15))
|
||||
|
||||
interface C { }
|
||||
>C : Symbol(C, Decl(clinterfaces.ts, 0, 10), Decl(clinterfaces.ts, 1, 15))
|
||||
|
||||
interface D { }
|
||||
>D : Symbol(D, Decl(clinterfaces.ts, 2, 19), Decl(clinterfaces.ts, 3, 19))
|
||||
|
||||
class D { }
|
||||
>D : Symbol(D, Decl(clinterfaces.ts, 2, 19), Decl(clinterfaces.ts, 3, 19))
|
||||
}
|
||||
|
||||
interface Foo<T> {
|
||||
>Foo : Symbol(Foo, Decl(clinterfaces.ts, 5, 1), Decl(clinterfaces.ts, 9, 1))
|
||||
>T : Symbol(T, Decl(clinterfaces.ts, 7, 14), Decl(clinterfaces.ts, 11, 10))
|
||||
|
||||
a: string;
|
||||
>a : Symbol(a, Decl(clinterfaces.ts, 7, 18))
|
||||
}
|
||||
|
||||
class Foo<T>{
|
||||
>Foo : Symbol(Foo, Decl(clinterfaces.ts, 5, 1), Decl(clinterfaces.ts, 9, 1))
|
||||
>T : Symbol(T, Decl(clinterfaces.ts, 7, 14), Decl(clinterfaces.ts, 11, 10))
|
||||
|
||||
b: number;
|
||||
>b : Symbol(b, Decl(clinterfaces.ts, 11, 13))
|
||||
}
|
||||
|
||||
class Bar<T>{
|
||||
>Bar : Symbol(Bar, Decl(clinterfaces.ts, 13, 1), Decl(clinterfaces.ts, 17, 1))
|
||||
>T : Symbol(T, Decl(clinterfaces.ts, 15, 10), Decl(clinterfaces.ts, 19, 14))
|
||||
|
||||
b: number;
|
||||
>b : Symbol(b, Decl(clinterfaces.ts, 15, 13))
|
||||
}
|
||||
|
||||
interface Bar<T> {
|
||||
>Bar : Symbol(Bar, Decl(clinterfaces.ts, 13, 1), Decl(clinterfaces.ts, 17, 1))
|
||||
>T : Symbol(T, Decl(clinterfaces.ts, 15, 10), Decl(clinterfaces.ts, 19, 14))
|
||||
|
||||
a: string;
|
||||
>a : Symbol(a, Decl(clinterfaces.ts, 19, 18))
|
||||
}
|
||||
|
||||
export = Foo;
|
||||
>Foo : Symbol(Foo, Decl(clinterfaces.ts, 5, 1), Decl(clinterfaces.ts, 9, 1))
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
=== tests/cases/compiler/clinterfaces.ts ===
|
||||
module M {
|
||||
>M : typeof M
|
||||
|
||||
class C { }
|
||||
>C : C
|
||||
|
||||
interface C { }
|
||||
>C : C
|
||||
|
||||
interface D { }
|
||||
>D : D
|
||||
|
||||
class D { }
|
||||
>D : D
|
||||
}
|
||||
|
||||
interface Foo<T> {
|
||||
>Foo : Foo<T>
|
||||
>T : T
|
||||
|
||||
a: string;
|
||||
>a : string
|
||||
}
|
||||
|
||||
class Foo<T>{
|
||||
>Foo : Foo<T>
|
||||
>T : T
|
||||
|
||||
b: number;
|
||||
>b : number
|
||||
}
|
||||
|
||||
class Bar<T>{
|
||||
>Bar : Bar<T>
|
||||
>T : T
|
||||
|
||||
b: number;
|
||||
>b : number
|
||||
}
|
||||
|
||||
interface Bar<T> {
|
||||
>Bar : Bar<T>
|
||||
>T : T
|
||||
|
||||
a: string;
|
||||
>a : string
|
||||
}
|
||||
|
||||
export = Foo;
|
||||
>Foo : Foo<T>
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
//// [compoundExponentiationAssignmentLHSCanBeAssigned1.ts]
|
||||
enum E { a, b, c }
|
||||
|
||||
var a: any;
|
||||
var b: number;
|
||||
var c: E;
|
||||
|
||||
var x1: any;
|
||||
x1 **= a;
|
||||
x1 **= b;
|
||||
x1 **= c;
|
||||
x1 **= null;
|
||||
x1 **= undefined;
|
||||
|
||||
var x2: number;
|
||||
x2 **= a;
|
||||
x2 **= b;
|
||||
x2 **= c;
|
||||
x2 **= null;
|
||||
x2 **= undefined;
|
||||
|
||||
var x3: E;
|
||||
x3 **= a;
|
||||
x3 **= b;
|
||||
x3 **= c;
|
||||
x3 **= null;
|
||||
x3 **= undefined;
|
||||
|
||||
//// [compoundExponentiationAssignmentLHSCanBeAssigned1.js]
|
||||
var E;
|
||||
(function (E) {
|
||||
E[E["a"] = 0] = "a";
|
||||
E[E["b"] = 1] = "b";
|
||||
E[E["c"] = 2] = "c";
|
||||
})(E || (E = {}));
|
||||
var a;
|
||||
var b;
|
||||
var c;
|
||||
var x1;
|
||||
x1 = Math.pow(x1, a);
|
||||
x1 = Math.pow(x1, b);
|
||||
x1 = Math.pow(x1, c);
|
||||
x1 = Math.pow(x1, null);
|
||||
x1 = Math.pow(x1, undefined);
|
||||
var x2;
|
||||
x2 = Math.pow(x2, a);
|
||||
x2 = Math.pow(x2, b);
|
||||
x2 = Math.pow(x2, c);
|
||||
x2 = Math.pow(x2, null);
|
||||
x2 = Math.pow(x2, undefined);
|
||||
var x3;
|
||||
x3 = Math.pow(x3, a);
|
||||
x3 = Math.pow(x3, b);
|
||||
x3 = Math.pow(x3, c);
|
||||
x3 = Math.pow(x3, null);
|
||||
x3 = Math.pow(x3, undefined);
|
||||
@@ -0,0 +1,84 @@
|
||||
=== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1.ts ===
|
||||
enum E { a, b, c }
|
||||
>E : Symbol(E, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 0, 0))
|
||||
>a : Symbol(E.a, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 0, 8))
|
||||
>b : Symbol(E.b, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 0, 11))
|
||||
>c : Symbol(E.c, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 0, 14))
|
||||
|
||||
var a: any;
|
||||
>a : Symbol(a, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 2, 3))
|
||||
|
||||
var b: number;
|
||||
>b : Symbol(b, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 3, 3))
|
||||
|
||||
var c: E;
|
||||
>c : Symbol(c, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 4, 3))
|
||||
>E : Symbol(E, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 0, 0))
|
||||
|
||||
var x1: any;
|
||||
>x1 : Symbol(x1, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 6, 3))
|
||||
|
||||
x1 **= a;
|
||||
>x1 : Symbol(x1, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 6, 3))
|
||||
>a : Symbol(a, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 2, 3))
|
||||
|
||||
x1 **= b;
|
||||
>x1 : Symbol(x1, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 6, 3))
|
||||
>b : Symbol(b, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 3, 3))
|
||||
|
||||
x1 **= c;
|
||||
>x1 : Symbol(x1, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 6, 3))
|
||||
>c : Symbol(c, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 4, 3))
|
||||
|
||||
x1 **= null;
|
||||
>x1 : Symbol(x1, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 6, 3))
|
||||
|
||||
x1 **= undefined;
|
||||
>x1 : Symbol(x1, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 6, 3))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
var x2: number;
|
||||
>x2 : Symbol(x2, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 13, 3))
|
||||
|
||||
x2 **= a;
|
||||
>x2 : Symbol(x2, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 13, 3))
|
||||
>a : Symbol(a, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 2, 3))
|
||||
|
||||
x2 **= b;
|
||||
>x2 : Symbol(x2, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 13, 3))
|
||||
>b : Symbol(b, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 3, 3))
|
||||
|
||||
x2 **= c;
|
||||
>x2 : Symbol(x2, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 13, 3))
|
||||
>c : Symbol(c, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 4, 3))
|
||||
|
||||
x2 **= null;
|
||||
>x2 : Symbol(x2, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 13, 3))
|
||||
|
||||
x2 **= undefined;
|
||||
>x2 : Symbol(x2, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 13, 3))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
var x3: E;
|
||||
>x3 : Symbol(x3, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 20, 3))
|
||||
>E : Symbol(E, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 0, 0))
|
||||
|
||||
x3 **= a;
|
||||
>x3 : Symbol(x3, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 20, 3))
|
||||
>a : Symbol(a, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 2, 3))
|
||||
|
||||
x3 **= b;
|
||||
>x3 : Symbol(x3, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 20, 3))
|
||||
>b : Symbol(b, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 3, 3))
|
||||
|
||||
x3 **= c;
|
||||
>x3 : Symbol(x3, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 20, 3))
|
||||
>c : Symbol(c, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 4, 3))
|
||||
|
||||
x3 **= null;
|
||||
>x3 : Symbol(x3, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 20, 3))
|
||||
|
||||
x3 **= undefined;
|
||||
>x3 : Symbol(x3, Decl(compoundExponentiationAssignmentLHSCanBeAssigned1.ts, 20, 3))
|
||||
>undefined : Symbol(undefined)
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
=== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCanBeAssigned1.ts ===
|
||||
enum E { a, b, c }
|
||||
>E : E
|
||||
>a : E
|
||||
>b : E
|
||||
>c : E
|
||||
|
||||
var a: any;
|
||||
>a : any
|
||||
|
||||
var b: number;
|
||||
>b : number
|
||||
|
||||
var c: E;
|
||||
>c : E
|
||||
>E : E
|
||||
|
||||
var x1: any;
|
||||
>x1 : any
|
||||
|
||||
x1 **= a;
|
||||
>x1 **= a : number
|
||||
>x1 : any
|
||||
>a : any
|
||||
|
||||
x1 **= b;
|
||||
>x1 **= b : number
|
||||
>x1 : any
|
||||
>b : number
|
||||
|
||||
x1 **= c;
|
||||
>x1 **= c : number
|
||||
>x1 : any
|
||||
>c : E
|
||||
|
||||
x1 **= null;
|
||||
>x1 **= null : number
|
||||
>x1 : any
|
||||
>null : null
|
||||
|
||||
x1 **= undefined;
|
||||
>x1 **= undefined : number
|
||||
>x1 : any
|
||||
>undefined : undefined
|
||||
|
||||
var x2: number;
|
||||
>x2 : number
|
||||
|
||||
x2 **= a;
|
||||
>x2 **= a : number
|
||||
>x2 : number
|
||||
>a : any
|
||||
|
||||
x2 **= b;
|
||||
>x2 **= b : number
|
||||
>x2 : number
|
||||
>b : number
|
||||
|
||||
x2 **= c;
|
||||
>x2 **= c : number
|
||||
>x2 : number
|
||||
>c : E
|
||||
|
||||
x2 **= null;
|
||||
>x2 **= null : number
|
||||
>x2 : number
|
||||
>null : null
|
||||
|
||||
x2 **= undefined;
|
||||
>x2 **= undefined : number
|
||||
>x2 : number
|
||||
>undefined : undefined
|
||||
|
||||
var x3: E;
|
||||
>x3 : E
|
||||
>E : E
|
||||
|
||||
x3 **= a;
|
||||
>x3 **= a : number
|
||||
>x3 : E
|
||||
>a : any
|
||||
|
||||
x3 **= b;
|
||||
>x3 **= b : number
|
||||
>x3 : E
|
||||
>b : number
|
||||
|
||||
x3 **= c;
|
||||
>x3 **= c : number
|
||||
>x3 : E
|
||||
>c : E
|
||||
|
||||
x3 **= null;
|
||||
>x3 **= null : number
|
||||
>x3 : E
|
||||
>null : null
|
||||
|
||||
x3 **= undefined;
|
||||
>x3 **= undefined : number
|
||||
>x3 : E
|
||||
>undefined : undefined
|
||||
|
||||
+267
@@ -0,0 +1,267 @@
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(8,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(9,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(9,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(10,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(11,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(12,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(13,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(14,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(15,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(15,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(19,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(19,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(20,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(20,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(21,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(22,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(22,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(23,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(24,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(24,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(25,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(25,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(26,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(26,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(29,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(30,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(30,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(31,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(31,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(32,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(33,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(33,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(34,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(35,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(35,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(36,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(36,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(37,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(37,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(40,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(41,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(41,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(42,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(42,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(43,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(44,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(44,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(45,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(46,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(46,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(47,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(47,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(48,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(48,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(51,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(52,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(53,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(54,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(57,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(58,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(59,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts(60,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSCannotBeAssigned.ts (68 errors) ====
|
||||
enum E { a, b }
|
||||
|
||||
var a: any;
|
||||
var b: void;
|
||||
|
||||
var x1: boolean;
|
||||
x1 **= a;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x1 **= b;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x1 **= true;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x1 **= 0;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x1 **= ''
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x1 **= E.a;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x1 **= {};
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x1 **= null;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x1 **= undefined;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
var x2: string;
|
||||
x2 **= a;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x2 **= b;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x2 **= true;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x2 **= 0;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x2 **= ''
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x2 **= E.a;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x2 **= {};
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x2 **= null;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x2 **= undefined;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
var x3: {};
|
||||
x3 **= a;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x3 **= b;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x3 **= true;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x3 **= 0;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x3 **= ''
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x3 **= E.a;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x3 **= {};
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x3 **= null;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x3 **= undefined;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
var x4: void;
|
||||
x4 **= a;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x4 **= b;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x4 **= true;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x4 **= 0;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x4 **= ''
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x4 **= E.a;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x4 **= {};
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x4 **= null;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x4 **= undefined;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
~~~~~~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
var x5: number;
|
||||
x5 **= b;
|
||||
~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x5 **= true;
|
||||
~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x5 **= ''
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x5 **= {};
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
var x6: E;
|
||||
x6 **= b;
|
||||
~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x6 **= true;
|
||||
~~~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x6 **= ''
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
x6 **= {};
|
||||
~~
|
||||
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -0,0 +1,120 @@
|
||||
//// [compoundExponentiationAssignmentLHSCannotBeAssigned.ts]
|
||||
enum E { a, b }
|
||||
|
||||
var a: any;
|
||||
var b: void;
|
||||
|
||||
var x1: boolean;
|
||||
x1 **= a;
|
||||
x1 **= b;
|
||||
x1 **= true;
|
||||
x1 **= 0;
|
||||
x1 **= ''
|
||||
x1 **= E.a;
|
||||
x1 **= {};
|
||||
x1 **= null;
|
||||
x1 **= undefined;
|
||||
|
||||
var x2: string;
|
||||
x2 **= a;
|
||||
x2 **= b;
|
||||
x2 **= true;
|
||||
x2 **= 0;
|
||||
x2 **= ''
|
||||
x2 **= E.a;
|
||||
x2 **= {};
|
||||
x2 **= null;
|
||||
x2 **= undefined;
|
||||
|
||||
var x3: {};
|
||||
x3 **= a;
|
||||
x3 **= b;
|
||||
x3 **= true;
|
||||
x3 **= 0;
|
||||
x3 **= ''
|
||||
x3 **= E.a;
|
||||
x3 **= {};
|
||||
x3 **= null;
|
||||
x3 **= undefined;
|
||||
|
||||
var x4: void;
|
||||
x4 **= a;
|
||||
x4 **= b;
|
||||
x4 **= true;
|
||||
x4 **= 0;
|
||||
x4 **= ''
|
||||
x4 **= E.a;
|
||||
x4 **= {};
|
||||
x4 **= null;
|
||||
x4 **= undefined;
|
||||
|
||||
var x5: number;
|
||||
x5 **= b;
|
||||
x5 **= true;
|
||||
x5 **= ''
|
||||
x5 **= {};
|
||||
|
||||
var x6: E;
|
||||
x6 **= b;
|
||||
x6 **= true;
|
||||
x6 **= ''
|
||||
x6 **= {};
|
||||
|
||||
//// [compoundExponentiationAssignmentLHSCannotBeAssigned.js]
|
||||
var E;
|
||||
(function (E) {
|
||||
E[E["a"] = 0] = "a";
|
||||
E[E["b"] = 1] = "b";
|
||||
})(E || (E = {}));
|
||||
var a;
|
||||
var b;
|
||||
var x1;
|
||||
x1 = Math.pow(x1, a);
|
||||
x1 = Math.pow(x1, b);
|
||||
x1 = Math.pow(x1, true);
|
||||
x1 = Math.pow(x1, 0);
|
||||
x1 = Math.pow(x1, '');
|
||||
x1 = Math.pow(x1, E.a);
|
||||
x1 = Math.pow(x1, {});
|
||||
x1 = Math.pow(x1, null);
|
||||
x1 = Math.pow(x1, undefined);
|
||||
var x2;
|
||||
x2 = Math.pow(x2, a);
|
||||
x2 = Math.pow(x2, b);
|
||||
x2 = Math.pow(x2, true);
|
||||
x2 = Math.pow(x2, 0);
|
||||
x2 = Math.pow(x2, '');
|
||||
x2 = Math.pow(x2, E.a);
|
||||
x2 = Math.pow(x2, {});
|
||||
x2 = Math.pow(x2, null);
|
||||
x2 = Math.pow(x2, undefined);
|
||||
var x3;
|
||||
x3 = Math.pow(x3, a);
|
||||
x3 = Math.pow(x3, b);
|
||||
x3 = Math.pow(x3, true);
|
||||
x3 = Math.pow(x3, 0);
|
||||
x3 = Math.pow(x3, '');
|
||||
x3 = Math.pow(x3, E.a);
|
||||
x3 = Math.pow(x3, {});
|
||||
x3 = Math.pow(x3, null);
|
||||
x3 = Math.pow(x3, undefined);
|
||||
var x4;
|
||||
x4 = Math.pow(x4, a);
|
||||
x4 = Math.pow(x4, b);
|
||||
x4 = Math.pow(x4, true);
|
||||
x4 = Math.pow(x4, 0);
|
||||
x4 = Math.pow(x4, '');
|
||||
x4 = Math.pow(x4, E.a);
|
||||
x4 = Math.pow(x4, {});
|
||||
x4 = Math.pow(x4, null);
|
||||
x4 = Math.pow(x4, undefined);
|
||||
var x5;
|
||||
x5 = Math.pow(x5, b);
|
||||
x5 = Math.pow(x5, true);
|
||||
x5 = Math.pow(x5, '');
|
||||
x5 = Math.pow(x5, {});
|
||||
var x6;
|
||||
x6 = Math.pow(x6, b);
|
||||
x6 = Math.pow(x6, true);
|
||||
x6 = Math.pow(x6, '');
|
||||
x6 = Math.pow(x6, {});
|
||||
@@ -0,0 +1,48 @@
|
||||
//// [compoundExponentiationAssignmentLHSIsReference.ts]
|
||||
var value;
|
||||
|
||||
// identifiers: variable and parameter
|
||||
var x1: number;
|
||||
x1 **= value;
|
||||
|
||||
function fn1(x2: number) {
|
||||
x2 **= value;
|
||||
}
|
||||
|
||||
// property accesses
|
||||
var x3: { a: number };
|
||||
x3.a **= value;
|
||||
|
||||
x3['a'] **= value;
|
||||
|
||||
// parentheses, the contained expression is reference
|
||||
(x1) **= value;
|
||||
|
||||
function fn2(x4: number) {
|
||||
(x4) **= value;
|
||||
}
|
||||
|
||||
(x3.a) **= value;
|
||||
|
||||
(x3['a']) **= value;
|
||||
|
||||
//// [compoundExponentiationAssignmentLHSIsReference.js]
|
||||
var value;
|
||||
// identifiers: variable and parameter
|
||||
var x1;
|
||||
x1 = Math.pow(x1, value);
|
||||
function fn1(x2) {
|
||||
x2 = Math.pow(x2, value);
|
||||
}
|
||||
// property accesses
|
||||
var x3;
|
||||
(_a = x3, _a.a = Math.pow(_a.a, value));
|
||||
(_b = x3, _b['a'] = Math.pow(_b['a'], value));
|
||||
// parentheses, the contained expression is reference
|
||||
(x1) = Math.pow((x1), value);
|
||||
function fn2(x4) {
|
||||
(x4) = Math.pow((x4), value);
|
||||
}
|
||||
(x3.a) = Math.pow((x3.a), value);
|
||||
(x3['a']) = Math.pow((x3['a']), value);
|
||||
var _a, _b;
|
||||
@@ -0,0 +1,62 @@
|
||||
=== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsReference.ts ===
|
||||
var value;
|
||||
>value : Symbol(value, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 0, 3))
|
||||
|
||||
// identifiers: variable and parameter
|
||||
var x1: number;
|
||||
>x1 : Symbol(x1, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 3, 3))
|
||||
|
||||
x1 **= value;
|
||||
>x1 : Symbol(x1, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 3, 3))
|
||||
>value : Symbol(value, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 0, 3))
|
||||
|
||||
function fn1(x2: number) {
|
||||
>fn1 : Symbol(fn1, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 4, 13))
|
||||
>x2 : Symbol(x2, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 6, 13))
|
||||
|
||||
x2 **= value;
|
||||
>x2 : Symbol(x2, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 6, 13))
|
||||
>value : Symbol(value, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 0, 3))
|
||||
}
|
||||
|
||||
// property accesses
|
||||
var x3: { a: number };
|
||||
>x3 : Symbol(x3, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 3))
|
||||
>a : Symbol(a, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 9))
|
||||
|
||||
x3.a **= value;
|
||||
>x3.a : Symbol(a, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 9))
|
||||
>x3 : Symbol(x3, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 3))
|
||||
>a : Symbol(a, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 9))
|
||||
>value : Symbol(value, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 0, 3))
|
||||
|
||||
x3['a'] **= value;
|
||||
>x3 : Symbol(x3, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 3))
|
||||
>'a' : Symbol(a, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 9))
|
||||
>value : Symbol(value, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 0, 3))
|
||||
|
||||
// parentheses, the contained expression is reference
|
||||
(x1) **= value;
|
||||
>x1 : Symbol(x1, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 3, 3))
|
||||
>value : Symbol(value, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 0, 3))
|
||||
|
||||
function fn2(x4: number) {
|
||||
>fn2 : Symbol(fn2, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 17, 15))
|
||||
>x4 : Symbol(x4, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 19, 13))
|
||||
|
||||
(x4) **= value;
|
||||
>x4 : Symbol(x4, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 19, 13))
|
||||
>value : Symbol(value, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 0, 3))
|
||||
}
|
||||
|
||||
(x3.a) **= value;
|
||||
>x3.a : Symbol(a, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 9))
|
||||
>x3 : Symbol(x3, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 3))
|
||||
>a : Symbol(a, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 9))
|
||||
>value : Symbol(value, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 0, 3))
|
||||
|
||||
(x3['a']) **= value;
|
||||
>x3 : Symbol(x3, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 3))
|
||||
>'a' : Symbol(a, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 11, 9))
|
||||
>value : Symbol(value, Decl(compoundExponentiationAssignmentLHSIsReference.ts, 0, 3))
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
=== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsReference.ts ===
|
||||
var value;
|
||||
>value : any
|
||||
|
||||
// identifiers: variable and parameter
|
||||
var x1: number;
|
||||
>x1 : number
|
||||
|
||||
x1 **= value;
|
||||
>x1 **= value : number
|
||||
>x1 : number
|
||||
>value : any
|
||||
|
||||
function fn1(x2: number) {
|
||||
>fn1 : (x2: number) => void
|
||||
>x2 : number
|
||||
|
||||
x2 **= value;
|
||||
>x2 **= value : number
|
||||
>x2 : number
|
||||
>value : any
|
||||
}
|
||||
|
||||
// property accesses
|
||||
var x3: { a: number };
|
||||
>x3 : { a: number; }
|
||||
>a : number
|
||||
|
||||
x3.a **= value;
|
||||
>x3.a **= value : number
|
||||
>x3.a : number
|
||||
>x3 : { a: number; }
|
||||
>a : number
|
||||
>value : any
|
||||
|
||||
x3['a'] **= value;
|
||||
>x3['a'] **= value : number
|
||||
>x3['a'] : number
|
||||
>x3 : { a: number; }
|
||||
>'a' : string
|
||||
>value : any
|
||||
|
||||
// parentheses, the contained expression is reference
|
||||
(x1) **= value;
|
||||
>(x1) **= value : number
|
||||
>(x1) : number
|
||||
>x1 : number
|
||||
>value : any
|
||||
|
||||
function fn2(x4: number) {
|
||||
>fn2 : (x4: number) => void
|
||||
>x4 : number
|
||||
|
||||
(x4) **= value;
|
||||
>(x4) **= value : number
|
||||
>(x4) : number
|
||||
>x4 : number
|
||||
>value : any
|
||||
}
|
||||
|
||||
(x3.a) **= value;
|
||||
>(x3.a) **= value : number
|
||||
>(x3.a) : number
|
||||
>x3.a : number
|
||||
>x3 : { a: number; }
|
||||
>a : number
|
||||
>value : any
|
||||
|
||||
(x3['a']) **= value;
|
||||
>(x3['a']) **= value : number
|
||||
>(x3['a']) : number
|
||||
>x3['a'] : number
|
||||
>x3 : { a: number; }
|
||||
>'a' : string
|
||||
>value : any
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(7,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(10,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(13,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(18,5): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(21,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(25,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(27,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(30,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(32,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(35,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(36,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(37,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(38,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(39,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(40,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(43,10): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(46,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(52,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(56,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(60,15): error TS1034: 'super' must be followed by an argument list or member access.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(65,21): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(66,11): error TS1005: ';' expected.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(69,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(72,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(73,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(74,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(75,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(76,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(77,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(78,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(79,1): error TS2364: Invalid left-hand side of assignment expression.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(80,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(81,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(82,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(83,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(84,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts(85,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es7/exponentiationOperator/compoundExponentiationAssignmentLHSIsValue.ts (37 errors) ====
|
||||
// expected error for all the LHS of compound assignments (arithmetic and addition)
|
||||
var value;
|
||||
|
||||
// this
|
||||
class C {
|
||||
constructor() {
|
||||
this **= value;
|
||||
~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
}
|
||||
foo() {
|
||||
this **= value;
|
||||
~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
}
|
||||
static sfoo() {
|
||||
this **= value;
|
||||
~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
}
|
||||
}
|
||||
|
||||
function foo() {
|
||||
this **= value;
|
||||
~~~~
|
||||
!!! error TS2364: Invalid left-hand side of assignment expression.
|
||||
}
|
||||
|
||||
this **= value;
|
||||
~~~~
|
||||
!!! error TS2364: Invalid left-hand side of assignment expression.
|
||||
|
||||
// identifiers: module, class, enum, function
|
||||
module M { export var a; }
|
||||
M **= value;
|
||||
~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
C **= value;
|
||||
~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
enum E { }
|
||||
E **= value;
|
||||
~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
foo **= value;
|
||||
~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
// literals
|
||||
null **= value;
|
||||
~~~~
|
||||
!!! error TS2364: Invalid left-hand side of assignment expression.
|
||||
true **= value;
|
||||
~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
false **= value;
|
||||
~~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
0 **= value;
|
||||
~
|
||||
!!! error TS2364: Invalid left-hand side of assignment expression.
|
||||
'' **= value;
|
||||
~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
/d+/ **= value;
|
||||
~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
// object literals
|
||||
{ a: 0 } **= value;
|
||||
~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
|
||||
// array literals
|
||||
['', ''] **= value;
|
||||
~~~~~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
// super
|
||||
class Derived extends C {
|
||||
constructor() {
|
||||
super();
|
||||
super **= value;
|
||||
~~~
|
||||
!!! error TS1034: 'super' must be followed by an argument list or member access.
|
||||
}
|
||||
|
||||
foo() {
|
||||
super **= value;
|
||||
~~~
|
||||
!!! error TS1034: 'super' must be followed by an argument list or member access.
|
||||
}
|
||||
|
||||
static sfoo() {
|
||||
super **= value;
|
||||
~~~
|
||||
!!! error TS1034: 'super' must be followed by an argument list or member access.
|
||||
}
|
||||
}
|
||||
|
||||
// function expression
|
||||
function bar1() { } **= value;
|
||||
~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
() => { } **= value;
|
||||
~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
|
||||
// function calls
|
||||
foo() **= value;
|
||||
~~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
|
||||
// parentheses, the containted expression is value
|
||||
(this) **= value;
|
||||
~~~~~~
|
||||
!!! error TS2364: Invalid left-hand side of assignment expression.
|
||||
(M) **= value;
|
||||
~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
(C) **= value;
|
||||
~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
(E) **= value;
|
||||
~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
(foo) **= value;
|
||||
~~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
(null) **= value;
|
||||
~~~~~~
|
||||
!!! error TS2364: Invalid left-hand side of assignment expression.
|
||||
(true) **= value;
|
||||
~~~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
(0) **= value;
|
||||
~~~
|
||||
!!! error TS2364: Invalid left-hand side of assignment expression.
|
||||
('') **= value;
|
||||
~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
(/d+/) **= value;
|
||||
~~~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
({}) **= value;
|
||||
~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
([]) **= value;
|
||||
~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
(function baz1() { }) **= value;
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
(foo()) **= value;
|
||||
~~~~~~~
|
||||
!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
||||
@@ -0,0 +1,177 @@
|
||||
//// [compoundExponentiationAssignmentLHSIsValue.ts]
|
||||
// expected error for all the LHS of compound assignments (arithmetic and addition)
|
||||
var value;
|
||||
|
||||
// this
|
||||
class C {
|
||||
constructor() {
|
||||
this **= value;
|
||||
}
|
||||
foo() {
|
||||
this **= value;
|
||||
}
|
||||
static sfoo() {
|
||||
this **= value;
|
||||
}
|
||||
}
|
||||
|
||||
function foo() {
|
||||
this **= value;
|
||||
}
|
||||
|
||||
this **= value;
|
||||
|
||||
// identifiers: module, class, enum, function
|
||||
module M { export var a; }
|
||||
M **= value;
|
||||
|
||||
C **= value;
|
||||
|
||||
enum E { }
|
||||
E **= value;
|
||||
|
||||
foo **= value;
|
||||
|
||||
// literals
|
||||
null **= value;
|
||||
true **= value;
|
||||
false **= value;
|
||||
0 **= value;
|
||||
'' **= value;
|
||||
/d+/ **= value;
|
||||
|
||||
// object literals
|
||||
{ a: 0 } **= value;
|
||||
|
||||
// array literals
|
||||
['', ''] **= value;
|
||||
|
||||
// super
|
||||
class Derived extends C {
|
||||
constructor() {
|
||||
super();
|
||||
super **= value;
|
||||
}
|
||||
|
||||
foo() {
|
||||
super **= value;
|
||||
}
|
||||
|
||||
static sfoo() {
|
||||
super **= value;
|
||||
}
|
||||
}
|
||||
|
||||
// function expression
|
||||
function bar1() { } **= value;
|
||||
() => { } **= value;
|
||||
|
||||
// function calls
|
||||
foo() **= value;
|
||||
|
||||
// parentheses, the containted expression is value
|
||||
(this) **= value;
|
||||
(M) **= value;
|
||||
(C) **= value;
|
||||
(E) **= value;
|
||||
(foo) **= value;
|
||||
(null) **= value;
|
||||
(true) **= value;
|
||||
(0) **= value;
|
||||
('') **= value;
|
||||
(/d+/) **= value;
|
||||
({}) **= value;
|
||||
([]) **= value;
|
||||
(function baz1() { }) **= value;
|
||||
(foo()) **= value;
|
||||
|
||||
//// [compoundExponentiationAssignmentLHSIsValue.js]
|
||||
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; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
// expected error for all the LHS of compound assignments (arithmetic and addition)
|
||||
var value;
|
||||
// this
|
||||
var C = (function () {
|
||||
function C() {
|
||||
this = Math.pow(this, value);
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
this = Math.pow(this, value);
|
||||
};
|
||||
C.sfoo = function () {
|
||||
this = Math.pow(this, value);
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
function foo() {
|
||||
this = Math.pow(this, value);
|
||||
}
|
||||
this = Math.pow(this, value);
|
||||
// identifiers: module, class, enum, function
|
||||
var M;
|
||||
(function (M) {
|
||||
})(M || (M = {}));
|
||||
M = Math.pow(M, value);
|
||||
C = Math.pow(C, value);
|
||||
var E;
|
||||
(function (E) {
|
||||
})(E || (E = {}));
|
||||
E = Math.pow(E, value);
|
||||
foo = Math.pow(foo, value);
|
||||
// literals
|
||||
null = Math.pow(null, value);
|
||||
true = Math.pow(true, value);
|
||||
false = Math.pow(false, value);
|
||||
0 = Math.pow(0, value);
|
||||
'' = Math.pow('', value);
|
||||
/d+/ = Math.pow(/d+/, value);
|
||||
// object literals
|
||||
{
|
||||
a: 0;
|
||||
}
|
||||
value;
|
||||
// array literals
|
||||
['', ''] = Math.pow(['', ''], value);
|
||||
// super
|
||||
var Derived = (function (_super) {
|
||||
__extends(Derived, _super);
|
||||
function Derived() {
|
||||
_super.call(this);
|
||||
(_a = _super.prototype, _a. = Math.pow(_a., value));
|
||||
var _a;
|
||||
}
|
||||
Derived.prototype.foo = function () {
|
||||
(_a = _super.prototype, _a. = Math.pow(_a., value));
|
||||
var _a;
|
||||
};
|
||||
Derived.sfoo = function () {
|
||||
(_a = _super, _a. = Math.pow(_a., value));
|
||||
var _a;
|
||||
};
|
||||
return Derived;
|
||||
})(C);
|
||||
// function expression
|
||||
function bar1() { }
|
||||
value;
|
||||
(function () { });
|
||||
value;
|
||||
// function calls
|
||||
foo() = Math.pow(foo(), value);
|
||||
// parentheses, the containted expression is value
|
||||
(this) = Math.pow((this), value);
|
||||
(M) = Math.pow((M), value);
|
||||
(C) = Math.pow((C), value);
|
||||
(E) = Math.pow((E), value);
|
||||
(foo) = Math.pow((foo), value);
|
||||
(null) = Math.pow((null), value);
|
||||
(true) = Math.pow((true), value);
|
||||
(0) = Math.pow((0), value);
|
||||
('') = Math.pow((''), value);
|
||||
(/d+/) = Math.pow((/d+/), value);
|
||||
({}) = Math.pow(({}), value);
|
||||
([]) = Math.pow(([]), value);
|
||||
(function baz1() { }) = Math.pow((function baz1() { }), value);
|
||||
(foo()) = Math.pow((foo()), value);
|
||||
@@ -1,11 +0,0 @@
|
||||
tests/cases/compiler/file1.ts(2,1): error TS2448: Block-scoped variable 'c' used before its declaration.
|
||||
|
||||
|
||||
==== tests/cases/compiler/file1.ts (1 errors) ====
|
||||
|
||||
c;
|
||||
~
|
||||
!!! error TS2448: Block-scoped variable 'c' used before its declaration.
|
||||
|
||||
==== tests/cases/compiler/file2.ts (0 errors) ====
|
||||
const c = 0;
|
||||
@@ -0,0 +1,9 @@
|
||||
=== tests/cases/compiler/file1.ts ===
|
||||
|
||||
c;
|
||||
>c : Symbol(c, Decl(file2.ts, 0, 5))
|
||||
|
||||
=== tests/cases/compiler/file2.ts ===
|
||||
const c = 0;
|
||||
>c : Symbol(c, Decl(file2.ts, 0, 5))
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/file1.ts ===
|
||||
|
||||
c;
|
||||
>c : number
|
||||
|
||||
=== tests/cases/compiler/file2.ts ===
|
||||
const c = 0;
|
||||
>c : number
|
||||
>0 : number
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
//// [constIndexedAccess.ts]
|
||||
|
||||
const enum numbers {
|
||||
zero,
|
||||
one
|
||||
}
|
||||
|
||||
interface indexAccess {
|
||||
0: string;
|
||||
1: number;
|
||||
}
|
||||
|
||||
let test: indexAccess;
|
||||
|
||||
let s = test[0];
|
||||
let n = test[1];
|
||||
|
||||
let s1 = test[numbers.zero];
|
||||
let n1 = test[numbers.one];
|
||||
|
||||
let s2 = test[numbers["zero"]];
|
||||
let n2 = test[numbers["one"]];
|
||||
|
||||
enum numbersNotConst {
|
||||
zero,
|
||||
one
|
||||
}
|
||||
|
||||
let s3 = test[numbersNotConst.zero];
|
||||
let n3 = test[numbersNotConst.one];
|
||||
|
||||
|
||||
//// [constIndexedAccess.js]
|
||||
var test;
|
||||
var s = test[0];
|
||||
var n = test[1];
|
||||
var s1 = test[0 /* zero */];
|
||||
var n1 = test[1 /* one */];
|
||||
var s2 = test[0 /* "zero" */];
|
||||
var n2 = test[1 /* "one" */];
|
||||
var numbersNotConst;
|
||||
(function (numbersNotConst) {
|
||||
numbersNotConst[numbersNotConst["zero"] = 0] = "zero";
|
||||
numbersNotConst[numbersNotConst["one"] = 1] = "one";
|
||||
})(numbersNotConst || (numbersNotConst = {}));
|
||||
var s3 = test[numbersNotConst.zero];
|
||||
var n3 = test[numbersNotConst.one];
|
||||
@@ -0,0 +1,83 @@
|
||||
=== tests/cases/compiler/constIndexedAccess.ts ===
|
||||
|
||||
const enum numbers {
|
||||
>numbers : Symbol(numbers, Decl(constIndexedAccess.ts, 0, 0))
|
||||
|
||||
zero,
|
||||
>zero : Symbol(numbers.zero, Decl(constIndexedAccess.ts, 1, 20))
|
||||
|
||||
one
|
||||
>one : Symbol(numbers.one, Decl(constIndexedAccess.ts, 2, 9))
|
||||
}
|
||||
|
||||
interface indexAccess {
|
||||
>indexAccess : Symbol(indexAccess, Decl(constIndexedAccess.ts, 4, 1))
|
||||
|
||||
0: string;
|
||||
1: number;
|
||||
}
|
||||
|
||||
let test: indexAccess;
|
||||
>test : Symbol(test, Decl(constIndexedAccess.ts, 11, 3))
|
||||
>indexAccess : Symbol(indexAccess, Decl(constIndexedAccess.ts, 4, 1))
|
||||
|
||||
let s = test[0];
|
||||
>s : Symbol(s, Decl(constIndexedAccess.ts, 13, 3))
|
||||
>test : Symbol(test, Decl(constIndexedAccess.ts, 11, 3))
|
||||
>0 : Symbol(indexAccess.0, Decl(constIndexedAccess.ts, 6, 23))
|
||||
|
||||
let n = test[1];
|
||||
>n : Symbol(n, Decl(constIndexedAccess.ts, 14, 3))
|
||||
>test : Symbol(test, Decl(constIndexedAccess.ts, 11, 3))
|
||||
>1 : Symbol(indexAccess.1, Decl(constIndexedAccess.ts, 7, 14))
|
||||
|
||||
let s1 = test[numbers.zero];
|
||||
>s1 : Symbol(s1, Decl(constIndexedAccess.ts, 16, 3))
|
||||
>test : Symbol(test, Decl(constIndexedAccess.ts, 11, 3))
|
||||
>numbers.zero : Symbol(numbers.zero, Decl(constIndexedAccess.ts, 1, 20))
|
||||
>numbers : Symbol(numbers, Decl(constIndexedAccess.ts, 0, 0))
|
||||
>zero : Symbol(numbers.zero, Decl(constIndexedAccess.ts, 1, 20))
|
||||
|
||||
let n1 = test[numbers.one];
|
||||
>n1 : Symbol(n1, Decl(constIndexedAccess.ts, 17, 3))
|
||||
>test : Symbol(test, Decl(constIndexedAccess.ts, 11, 3))
|
||||
>numbers.one : Symbol(numbers.one, Decl(constIndexedAccess.ts, 2, 9))
|
||||
>numbers : Symbol(numbers, Decl(constIndexedAccess.ts, 0, 0))
|
||||
>one : Symbol(numbers.one, Decl(constIndexedAccess.ts, 2, 9))
|
||||
|
||||
let s2 = test[numbers["zero"]];
|
||||
>s2 : Symbol(s2, Decl(constIndexedAccess.ts, 19, 3))
|
||||
>test : Symbol(test, Decl(constIndexedAccess.ts, 11, 3))
|
||||
>numbers : Symbol(numbers, Decl(constIndexedAccess.ts, 0, 0))
|
||||
>"zero" : Symbol(numbers.zero, Decl(constIndexedAccess.ts, 1, 20))
|
||||
|
||||
let n2 = test[numbers["one"]];
|
||||
>n2 : Symbol(n2, Decl(constIndexedAccess.ts, 20, 3))
|
||||
>test : Symbol(test, Decl(constIndexedAccess.ts, 11, 3))
|
||||
>numbers : Symbol(numbers, Decl(constIndexedAccess.ts, 0, 0))
|
||||
>"one" : Symbol(numbers.one, Decl(constIndexedAccess.ts, 2, 9))
|
||||
|
||||
enum numbersNotConst {
|
||||
>numbersNotConst : Symbol(numbersNotConst, Decl(constIndexedAccess.ts, 20, 30))
|
||||
|
||||
zero,
|
||||
>zero : Symbol(numbersNotConst.zero, Decl(constIndexedAccess.ts, 22, 22))
|
||||
|
||||
one
|
||||
>one : Symbol(numbersNotConst.one, Decl(constIndexedAccess.ts, 23, 9))
|
||||
}
|
||||
|
||||
let s3 = test[numbersNotConst.zero];
|
||||
>s3 : Symbol(s3, Decl(constIndexedAccess.ts, 27, 3))
|
||||
>test : Symbol(test, Decl(constIndexedAccess.ts, 11, 3))
|
||||
>numbersNotConst.zero : Symbol(numbersNotConst.zero, Decl(constIndexedAccess.ts, 22, 22))
|
||||
>numbersNotConst : Symbol(numbersNotConst, Decl(constIndexedAccess.ts, 20, 30))
|
||||
>zero : Symbol(numbersNotConst.zero, Decl(constIndexedAccess.ts, 22, 22))
|
||||
|
||||
let n3 = test[numbersNotConst.one];
|
||||
>n3 : Symbol(n3, Decl(constIndexedAccess.ts, 28, 3))
|
||||
>test : Symbol(test, Decl(constIndexedAccess.ts, 11, 3))
|
||||
>numbersNotConst.one : Symbol(numbersNotConst.one, Decl(constIndexedAccess.ts, 23, 9))
|
||||
>numbersNotConst : Symbol(numbersNotConst, Decl(constIndexedAccess.ts, 20, 30))
|
||||
>one : Symbol(numbersNotConst.one, Decl(constIndexedAccess.ts, 23, 9))
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
=== tests/cases/compiler/constIndexedAccess.ts ===
|
||||
|
||||
const enum numbers {
|
||||
>numbers : numbers
|
||||
|
||||
zero,
|
||||
>zero : numbers
|
||||
|
||||
one
|
||||
>one : numbers
|
||||
}
|
||||
|
||||
interface indexAccess {
|
||||
>indexAccess : indexAccess
|
||||
|
||||
0: string;
|
||||
1: number;
|
||||
}
|
||||
|
||||
let test: indexAccess;
|
||||
>test : indexAccess
|
||||
>indexAccess : indexAccess
|
||||
|
||||
let s = test[0];
|
||||
>s : string
|
||||
>test[0] : string
|
||||
>test : indexAccess
|
||||
>0 : number
|
||||
|
||||
let n = test[1];
|
||||
>n : number
|
||||
>test[1] : number
|
||||
>test : indexAccess
|
||||
>1 : number
|
||||
|
||||
let s1 = test[numbers.zero];
|
||||
>s1 : string
|
||||
>test[numbers.zero] : string
|
||||
>test : indexAccess
|
||||
>numbers.zero : numbers
|
||||
>numbers : typeof numbers
|
||||
>zero : numbers
|
||||
|
||||
let n1 = test[numbers.one];
|
||||
>n1 : number
|
||||
>test[numbers.one] : number
|
||||
>test : indexAccess
|
||||
>numbers.one : numbers
|
||||
>numbers : typeof numbers
|
||||
>one : numbers
|
||||
|
||||
let s2 = test[numbers["zero"]];
|
||||
>s2 : string
|
||||
>test[numbers["zero"]] : string
|
||||
>test : indexAccess
|
||||
>numbers["zero"] : numbers
|
||||
>numbers : typeof numbers
|
||||
>"zero" : string
|
||||
|
||||
let n2 = test[numbers["one"]];
|
||||
>n2 : number
|
||||
>test[numbers["one"]] : number
|
||||
>test : indexAccess
|
||||
>numbers["one"] : numbers
|
||||
>numbers : typeof numbers
|
||||
>"one" : string
|
||||
|
||||
enum numbersNotConst {
|
||||
>numbersNotConst : numbersNotConst
|
||||
|
||||
zero,
|
||||
>zero : numbersNotConst
|
||||
|
||||
one
|
||||
>one : numbersNotConst
|
||||
}
|
||||
|
||||
let s3 = test[numbersNotConst.zero];
|
||||
>s3 : any
|
||||
>test[numbersNotConst.zero] : any
|
||||
>test : indexAccess
|
||||
>numbersNotConst.zero : numbersNotConst
|
||||
>numbersNotConst : typeof numbersNotConst
|
||||
>zero : numbersNotConst
|
||||
|
||||
let n3 = test[numbersNotConst.one];
|
||||
>n3 : any
|
||||
>test[numbersNotConst.one] : any
|
||||
>test : indexAccess
|
||||
>numbersNotConst.one : numbersNotConst
|
||||
>numbersNotConst : typeof numbersNotConst
|
||||
>one : numbersNotConst
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
tests/cases/compiler/declInput.ts(1,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/declInput.ts(5,7): error TS2518: Only an ambient class can be merged with an interface.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declInput.ts (2 errors) ====
|
||||
interface bar {
|
||||
~~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
|
||||
}
|
||||
|
||||
class bar {
|
||||
~~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
public f() { return ''; }
|
||||
public g() { return {a: <bar>null, b: undefined, c: void 4 }; }
|
||||
public h(x = 4, y = null, z = '') { x++; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
=== tests/cases/compiler/declInput.ts ===
|
||||
interface bar {
|
||||
>bar : Symbol(bar, Decl(declInput.ts, 0, 0), Decl(declInput.ts, 2, 1))
|
||||
|
||||
}
|
||||
|
||||
class bar {
|
||||
>bar : Symbol(bar, Decl(declInput.ts, 0, 0), Decl(declInput.ts, 2, 1))
|
||||
|
||||
public f() { return ''; }
|
||||
>f : Symbol(f, Decl(declInput.ts, 4, 11))
|
||||
|
||||
public g() { return {a: <bar>null, b: undefined, c: void 4 }; }
|
||||
>g : Symbol(g, Decl(declInput.ts, 5, 27))
|
||||
>a : Symbol(a, Decl(declInput.ts, 6, 23))
|
||||
>bar : Symbol(bar, Decl(declInput.ts, 0, 0), Decl(declInput.ts, 2, 1))
|
||||
>b : Symbol(b, Decl(declInput.ts, 6, 36))
|
||||
>undefined : Symbol(undefined)
|
||||
>c : Symbol(c, Decl(declInput.ts, 6, 50))
|
||||
|
||||
public h(x = 4, y = null, z = '') { x++; }
|
||||
>h : Symbol(h, Decl(declInput.ts, 6, 65))
|
||||
>x : Symbol(x, Decl(declInput.ts, 7, 11))
|
||||
>y : Symbol(y, Decl(declInput.ts, 7, 17))
|
||||
>z : Symbol(z, Decl(declInput.ts, 7, 27))
|
||||
>x : Symbol(x, Decl(declInput.ts, 7, 11))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
=== tests/cases/compiler/declInput.ts ===
|
||||
interface bar {
|
||||
>bar : bar
|
||||
|
||||
}
|
||||
|
||||
class bar {
|
||||
>bar : bar
|
||||
|
||||
public f() { return ''; }
|
||||
>f : () => string
|
||||
>'' : string
|
||||
|
||||
public g() { return {a: <bar>null, b: undefined, c: void 4 }; }
|
||||
>g : () => { a: bar; b: any; c: any; }
|
||||
>{a: <bar>null, b: undefined, c: void 4 } : { a: bar; b: undefined; c: undefined; }
|
||||
>a : bar
|
||||
><bar>null : bar
|
||||
>bar : bar
|
||||
>null : null
|
||||
>b : undefined
|
||||
>undefined : undefined
|
||||
>c : undefined
|
||||
>void 4 : undefined
|
||||
>4 : number
|
||||
|
||||
public h(x = 4, y = null, z = '') { x++; }
|
||||
>h : (x?: number, y?: any, z?: string) => void
|
||||
>x : number
|
||||
>4 : number
|
||||
>y : any
|
||||
>null : null
|
||||
>z : string
|
||||
>'' : string
|
||||
>x++ : number
|
||||
>x : number
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
tests/cases/conformance/decorators/decoratorCallGeneric.ts(7,2): error TS1238: Unable to resolve signature of class decorator when called as an expression.
|
||||
The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'void'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/decoratorCallGeneric.ts (1 errors) ====
|
||||
interface I<T> {
|
||||
prototype: T,
|
||||
m: () => T
|
||||
}
|
||||
function dec<T>(c: I<T>) { }
|
||||
|
||||
@dec
|
||||
~~~
|
||||
!!! error TS1238: Unable to resolve signature of class decorator when called as an expression.
|
||||
!!! error TS1238: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
||||
!!! error TS1238: Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'void'.
|
||||
class C {
|
||||
_brand: any;
|
||||
static m() {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
//// [decoratorCallGeneric.ts]
|
||||
interface I<T> {
|
||||
prototype: T,
|
||||
m: () => T
|
||||
}
|
||||
function dec<T>(c: I<T>) { }
|
||||
|
||||
@dec
|
||||
class C {
|
||||
_brand: any;
|
||||
static m() {}
|
||||
}
|
||||
|
||||
|
||||
//// [decoratorCallGeneric.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
function dec(c) { }
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.m = function () { };
|
||||
C = __decorate([
|
||||
dec
|
||||
], C);
|
||||
return C;
|
||||
})();
|
||||
+37
-19
@@ -36,15 +36,21 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(60,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(63,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(65,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(67,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(68,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(70,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(71,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(72,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(67,7): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(67,9): error TS1109: Expression expected.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(68,7): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(68,9): error TS1109: Expression expected.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,7): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,9): error TS1109: Expression expected.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(70,10): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(70,12): error TS1109: Expression expected.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(71,10): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(71,12): error TS1109: Expression expected.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(72,10): error TS1005: ';' expected.
|
||||
tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts(72,12): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts (44 errors) ====
|
||||
==== tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOperatorWithAnyOtherTypeInvalidOperations.ts (50 errors) ====
|
||||
// -- operator on any type
|
||||
var ANY1;
|
||||
var ANY2: any[] = ["", ""];
|
||||
@@ -188,20 +194,32 @@ tests/cases/conformance/expressions/unaryOperators/decrementOperator/decrementOp
|
||||
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
|
||||
--ANY1--;
|
||||
~~~~~~
|
||||
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
--ANY1++;
|
||||
~~~~~~
|
||||
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
++ANY1--;
|
||||
~~~~~~
|
||||
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
--ANY2[0]--;
|
||||
~~~~~~~~~
|
||||
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
--ANY2[0]++;
|
||||
~~~~~~~~~
|
||||
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
++ANY2[0]--;
|
||||
~~~~~~~~~
|
||||
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
||||
~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
@@ -131,9 +131,15 @@ var ResultIsNumber30 = obj1.y--;
|
||||
// miss assignment operators
|
||||
--ANY2;
|
||||
ANY2--;
|
||||
--ANY1--;
|
||||
--ANY1++;
|
||||
++ANY1--;
|
||||
--ANY2[0]--;
|
||||
--ANY2[0]++;
|
||||
++ANY2[0]--;
|
||||
--ANY1;
|
||||
--;
|
||||
--ANY1;
|
||||
++;
|
||||
++ANY1;
|
||||
--;
|
||||
--ANY2[0];
|
||||
--;
|
||||
--ANY2[0];
|
||||
++;
|
||||
++ANY2[0];
|
||||
--;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [defaultExportWithOverloads01.ts]
|
||||
|
||||
export default function f();
|
||||
export default function f(x: string);
|
||||
export default function f(...args: any[]) {
|
||||
}
|
||||
|
||||
//// [defaultExportWithOverloads01.js]
|
||||
function f() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i - 0] = arguments[_i];
|
||||
}
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = f;
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/es6/modules/defaultExportWithOverloads01.ts ===
|
||||
|
||||
export default function f();
|
||||
>f : Symbol(f, Decl(defaultExportWithOverloads01.ts, 0, 0), Decl(defaultExportWithOverloads01.ts, 1, 28), Decl(defaultExportWithOverloads01.ts, 2, 37))
|
||||
|
||||
export default function f(x: string);
|
||||
>f : Symbol(f, Decl(defaultExportWithOverloads01.ts, 0, 0), Decl(defaultExportWithOverloads01.ts, 1, 28), Decl(defaultExportWithOverloads01.ts, 2, 37))
|
||||
>x : Symbol(x, Decl(defaultExportWithOverloads01.ts, 2, 26))
|
||||
|
||||
export default function f(...args: any[]) {
|
||||
>f : Symbol(f, Decl(defaultExportWithOverloads01.ts, 0, 0), Decl(defaultExportWithOverloads01.ts, 1, 28), Decl(defaultExportWithOverloads01.ts, 2, 37))
|
||||
>args : Symbol(args, Decl(defaultExportWithOverloads01.ts, 3, 26))
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/es6/modules/defaultExportWithOverloads01.ts ===
|
||||
|
||||
export default function f();
|
||||
>f : { (): any; (x: string): any; }
|
||||
|
||||
export default function f(x: string);
|
||||
>f : { (): any; (x: string): any; }
|
||||
>x : string
|
||||
|
||||
export default function f(...args: any[]) {
|
||||
>f : { (): any; (x: string): any; }
|
||||
>args : any[]
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
tests/cases/conformance/es6/modules/m1.ts(2,22): error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
tests/cases/conformance/es6/modules/m1.ts(5,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/conformance/es6/modules/m1.ts(5,11): error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
tests/cases/conformance/es6/modules/m2.ts(1,20): error TS2307: Cannot find module 'm1'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/modules/m1.ts (3 errors) ====
|
||||
==== tests/cases/conformance/es6/modules/m1.ts (2 errors) ====
|
||||
|
||||
export default class Decl {
|
||||
~~~~
|
||||
@@ -13,8 +12,6 @@ tests/cases/conformance/es6/modules/m2.ts(1,20): error TS2307: Cannot find modul
|
||||
|
||||
interface Decl {
|
||||
~~~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
~~~~
|
||||
!!! error TS2652: Merged declaration 'Decl' cannot include a default export declaration. Consider adding a separate 'export default Decl' declaration instead.
|
||||
p1: number;
|
||||
p2: number;
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(2,22): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(5,18): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(9,21): error TS2300: Duplicate identifier 'f'.
|
||||
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(12,18): error TS2300: Duplicate identifier 'f'.
|
||||
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(37,12): error TS2300: Duplicate identifier 'x'.
|
||||
tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts(41,16): error TS2300: Duplicate identifier 'x'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts (6 errors) ====
|
||||
==== tests/cases/compiler/duplicateIdentifiersAcrossContainerBoundaries.ts (4 errors) ====
|
||||
module M {
|
||||
export interface I { }
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
}
|
||||
module M {
|
||||
export class I { } // error
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
export class I { }
|
||||
}
|
||||
|
||||
module M {
|
||||
|
||||
@@ -3,7 +3,7 @@ module M {
|
||||
export interface I { }
|
||||
}
|
||||
module M {
|
||||
export class I { } // error
|
||||
export class I { }
|
||||
}
|
||||
|
||||
module M {
|
||||
@@ -60,7 +60,7 @@ var M;
|
||||
}
|
||||
return I;
|
||||
})();
|
||||
M.I = I; // error
|
||||
M.I = I;
|
||||
})(M || (M = {}));
|
||||
var M;
|
||||
(function (M) {
|
||||
|
||||
@@ -1,24 +1,16 @@
|
||||
tests/cases/compiler/file1.ts(2,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/file1.ts(3,7): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/file1.ts(4,7): error TS2300: Duplicate identifier 'C2'.
|
||||
tests/cases/compiler/file1.ts(5,10): error TS2300: Duplicate identifier 'f'.
|
||||
tests/cases/compiler/file1.ts(9,12): error TS2300: Duplicate identifier 'x'.
|
||||
tests/cases/compiler/file2.ts(1,7): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/file2.ts(2,11): error TS2518: Only an ambient class can be merged with an interface.
|
||||
tests/cases/compiler/file2.ts(3,10): error TS2300: Duplicate identifier 'C2'.
|
||||
tests/cases/compiler/file2.ts(4,7): error TS2300: Duplicate identifier 'f'.
|
||||
tests/cases/compiler/file2.ts(7,8): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
|
||||
tests/cases/compiler/file2.ts(8,16): error TS2300: Duplicate identifier 'x'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/file1.ts (5 errors) ====
|
||||
==== tests/cases/compiler/file1.ts (3 errors) ====
|
||||
|
||||
interface I { }
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
class C1 { }
|
||||
~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
class C2 { }
|
||||
~~
|
||||
!!! error TS2300: Duplicate identifier 'C2'.
|
||||
@@ -39,13 +31,9 @@ tests/cases/compiler/file2.ts(8,16): error TS2300: Duplicate identifier 'x'.
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/file2.ts (6 errors) ====
|
||||
==== tests/cases/compiler/file2.ts (4 errors) ====
|
||||
class I { } // error -- cannot merge interface with non-ambient class
|
||||
~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
interface C1 { } // error -- cannot merge interface with non-ambient class
|
||||
~~
|
||||
!!! error TS2518: Only an ambient class can be merged with an interface.
|
||||
function C2() { } // error -- cannot merge function with non-ambient class
|
||||
~~
|
||||
!!! error TS2300: Duplicate identifier 'C2'.
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//// [emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts]
|
||||
|
||||
var array0 = [1, 2, 3]
|
||||
var i0 = 0;
|
||||
array0[++i0] **= 2;
|
||||
|
||||
var array1 = [1, 2, 3]
|
||||
var i1 = 0;
|
||||
array1[++i1] **= array1[++i1] **= 2;
|
||||
|
||||
var array2 = [1, 2, 3]
|
||||
var i2 = 0;
|
||||
array2[++i2] **= array2[++i2] ** 2;
|
||||
|
||||
var array3 = [2, 2, 3];
|
||||
var j0 = 0, j1 = 1;
|
||||
array3[j0++] **= array3[j1++] **= array3[j0++] **= 1;
|
||||
|
||||
//// [emitCompoundExponentiationAssignmentWithIndexingOnLHS1.js]
|
||||
var array0 = [1, 2, 3];
|
||||
var i0 = 0;
|
||||
(_a = array0, _i = ++i0, _a[_i] = Math.pow(_a[_i], 2));
|
||||
var array1 = [1, 2, 3];
|
||||
var i1 = 0;
|
||||
(_b = array1, _c = ++i1, _b[_c] = Math.pow(_b[_c], (_d = array1, _e = ++i1, _d[_e] = Math.pow(_d[_e], 2))));
|
||||
var array2 = [1, 2, 3];
|
||||
var i2 = 0;
|
||||
(_f = array2, _g = ++i2, _f[_g] = Math.pow(_f[_g], Math.pow(array2[++i2], 2)));
|
||||
var array3 = [2, 2, 3];
|
||||
var j0 = 0, j1 = 1;
|
||||
(_h = array3, _j = j0++, _h[_j] = Math.pow(_h[_j], (_k = array3, _l = j1++, _k[_l] = Math.pow(_k[_l], (_m = array3, _o = j0++, _m[_o] = Math.pow(_m[_o], 1))))));
|
||||
var _a, _i, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
=== tests/cases/conformance/es7/exponentiationOperator/emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts ===
|
||||
|
||||
var array0 = [1, 2, 3]
|
||||
>array0 : Symbol(array0, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 1, 3))
|
||||
|
||||
var i0 = 0;
|
||||
>i0 : Symbol(i0, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 2, 3))
|
||||
|
||||
array0[++i0] **= 2;
|
||||
>array0 : Symbol(array0, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 1, 3))
|
||||
>i0 : Symbol(i0, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 2, 3))
|
||||
|
||||
var array1 = [1, 2, 3]
|
||||
>array1 : Symbol(array1, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 5, 3))
|
||||
|
||||
var i1 = 0;
|
||||
>i1 : Symbol(i1, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 6, 3))
|
||||
|
||||
array1[++i1] **= array1[++i1] **= 2;
|
||||
>array1 : Symbol(array1, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 5, 3))
|
||||
>i1 : Symbol(i1, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 6, 3))
|
||||
>array1 : Symbol(array1, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 5, 3))
|
||||
>i1 : Symbol(i1, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 6, 3))
|
||||
|
||||
var array2 = [1, 2, 3]
|
||||
>array2 : Symbol(array2, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 9, 3))
|
||||
|
||||
var i2 = 0;
|
||||
>i2 : Symbol(i2, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 10, 3))
|
||||
|
||||
array2[++i2] **= array2[++i2] ** 2;
|
||||
>array2 : Symbol(array2, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 9, 3))
|
||||
>i2 : Symbol(i2, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 10, 3))
|
||||
>array2 : Symbol(array2, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 9, 3))
|
||||
>i2 : Symbol(i2, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 10, 3))
|
||||
|
||||
var array3 = [2, 2, 3];
|
||||
>array3 : Symbol(array3, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 13, 3))
|
||||
|
||||
var j0 = 0, j1 = 1;
|
||||
>j0 : Symbol(j0, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 14, 3))
|
||||
>j1 : Symbol(j1, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 14, 11))
|
||||
|
||||
array3[j0++] **= array3[j1++] **= array3[j0++] **= 1;
|
||||
>array3 : Symbol(array3, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 13, 3))
|
||||
>j0 : Symbol(j0, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 14, 3))
|
||||
>array3 : Symbol(array3, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 13, 3))
|
||||
>j1 : Symbol(j1, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 14, 11))
|
||||
>array3 : Symbol(array3, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 13, 3))
|
||||
>j0 : Symbol(j0, Decl(emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts, 14, 3))
|
||||
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
=== tests/cases/conformance/es7/exponentiationOperator/emitCompoundExponentiationAssignmentWithIndexingOnLHS1.ts ===
|
||||
|
||||
var array0 = [1, 2, 3]
|
||||
>array0 : number[]
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
var i0 = 0;
|
||||
>i0 : number
|
||||
>0 : number
|
||||
|
||||
array0[++i0] **= 2;
|
||||
>array0[++i0] **= 2 : number
|
||||
>array0[++i0] : number
|
||||
>array0 : number[]
|
||||
>++i0 : number
|
||||
>i0 : number
|
||||
>2 : number
|
||||
|
||||
var array1 = [1, 2, 3]
|
||||
>array1 : number[]
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
var i1 = 0;
|
||||
>i1 : number
|
||||
>0 : number
|
||||
|
||||
array1[++i1] **= array1[++i1] **= 2;
|
||||
>array1[++i1] **= array1[++i1] **= 2 : number
|
||||
>array1[++i1] : number
|
||||
>array1 : number[]
|
||||
>++i1 : number
|
||||
>i1 : number
|
||||
>array1[++i1] **= 2 : number
|
||||
>array1[++i1] : number
|
||||
>array1 : number[]
|
||||
>++i1 : number
|
||||
>i1 : number
|
||||
>2 : number
|
||||
|
||||
var array2 = [1, 2, 3]
|
||||
>array2 : number[]
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
var i2 = 0;
|
||||
>i2 : number
|
||||
>0 : number
|
||||
|
||||
array2[++i2] **= array2[++i2] ** 2;
|
||||
>array2[++i2] **= array2[++i2] ** 2 : number
|
||||
>array2[++i2] : number
|
||||
>array2 : number[]
|
||||
>++i2 : number
|
||||
>i2 : number
|
||||
>array2[++i2] ** 2 : number
|
||||
>array2[++i2] : number
|
||||
>array2 : number[]
|
||||
>++i2 : number
|
||||
>i2 : number
|
||||
>2 : number
|
||||
|
||||
var array3 = [2, 2, 3];
|
||||
>array3 : number[]
|
||||
>[2, 2, 3] : number[]
|
||||
>2 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
var j0 = 0, j1 = 1;
|
||||
>j0 : number
|
||||
>0 : number
|
||||
>j1 : number
|
||||
>1 : number
|
||||
|
||||
array3[j0++] **= array3[j1++] **= array3[j0++] **= 1;
|
||||
>array3[j0++] **= array3[j1++] **= array3[j0++] **= 1 : number
|
||||
>array3[j0++] : number
|
||||
>array3 : number[]
|
||||
>j0++ : number
|
||||
>j0 : number
|
||||
>array3[j1++] **= array3[j0++] **= 1 : number
|
||||
>array3[j1++] : number
|
||||
>array3 : number[]
|
||||
>j1++ : number
|
||||
>j1 : number
|
||||
>array3[j0++] **= 1 : number
|
||||
>array3[j0++] : number
|
||||
>array3 : number[]
|
||||
>j0++ : number
|
||||
>j0 : number
|
||||
>1 : number
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [emitCompoundExponentiationAssignmentWithIndexingOnLHS2.ts]
|
||||
var globalCounter = 0;
|
||||
function foo() {
|
||||
globalCounter += 1;
|
||||
return { 0: 2 };
|
||||
}
|
||||
foo()[0] **= foo()[0];
|
||||
var result_foo1 = foo()[0] **= foo()[0];
|
||||
foo()[0] **= foo()[0] **= 2;
|
||||
var result_foo2 = foo()[0] **= foo()[0] **= 2;
|
||||
foo()[0] **= foo()[0] ** 2;
|
||||
var result_foo3 = foo()[0] **= foo()[0] ** 2;
|
||||
|
||||
//// [emitCompoundExponentiationAssignmentWithIndexingOnLHS2.js]
|
||||
var globalCounter = 0;
|
||||
function foo() {
|
||||
globalCounter += 1;
|
||||
return { 0: 2 };
|
||||
}
|
||||
(_a = foo(), _a[0] = Math.pow(_a[0], foo()[0]));
|
||||
var result_foo1 = (_b = foo(), _b[0] = Math.pow(_b[0], foo()[0]));
|
||||
(_c = foo(), _c[0] = Math.pow(_c[0], (_d = foo(), _d[0] = Math.pow(_d[0], 2))));
|
||||
var result_foo2 = (_e = foo(), _e[0] = Math.pow(_e[0], (_f = foo(), _f[0] = Math.pow(_f[0], 2))));
|
||||
(_g = foo(), _g[0] = Math.pow(_g[0], Math.pow(foo()[0], 2)));
|
||||
var result_foo3 = (_h = foo(), _h[0] = Math.pow(_h[0], Math.pow(foo()[0], 2)));
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user