Skip to content

Commit 3edecbf

Browse files
author
Yui T
committed
Merge branch 'master' into disambiguating
2 parents a07d911 + d0bc070 commit 3edecbf

365 files changed

Lines changed: 6506 additions & 6499 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tests/baselines/reference/projectOutput/*
2525
tests/baselines/local/projectOutput/*
2626
tests/services/baselines/prototyping/local/*
2727
tests/services/browser/typescriptServices.js
28+
scripts/configureNightly.js
2829
scripts/processDiagnosticMessages.d.ts
2930
scripts/processDiagnosticMessages.js
3031
scripts/importDefinitelyTypedTests.js

AUTHORS.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
TypeScript is authored by:
2+
3+
* Adam Freidin
4+
* Ahmad Farid
5+
* Anders Hejlsberg
6+
* Arnav Singh
7+
* Arthur Ozga
8+
* Basarat Ali Syed
9+
* Ben Duffield
10+
* Bill Ticehurst
11+
* Bryan Forbes
12+
* Caitlin Potter
13+
* Chris Bubernak
14+
* Colby Russell
15+
* Colin Snover
16+
* Cyrus Najmabadi
17+
* Dan Quirk
18+
* Daniel Rosenwasser
19+
* David Li
20+
* Dick van den Brink
21+
* Dirk Bäumer
22+
* Frank Wallis
23+
* Gabriel Isenberg
24+
* Gilad Peleg
25+
* Guillaume Salles
26+
* Harald Niesche
27+
* Ingvar Stepanyan
28+
* Ivo Gabe de Wolff
29+
* James Whitney
30+
* Jason Freeman
31+
* Jason Ramsay
32+
* Jed Mao
33+
* Johannes Rieken
34+
* Jonathan Bond-Caron
35+
* Jonathan Park
36+
* Jonathan Turner
37+
* Josh Kalderimis
38+
* Kagami Sascha Rosylight
39+
* Keith Mashinter
40+
* Kenji Imamula
41+
* Lorant Pinter
42+
* Masahiro Wakame
43+
* Max Deepfield
44+
* Micah Zoltu
45+
* Mohamed Hegazy
46+
* Oleg Mihailik
47+
* Oleksandr Chekhovskyi
48+
* Paul van Brenk
49+
* Pedro Maltez
50+
* Philip Bulley
51+
* piloopin
52+
* Ron Buckton
53+
* Ryan Cavanaugh
54+
* Sheetal Nandi
55+
* Shengping Zhong
56+
* Shyyko Serhiy
57+
* Simon Hürlimann
58+
* Solal Pirelli
59+
* Stan Thomas
60+
* Steve Lucco
61+
* Tien Hoanhtien
62+
* Tingan Ho
63+
* togru
64+
* Tomas Grubliauskas
65+
* TruongSinh Tran-Nguyen
66+
* Vladimir Matveev
67+
* Wesley Wigham
68+
* Yui Tanglertsampan
69+
* Zev Spitz
70+
* Zhengbo Li

Jakefile.js

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ var harnessSources = harnessCoreSources.concat([
138138
"services/documentRegistry.ts",
139139
"services/preProcessFile.ts",
140140
"services/patternMatcher.ts",
141+
"session.ts",
141142
"versionCache.ts",
142143
"convertToBase64.ts",
143144
"transpile.ts"
@@ -313,7 +314,7 @@ var processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnostic
313314
var diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json");
314315
var diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts");
315316

316-
file(processDiagnosticMessagesTs)
317+
file(processDiagnosticMessagesTs);
317318

318319
// processDiagnosticMessages script
319320
compileFile(processDiagnosticMessagesJs,
@@ -338,11 +339,49 @@ file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson],
338339
complete();
339340
});
340341
ex.run();
341-
}, {async: true})
342+
}, {async: true});
342343

343344
desc("Generates a diagnostic file in TypeScript based on an input JSON file");
344-
task("generate-diagnostics", [diagnosticInfoMapTs])
345+
task("generate-diagnostics", [diagnosticInfoMapTs]);
346+
347+
348+
// Publish nightly
349+
var configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
350+
var configureNightlyTs = path.join(scriptsDirectory, "configureNightly.ts");
351+
var packageJson = "package.json";
352+
var programTs = path.join(compilerDirectory, "program.ts");
345353

354+
file(configureNightlyTs);
355+
356+
compileFile(/*outfile*/configureNightlyJs,
357+
/*sources*/ [configureNightlyTs],
358+
/*prereqs*/ [configureNightlyTs],
359+
/*prefixes*/ [],
360+
/*useBuiltCompiler*/ false,
361+
/*noOutFile*/ false,
362+
/*generateDeclarations*/ false,
363+
/*outDir*/ undefined,
364+
/*preserveConstEnums*/ undefined,
365+
/*keepComments*/ false,
366+
/*noResolve*/ false,
367+
/*stripInternal*/ false);
368+
369+
task("setDebugMode", function() {
370+
useDebugMode = true;
371+
});
372+
373+
task("configure-nightly", [configureNightlyJs], function() {
374+
var cmd = "node " + configureNightlyJs + " " + packageJson + " " + programTs;
375+
console.log(cmd);
376+
exec(cmd);
377+
}, { async: true });
378+
379+
desc("Configure, build, test, and publish the nightly release.");
380+
task("publish-nightly", ["configure-nightly", "LKG", "clean", "setDebugMode", "runtests"], function () {
381+
var cmd = "npm publish --tag next";
382+
console.log(cmd);
383+
exec(cmd);
384+
});
346385

