Skip to content

Commit c8bb487

Browse files
Merge branch 'master' into conformanceTests-624
Conflicts: tests/baselines/reference/parameterInitializersForwardReferencing.errors.txt
2 parents f3f3994 + 44e6bcf commit c8bb487

File tree

4,715 files changed

+169311
-91473
lines changed

Some content is hidden

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

4,715 files changed

+169311
-91473
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ build.json
3232
tests/webhost/*.d.ts
3333
tests/webhost/webtsc.js
3434
tests/*.js
35+
tests/*.js.map
3536
tests/*.d.ts
3637
*.config
3738
scripts/debug.bat
3839
scripts/run.bat
40+
scripts/word2md.js
41+
scripts/ior.js
42+
scripts/*.js.map
3943
coverage/

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
language: node_js
22

33
node_js:
4-
- '0.10'
4+
- '0.10'
5+
6+
sudo: false
57

68
before_script: npm install -g codeclimate-test-reporter
79

810
after_script:
9-
- cat coverage/lcov.info | codeclimate
11+
- cat coverage/lcov.info | codeclimate
1012

1113
addons:
1214
code_climate:

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Design changes will not be accepted at this time. If you have a design change pr
99
## Legal
1010
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.
1111

12-
Please submit a Contributor License Agreement (CLA) before submitting a pull request. Download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190)), sign, scan, and email it back to <[email protected]>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request. Please note that we're currently only accepting pull requests of bug fixes rather than new features.
12+
Please submit a Contributor License Agreement (CLA) before submitting a pull request. 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 <[email protected]>. Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request. Please note that we're currently only accepting pull requests of bug fixes rather than new features.
1313

1414
## Housekeeping
1515
Your pull request should:
@@ -26,6 +26,7 @@ Your pull request should:
2626
* Include baseline changes with your change
2727
* All changed code must have 100% code coverage
2828
* Follow the code conventions descriped in [Coding guidlines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidlines)
29+
* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
2930

3031
## Running the Tests
3132
To run all tests, invoke the runtests target using jake:

Jakefile

Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
var fs = require("fs");
44
var path = require("path");
5+
var child_process = require("child_process");
56

67
// Variables
78
var compilerDirectory = "src/compiler/";
89
var servicesDirectory = "src/services/";
910
var harnessDirectory = "src/harness/";
1011
var libraryDirectory = "src/lib/";
1112
var scriptsDirectory = "scripts/";
13+
var unittestsDirectory = "tests/cases/unittests/";
14+
var docDirectory = "doc/";
1215

1316
var builtDirectory = "built/";
1417
var builtLocalDirectory = "built/local/";
@@ -52,8 +55,13 @@ var servicesSources = [
5255
].map(function (f) {
5356
return path.join(compilerDirectory, f);
5457
}).concat([
58+
"breakpoints.ts",
5559
"services.ts",
5660
"shims.ts",
61+
"signatureHelp.ts",
62+
"utilities.ts",
63+
"navigationBar.ts",
64+
"outliningElementsCollector.ts"
5765
].map(function (f) {
5866
return path.join(servicesDirectory, f);
5967
}));
@@ -63,19 +71,23 @@ var harnessSources = [
6371
"sourceMapRecorder.ts",
6472
"harnessLanguageService.ts",
6573
"fourslash.ts",
66-
"external/json2.ts",
6774
"runnerbase.ts",
6875
"compilerRunner.ts",
6976
"typeWriter.ts",
7077
"fourslashRunner.ts",
7178
"projectsRunner.ts",
72-
"unittestrunner.ts",
7379
"loggedIO.ts",
7480
"rwcRunner.ts",
7581
"runner.ts"
7682
].map(function (f) {
7783
return path.join(harnessDirectory, f);
78-
});
84+
}).concat([
85+
"services/colorization.ts",
86+
"services/documentRegistry.ts",
87+
"services/preProcessFile.ts"
88+
].map(function (f) {
89+
return path.join(unittestsDirectory, f);
90+
}));
7991

8092
var librarySourceMap = [
8193
{ target: "lib.core.d.ts", sources: ["core.d.ts"] },
@@ -122,7 +134,8 @@ function concatenateFiles(destinationFile, sourceFiles) {
122134
fs.renameSync(temp, destinationFile);
123135
}
124136

125-
var useDebugMode = false;
137+
var useDebugMode = true;
138+
var generateDeclarations = false;
126139
var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node");
127140
var compilerFilename = "tsc.js";
128141
/* Compiles a file from a list of sources
@@ -136,12 +149,16 @@ var compilerFilename = "tsc.js";
136149
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile) {
137150
file(outFile, prereqs, function() {
138151
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory;
139-
var options = "-removeComments --module commonjs -noImplicitAny "; //" -propagateEnumConstants "
140-
141-
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
152+
var options = "-removeComments --module commonjs -noImplicitAny ";
153+
if (generateDeclarations) {
154+
options += "--declaration ";
155+
}
156+
142157
if (useDebugMode) {
143-
cmd = cmd + " " + path.join(harnessDirectory, "external/es5compat.ts") + " " + path.join(harnessDirectory, "external/json2.ts") + " ";
158+
options += "--preserveConstEnums ";
144159
}
160+
161+
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
145162
cmd = cmd + sources.join(" ") + (!noOutFile ? " -out " + outFile : "");
146163
if (useDebugMode) {
147164
cmd = cmd + " -sourcemap -mapRoot file:///" + path.resolve(path.dirname(outFile));
@@ -243,12 +260,11 @@ task("local", ["generate-diagnostics", "lib", tscFile, servicesFile]);
243260

244261

245262
// Local target to build the compiler and services
246-
desc("Emit debug mode files with sourcemaps");
247-
task("debug", function() {
248-
useDebugMode = true;
263+
desc("Sets release mode flag");
264+
task("release", function() {
265+
useDebugMode = false;
249266
});
250267

251-
252268
// Set the default task to "local"
253269
task("default", ["local"]);
254270

@@ -259,9 +275,45 @@ task("clean", function() {
259275
jake.rmRf(builtDirectory);
260276
});
261277

278+
// generate declarations for compiler and services
279+
desc("Generate declarations for compiler and services");
280+
task("declaration", function() {
281+
generateDeclarations = true;
282+
});
283+
284+
// Generate Markdown spec
285+
var word2mdJs = path.join(scriptsDirectory, "word2md.js");
286+
var word2mdTs = path.join(scriptsDirectory, "word2md.ts");
287+
var specWord = path.join(docDirectory, "TypeScript Language Specification.docx");
288+
var specMd = path.join(docDirectory, "spec.md");
289+
290+
file(word2mdTs);
291+
292+
// word2md script
293+
compileFile(word2mdJs,
294+
[word2mdTs],
295+
[word2mdTs],
296+
[],
297+
false);
298+
299+
// The generated spec.md; built for the 'generate-spec' task
300+
file(specMd, [word2mdJs, specWord], function () {
301+
var specWordFullPath = path.resolve(specWord);
302+
var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" ' + specMd;
303+
console.log(cmd);
304+
child_process.exec(cmd, function () {
305+
complete();
306+
});
307+
}, {async: true})
308+
309+
310+
desc("Generates a Markdown version of the Language Specification");
311+
task("generate-spec", [specMd])
312+
313+
262314
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
263315
desc("Makes a new LKG out of the built js files");
264-
task("LKG", libraryTargets, function() {
316+
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
265317
var expectedFiles = [tscFile, servicesFile].concat(libraryTargets);
266318
var missingFiles = expectedFiles.filter(function (f) {
267319
return !fs.existsSync(f);
@@ -318,7 +370,7 @@ function exec(cmd, completeHandler) {
318370
complete();
319371
})
320372
try{
321-
ex.run();
373+
ex.run();
322374
} catch(e) {
323375
console.log('Exception: ' + e)
324376
}
@@ -342,7 +394,7 @@ function cleanTestDirs() {
342394
function writeTestConfigFile(tests, testConfigFile) {
343395
console.log('Running test(s): ' + tests);
344396
var testConfigContents = '{\n' + '\ttest: [\'' + tests + '\']\n}';
345-
fs.writeFileSync('test.config', testConfigContents);
397+
fs.writeFileSync('test.config', testConfigContents);
346398
}
347399

348400
function deleteTemporaryProjectOutput() {
@@ -385,7 +437,7 @@ desc("Generates code coverage data via instanbul")
385437
task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
386438
var cmd = 'istanbul cover node_modules/mocha/bin/_mocha -- -R min -t ' + testTimeout + ' ' + run;
387439
console.log(cmd);
388-
exec(cmd);
440+
exec(cmd);
389441
}, { async: true });
390442

391443
// Browser tests

README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
2+
[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/pr)](http://issuestats.com/github/microsoft/typescript)
3+
[![Issue Stats](http://issuestats.com/github/Microsoft/TypeScript/badge/issue)](http://issuestats.com/github/microsoft/typescript)
4+
15
# TypeScript
26

37
[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).
@@ -18,7 +22,7 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob
1822

1923
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
2024
* [Programming handbook](http://www.typescriptlang.org/Handbook)
21-
* [Language specification](http://go.microsoft.com/fwlink/?LinkId=267238)
25+
* [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)
2226
* [Homepage](http://www.typescriptlang.org/)
2327

2428
## Building
@@ -47,16 +51,18 @@ npm install
4751
Use one of the following to build and test:
4852

4953
```
50-
jake local # Build the compiler into built/local
51-
jake clean # Delete the built compiler
52-
jake LKG # Replace the last known good with the built one.
53-
# Bootstrapping step to be executed when the built compiler reaches a stable state.
54-
jake tests # Build the test infrastructure using the built compiler.
55-
jake runtests # Run tests using the built compiler and test infrastructure.
56-
# You can override the host or specify a test for this command.
57-
# Use host=<hostName> or tests=<testPath>.
58-
jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests.
59-
jake -T # List the above commands.
54+
jake local # Build the compiler into built/local
55+
jake clean # Delete the built compiler
56+
jake LKG # Replace the last known good with the built one.
57+
# Bootstrapping step to be executed when the built compiler reaches a stable state.
58+
jake tests # Build the test infrastructure using the built compiler.
59+
jake runtests # Run tests using the built compiler and test infrastructure.
60+
# You can override the host or specify a test for this command.
61+
# Use host=<hostName> or tests=<testPath>.
62+
jake runtests-browser # Runs the tests using the built run.js file. Syntax is jake runtests. Optional
63+
parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]'.
64+
jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests.
65+
jake -T # List the above commands.
6066
```
6167

6268

ThirdPartyNoticeText.txt

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -19,67 +19,6 @@ limitations under the License.
1919
---------------------------------------------
2020
Third Party Code Components
2121
--------------------------------------------
22-
---- Mozilla Developer Code---------
23-
The following Mozilla Developer Code is under Public Domain as updated after Aug. 20, 2012, see, https://developer.mozilla.org/en-US/docs/Project:Copyrights
24-
1. Array filter Compatibility Method,
25-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter
26-
Any copyright is dedicated to the Public Domain.
27-
28-
2. Array forEach Compatibility Method,
29-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach
30-
Any copyright is dedicated to the Public Domain.
31-
32-
3. Array indexOf Compatibility Method,
33-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf
34-
Any copyright is dedicated to the Public Domain.
35-
36-
4. Array map Compatibility Method,
37-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map
38-
Any copyright is dedicated to the Public Domain.
39-
40-
5. Array Reduce Compatibility Method,
41-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce
42-
Any copyright is dedicated to the Public Domain.
43-
44-
6. String Trim Compatibility Method,
45-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim
46-
Any copyright is dedicated to the Public Domain.
47-
48-
7. Date now Compatibility Method,
49-
Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now
50-
Any copyright is dedicated to the Public Domain.
51-
52-
------------JSON2 Script------------------------
53-
json2.js 2012-10-08
54-
Public Domain.
55-
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
56-
See, http://www.JSON.org/js.html
57-
58-
--------------r.js----------------------
59-
Copyright (c) 2010-2011 Dojo Foundation. All Rights Reserved.
60-
Originally License under MIT License
61-
-------------------------------------------------------------------------
62-
Provided for Informational Purposes Only
63-
MIT License
64-
65-
Permission is hereby granted, free of charge, to any person obtaining
66-
a copy of this software and associated documentation files (the
67-
"Software"), to deal in the Software without restriction, including
68-
without limitation the rights to use, copy, modify, merge, publish,
69-
distribute, sublicense, and/or sell copies of the Software, and to
70-
permit persons to whom the Software is furnished to do so, subject to
71-
the following conditions:
72-
73-
The above copyright notice and this permission notice shall be
74-
included in all copies or substantial portions of the Software.
75-
76-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
77-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
78-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
79-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
80-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
81-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
82-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8322

8423
------------------- DefinitelyTyped --------------------
8524
This file is based on or incorporates material from the projects listed below (collectively ?Third Party Code?). Microsoft is not the original author of the Third Party Code. The original copyright notice and the license, under which Microsoft received such Third Party Code, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft, not the third party, licenses the Third Party Code to you under the terms set forth in the EULA for the Microsoft Product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise.

bin/lib.core.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ declare var Number: {
499499
POSITIVE_INFINITY: number;
500500
}
501501

502+
interface TemplateStringsArray extends Array<string> {
503+
raw: string[];
504+
}
505+
502506
interface Math {
503507
/** The mathematical constant e. This is Euler's number, the base of natural logarithms. */
504508
E: number;

0 commit comments

Comments
 (0)