Skip to content

Commit 8e096d5

Browse files
committed
Merge branch 'master' into emitterNameRewriting
Conflicts: src/compiler/types.ts
2 parents 7b67ac2 + acda704 commit 8e096d5

File tree

429 files changed

+17932
-6386
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

429 files changed

+17932
-6386
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
*.js linguist-language=TypeScript
1+
*.js linguist-language=TypeScript
2+
* -text

CONTRIBUTING.md

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,44 +31,75 @@ Your pull request should:
3131
## Running the Tests
3232
To run all tests, invoke the runtests target using jake:
3333

34-
`jake runtests`
34+
```Shell
35+
jake runtests
36+
```
3537

3638
This run will all tests; to run only a specific subset of tests, use:
3739

38-
`jake runtests tests=<regex>`
40+
```Shell
41+
jake runtests tests=<regex>
42+
```
3943

4044
e.g. to run all compiler baseline tests:
4145

42-
`jake runtests tests=compiler`
46+
```Shell
47+
jake runtests tests=compiler
48+
```
4349

44-
or to run specifc test:tests\cases\compiler\2dArrays.ts
50+
or to run specifc test: `tests\cases\compiler\2dArrays.ts`
4551

46-
`jake runtests tests=2dArrays`
52+
```Shell
53+
jake runtests tests=2dArrays
54+
```
4755

4856
## Adding a Test
49-
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.
57+
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.
5058

51-
These files support metadata tags in the format // @name: value . The supported names and values are:
59+
These files support metadata tags in the format `// @metaDataName: value`. The supported names and values are:
5260

53-
* comments, sourcemap, noimplicitany, declaration: true or false (corresponds to the compiler command-line options of the same name)
54-
* target: ES3 or ES5 (same as compiler)
55-
* out, outDir: path (same as compiler)
56-
* module: local, commonjs, or amd (local corresponds to not passing any compiler --module flag)
61+
* `comments`, `sourcemap`, `noimplicitany`, `declaration`: true or false (corresponds to the compiler command-line options of the same name)
62+
* `target`: ES3 or ES5 (same as compiler)
63+
* `out`, outDir: path (same as compiler)
64+
* `module`: local, commonjs, or amd (local corresponds to not passing any compiler --module flag)
65+
* `fileName`: path
66+
* 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.
5767

58-
**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.
68+
**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.
5969
**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.
6070

71+
### Tests for multiple files
72+
73+
When one needs to test for scenarios which require multiple files, it is useful to use the `fileName` metadata tag as such:
74+
75+
```TypeScript
76+
// @fileName: file1.ts
77+
export function f() {
78+
}
79+
80+
// @fileName: file2.ts
81+
import { f as g } from "file1";
82+
83+
var x = g();
84+
```
85+
86+
One can also write a project test, but it is slightly more involved.
87+
6188
## Managing the Baselines
62-
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.
89+
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.
6390

6491
When a change in the baselines is detected, the test will fail. To inspect changes vs the expected baselines, use
6592

66-
`jake diff`
93+
```Shell
94+
jake diff
95+
```
6796

6897
After verifying that the changes in the baselines are correct, run
6998

70-
`jake baseline-accept`
99+
```Shell
100+
jake baseline-accept
101+
```
71102

72-
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.
103+
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.
73104

74105
**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.