347386
// Local target to build the compiler and services
348387
var tscFile = path.join(builtLocalDirectory, compilerFilename);
@@ -440,11 +479,11 @@ file(specMd, [word2mdJs, specWord], function () {
440479
child_process.exec(cmd, function () {
441480
complete();
442481
});
443-
}, {async: true})
482+
}, {async: true});
444483

445484

446485
desc("Generates a Markdown version of the Language Specification");
447-
task("generate-spec", [specMd])
486+
task("generate-spec", [specMd]);
448487

449488

450489
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
@@ -576,7 +615,7 @@ task("runtests", ["tests", builtLocalDirectory], function() {
576615
exec(cmd, deleteTemporaryProjectOutput);
577616
}, {async: true});
578617

579-
desc("Generates code coverage data via instanbul")
618+
desc("Generates code coverage data via instanbul");
580619
task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
581620
var cmd = 'istanbul cover node_modules/mocha/bin/_mocha -- -R min -t ' + testTimeout + ' ' + run;
582621
console.log(cmd);
@@ -619,7 +658,7 @@ task("runtests-browser", ["tests", "browserify", builtLocalDirectory], function(
619658
function getDiffTool() {
620659
var program = process.env['DIFF']
621660
if (!program) {
622-
fail("Add the 'DIFF' environment variable to the path of the program you want to use.")
661+
fail("Add the 'DIFF' environment variable to the path of the program you want to use.");
623662
}
624663
return program;
625664
}
@@ -628,14 +667,14 @@ function getDiffTool() {
628667
desc("Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable");
629668
task('diff', function () {
630669
var cmd = '"' + getDiffTool() + '" ' + refBaseline + ' ' + localBaseline;
631-
console.log(cmd)
670+
console.log(cmd);
632671
exec(cmd);
633672
}, {async: true});
634673

635674
desc("Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable");
636675
task('diff-rwc', function () {
637676
var cmd = '"' + getDiffTool() + '" ' + refRwcBaseline + ' ' + localRwcBaseline;
638-
console.log(cmd)
677+
console.log(cmd);
639678
exec(cmd);
640679
}, {async: true});
641680

@@ -736,9 +775,9 @@ task("lint", [], function() {
736775
function failure(f) { return function() { console.log('FAILURE: Please fix linting errors in ' + f + '\n') }};
737776

738777
var lintTargets = compilerSources.concat(harnessCoreSources);
739-
for(var i in lintTargets) {
778+
for (var i in lintTargets) {
740779
var f = lintTargets[i];
741-
var cmd = 'tslint -f ' + f;
780+
var cmd = 'tslint -c tslint.json ' + f;
742781
exec(cmd, success(f), failure(f));
743782
}
744783
}, { async: true });

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@
88

99
[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).
1010

11+
## Installing
12+
13+
For the latest stable version:
14+
15+
```
16+
npm install -g typescript
17+
```
18+
19+
For our nightly builds:
20+
21+
```
22+
npm install -g typescript@next
23+
```
1124

1225
## Contribute
1326

@@ -63,7 +76,8 @@ jake runtests # Run tests using the built compiler and test infrastructu
6376
# Use host=<hostName> or tests=<testPath>.
6477
jake runtests-browser # Runs the tests using the built run.js file. Syntax is jake runtests. Optional
6578
parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]'.
66-
jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests.
79+
jake baseline-accept # This replaces the baseline test results with the results obtained from jake runtests.
80+
jake lint # Runs tslint on the TypeScript source.
6781
jake -T # List the above commands.
6882
```
6983

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typescript",
33
"author": "Microsoft Corp.",
44
"homepage": "http://typescriptlang.org/",
5-
"version": "1.5.3",
5+
"version": "1.6.0",
66
"license": "Apache-2.0",
77
"description": "TypeScript is a language for application scale JavaScript development",
88
"keywords": [

scripts/configureNightly.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/// <reference path="../src/compiler/sys.ts" />
2+
3+
/**
4+
* A minimal description for a parsed package.json object.
5+
*/
6+
interface PackageJson {
7+
name: string;
8+
version: string;
9+
keywords: string[];
10+
}
11+
12+
function main(): void {
13+
const sys = ts.sys;
14+
if (sys.args.length < 2) {
15+
sys.write("Usage:" + sys.newLine)
16+
sys.write("\tnode configureNightly.js <package.json location> <file containing version>" + sys.newLine);
17+
return;
18+
}
19+
20+
// Acquire the version from the package.json file and modify it appropriately.
21+
const packageJsonFilePath = ts.normalizePath(sys.args[0]);
22+
const packageJsonContents = sys.readFile(packageJsonFilePath);
23+
const packageJsonValue: PackageJson = JSON.parse(packageJsonContents);
24+
25+
const nightlyVersion = getNightlyVersionString(packageJsonValue.version);
26+
27+
// Modify the package.json structure
28+
packageJsonValue.version = nightlyVersion;
29+
30+
// Acquire and modify the source file that exposes the version string.
31+
const tsFilePath = ts.normalizePath(sys.args[1]);
32+
const tsFileContents = sys.readFile(tsFilePath);
33+
const versionAssignmentRegExp = /export\s+const\s+version\s+=\s+".*";/;
34+
const modifiedTsFileContents = tsFileContents.replace(versionAssignmentRegExp, `export const version = "${nightlyVersion}";`);
35+
36+
// Ensure we are actually changing something - the user probably wants to know that the update failed.
37+
if (tsFileContents === modifiedTsFileContents) {
38+
let err = `\n '${tsFilePath}' was not updated while configuring for a nightly publish.\n `;
39+
40+
if (tsFileContents.match(versionAssignmentRegExp)) {
41+
err += `Ensure that you have not already run this script; otherwise, erase your changes using 'git checkout -- "${tsFilePath}"'.`;
42+
}
43+
else {
44+
err += `The file seems to no longer have a string matching '${versionAssignmentRegExp}'.`;
45+
}
46+
47+
throw err + "\n";
48+
}
49+
50+
// Finally write the changes to disk.
51+
sys.writeFile(packageJsonFilePath, JSON.stringify(packageJsonValue, /*replacer:*/ undefined, /*space:*/ 4))
52+
sys.writeFile(tsFilePath, modifiedTsFileContents);
53+
}
54+
55+
function getNightlyVersionString(versionString: string): string {
56+
// If the version string already contains "-nightly",
57+
// then get the base string and update based on that.
58+
const dashNightlyPos = versionString.indexOf("-dev");
59+
if (dashNightlyPos >= 0) {
60+
versionString = versionString.slice(0, dashNightlyPos);
61+
}
62+
63+
// We're going to append a representation of the current time at the end of the current version.
64+
// String.prototype.toISOString() returns a 24-character string formatted as 'YYYY-MM-DDTHH:mm:ss.sssZ',
65+
// but we'd prefer to just remove separators and limit ourselves to YYYYMMDD.
66+
// UTC time will always be implicit here.
67+
const now = new Date();
68+
const timeStr = now.toISOString().replace(/:|T|\.|-/g, "").slice(0, 8);
69+
70+
return `${versionString}-dev.${timeStr}`;
71+
}
72+
73+
main();

src/compiler/binder.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -518,15 +518,21 @@ namespace ts {
518518
}
519519
else {
520520
declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
521-
522-
let currentModuleIsConstEnumOnly = state === ModuleInstanceState.ConstEnumOnly;
523-
if (node.symbol.constEnumOnlyModule === undefined) {
524-
// non-merged case - use the current state
525-
node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly;
521+
if (node.symbol.flags & (SymbolFlags.Function | SymbolFlags.Class | SymbolFlags.RegularEnum)) {
522+
// if module was already merged with some function, class or non-const enum
523+
// treat is a non-const-enum-only
524+
node.symbol.constEnumOnlyModule = false;
526525
}
527526
else {
528-
// merged case: module is const enum only if all its pieces are non-instantiated or const enum
529-
node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly;
527+
let currentModuleIsConstEnumOnly = state === ModuleInstanceState.ConstEnumOnly;
528+
if (node.symbol.constEnumOnlyModule === undefined) {
529+
// non-merged case - use the current state
530+
node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly;
531+
}
532+
else {
533+
// merged case: module is const enum only if all its pieces are non-instantiated or const enum
534+
node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly;
535+
}
530536
}
531537
}
532538
}
@@ -1056,4 +1062,4 @@ namespace ts {
10561062
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
10571063
}
10581064
}
1059-
}
1065+
}

0 commit comments

Comments
 (0)