Jakefile.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ var harnessSources = [
129129
"services/preProcessFile.ts",
130130
"services/patternMatcher.ts",
131131
"versionCache.ts",
132-
"convertToBase64.ts"
132+
"convertToBase64.ts",
133+
"transpile.ts"
133134
].map(function (f) {
134135
return path.join(unittestsDirectory, f);
135136
})).concat([
@@ -148,7 +149,7 @@ var librarySourceMap = [
148149
{ target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], },
149150
{ target: "lib.d.ts", sources: ["core.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
150151
{ target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]},
151-
{ target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"]},
152+
{ target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] },
152153
];
153154

154155
var libraryTargets = librarySourceMap.map(function (f) {
@@ -506,7 +507,7 @@ function cleanTestDirs() {
506507
// used to pass data from jake command line directly to run.js
507508
function writeTestConfigFile(tests, testConfigFile) {
508509
console.log('Running test(s): ' + tests);
509-
var testConfigContents = '{\n' + '\ttest: [\'' + tests + '\']\n}';
510+
var testConfigContents = JSON.stringify({ test: [tests]});
510511
fs.writeFileSync('test.config', testConfigContents);
511512
}
512513

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
[![Downloads](http://img.shields.io/npm/dm/TypeScript.svg)](https://npmjs.org/package/typescript)
66

77
# TypeScript
8-
9-
[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8+
9+
[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1010

1111
[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](http://blogs.msdn.com/typescript) and [twitter account](https://twitter.com/typescriptlang).
1212

@@ -31,7 +31,7 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob
3131

3232
## Building
3333

34-
In order to build the TypeScript compiler, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js](http://nodejs.org/) installed. Note that you need to have autocrlf off as we track whitespace changes (`git config --global core.autocrlf false`).
34+
In order to build the TypeScript compiler, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js](http://nodejs.org/) installed.
3535

3636
Clone a copy of the repo:
3737

bin/lib.core.es6.d.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,11 @@ interface Array<T> {
15021502
copyWithin(target: number, start: number, end?: number): T[];
15031503
}
15041504

1505+
interface IArguments {
1506+
/** Iterator */
1507+
[Symbol.iterator](): IterableIterator<any>;
1508+
}
1509+
15051510
interface ArrayConstructor {
15061511
/**
15071512
* Creates an array from an array-like object.
@@ -1686,14 +1691,6 @@ interface GeneratorFunctionConstructor {
16861691
}
16871692
declare var GeneratorFunction: GeneratorFunctionConstructor;
16881693

1689-
interface Generator<T> extends IterableIterator<T> {
1690-
next(value?: any): IteratorResult<T>;
1691-
throw(exception: any): IteratorResult<T>;
1692-
return(value: T): IteratorResult<T>;
1693-
[Symbol.iterator](): Generator<T>;
1694-
[Symbol.toStringTag]: string;
1695-
}
1696-
16971694
interface Math {
16981695
/**
16991696
* Returns the number of leading zero bits in the 32-bit binary representation of a number.

bin/lib.d.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3552,10 +3552,10 @@ declare module Intl {
35523552
resolvedOptions(): ResolvedNumberFormatOptions;
35533553
}
35543554
var NumberFormat: {
3555-
new (locales?: string[], options?: NumberFormatOptions): Collator;
3556-
new (locale?: string, options?: NumberFormatOptions): Collator;
3557-
(locales?: string[], options?: NumberFormatOptions): Collator;
3558-
(locale?: string, options?: NumberFormatOptions): Collator;
3555+
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
3556+
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
3557+
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
3558+
(locale?: string, options?: NumberFormatOptions): NumberFormat;
35593559
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
35603560
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
35613561
}
@@ -3597,10 +3597,10 @@ declare module Intl {
35973597
resolvedOptions(): ResolvedDateTimeFormatOptions;
35983598
}
35993599
var DateTimeFormat: {
3600-
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
3601-
new (locale?: string, options?: DateTimeFormatOptions): Collator;
3602-
(locales?: string[], options?: DateTimeFormatOptions): Collator;
3603-
(locale?: string, options?: DateTimeFormatOptions): Collator;
3600+
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
3601+
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
3602+
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
3603+
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
36043604
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
36053605
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
36063606
}
@@ -11335,10 +11335,10 @@ declare var MediaQueryList: {
1133511335
interface MediaSource extends EventTarget {
1133611336
activeSourceBuffers: SourceBufferList;
1133711337
duration: number;
11338-
readyState: string;
11338+
readyState: number;
1133911339
sourceBuffers: SourceBufferList;
1134011340
addSourceBuffer(type: string): SourceBuffer;
11341-
endOfStream(error?: string): void;
11341+
endOfStream(error?: number): void;
1134211342
removeSourceBuffer(sourceBuffer: SourceBuffer): void;
1134311343
}
1134411344

@@ -12067,7 +12067,7 @@ declare var PopStateEvent: {
1206712067

1206812068
interface Position {
1206912069
coords: Coordinates;
12070-
timestamp: Date;
12070+
timestamp: number;
1207112071
}
1207212072

1207312073
declare var Position: {
@@ -14748,9 +14748,17 @@ interface WebGLRenderingContext {
1474814748
stencilMaskSeparate(face: number, mask: number): void;
1474914749
stencilOp(fail: number, zfail: number, zpass: number): void;
1475014750
stencilOpSeparate(face: number, fail: number, zfail: number, zpass: number): void;
14751+
texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels: ArrayBufferView): void;
14752+
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, image: HTMLImageElement): void;
14753+
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, canvas: HTMLCanvasElement): void;
14754+
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, video: HTMLVideoElement): void;
1475114755
texImage2D(target: number, level: number, internalformat: number, format: number, type: number, pixels: ImageData): void;
1475214756
texParameterf(target: number, pname: number, param: number): void;
1475314757
texParameteri(target: number, pname: number, param: number): void;
14758+
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: ArrayBufferView): void;
14759+
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, image: HTMLImageElement): void;
14760+
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, canvas: HTMLCanvasElement): void;
14761+
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, video: HTMLVideoElement): void;
1475414762
texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, pixels: ImageData): void;
1475514763
uniform1f(location: WebGLUniformLocation, x: number): void;
1475614764
uniform1fv(location: WebGLUniformLocation, v: any): void;
@@ -15990,10 +15998,11 @@ interface DocumentEvent {
1599015998
createEvent(eventInterface:"AriaRequestEvent"): AriaRequestEvent;
1599115999
createEvent(eventInterface:"AudioProcessingEvent"): AudioProcessingEvent;
1599216000
createEvent(eventInterface:"BeforeUnloadEvent"): BeforeUnloadEvent;
16001+
createEvent(eventInterface:"ClipboardEvent"): ClipboardEvent;
1599316002
createEvent(eventInterface:"CloseEvent"): CloseEvent;
1599416003
createEvent(eventInterface:"CommandEvent"): CommandEvent;
1599516004
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
15996-
createEvent(eventInterface: "CustomEvent"): CustomEvent;
16005+
createEvent(eventInterface:"CustomEvent"): CustomEvent;
1599716006
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
1599816007
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
1599916008
createEvent(eventInterface:"DragEvent"): DragEvent;
@@ -16016,8 +16025,6 @@ interface DocumentEvent {
1601616025
createEvent(eventInterface:"MouseEvent"): MouseEvent;
1601716026
createEvent(eventInterface:"MouseEvents"): MouseEvent;
1601816027
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
16019-
createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent;
16020-
createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent;
1602116028
createEvent(eventInterface:"MutationEvent"): MutationEvent;
1602216029
createEvent(eventInterface:"MutationEvents"): MutationEvent;
1602316030
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
@@ -16630,6 +16637,7 @@ declare function addEventListener(type: "volumechange", listener: (ev: Event) =>
1663016637
declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void;
1663116638
declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void;
1663216639
declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
16640+
1663316641
/////////////////////////////
1663416642
/// WorkerGlobalScope APIs
1663516643
/////////////////////////////

0 commit comments

Comments
 (0)