Skip to content

Commit 6c9c502

Browse files
author
Yui T
committed
Merge branch 'master' into refactorRefFilesPath
Conflicts: src/services/compiler/precompile.ts src/services/services.ts src/services/utilities.ts
2 parents e3579d1 + da314a3 commit 6c9c502

File tree

1,137 files changed

+52938
-33822
lines changed

Some content is hidden

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

1,137 files changed

+52938
-33822
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ var servicesSources = [
5555
].map(function (f) {
5656
return path.join(compilerDirectory, f);
5757
}).concat([
58+
"breakpoints.ts",
5859
"services.ts",
5960
"shims.ts",
6061
"signatureHelp.ts",
@@ -133,7 +134,7 @@ function concatenateFiles(destinationFile, sourceFiles) {
133134
fs.renameSync(temp, destinationFile);
134135
}
135136

136-
var useDebugMode = false;
137+
var useDebugMode = true;
137138
var generateDeclarations = false;
138139
var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node");
139140
var compilerFilename = "tsc.js";
@@ -148,15 +149,16 @@ var compilerFilename = "tsc.js";
148149
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile) {
149150
file(outFile, prereqs, function() {
150151
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory;
151-
var options = "-removeComments --module commonjs -noImplicitAny "; //" -propagateEnumConstants "
152+
var options = "-removeComments --module commonjs -noImplicitAny ";
152153
if (generateDeclarations) {
153154
options += "--declaration ";
154155
}
155-
156-
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
156+
157157
if (useDebugMode) {
158-
cmd = cmd + " " + path.join(harnessDirectory, "external/es5compat.ts") + " " + path.join(harnessDirectory, "external/json2.ts") + " ";
158+
options += "--preserveConstEnums ";
159159
}
160+
161+
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
160162
cmd = cmd + sources.join(" ") + (!noOutFile ? " -out " + outFile : "");
161163
if (useDebugMode) {
162164
cmd = cmd + " -sourcemap -mapRoot file:///" + path.resolve(path.dirname(outFile));
@@ -258,12 +260,11 @@ task("local", ["generate-diagnostics", "lib", tscFile, servicesFile]);
258260

259261

260262
// Local target to build the compiler and services
261-
desc("Emit debug mode files with sourcemaps");
262-
task("debug", function() {
263-
useDebugMode = true;
263+
desc("Sets release mode flag");
264+
task("release", function() {
265+
useDebugMode = false;
264266
});
265267

266-
267268
// Set the default task to "local"
268269
task("default", ["local"]);
269270

@@ -312,7 +313,7 @@ task("generate-spec", [specMd])
312313

313314
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
314315
desc("Makes a new LKG out of the built js files");
315-
task("LKG", libraryTargets, function() {
316+
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
316317
var expectedFiles = [tscFile, servicesFile].concat(libraryTargets);
317318
var missingFiles = expectedFiles.filter(function (f) {
318319
return !fs.existsSync(f);

bin/tsc.js

Lines changed: 4922 additions & 3643 deletions
Large diffs are not rendered by default.

bin/typescriptServices.js

Lines changed: 14035 additions & 13136 deletions
Large diffs are not rendered by default.
Binary file not shown.
Binary file not shown.
-8.83 KB
Binary file not shown.
8.77 KB
Binary file not shown.

doc/spec.md

Lines changed: 326 additions & 252 deletions
Large diffs are not rendered by default.

scripts/processDiagnosticMessages.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
interface DiagnosticDetails {
44
category: string;
55
code: number;
6+
isEarly?: boolean;
67
}
78

89
interface InputDiagnosticMessageTable {
@@ -63,8 +64,9 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, nameMap:
6364
' ' + convertPropertyName(nameMap[name]) +
6465
': { code: ' + diagnosticDetails.code +
6566
', category: DiagnosticCategory.' + diagnosticDetails.category +
66-
', key: "' + name.replace('"', '\\"') +
67-
'" },\r\n';
67+
', key: "' + name.replace('"', '\\"') + '"' +
68+
(diagnosticDetails.isEarly ? ', isEarly: true' : '') +
69+
' },\r\n';
6870
}
6971

7072
result += ' };\r\n}';

src/compiler/binder.ts

Lines changed: 142 additions & 51 deletions
Large diffs are not rendered by default.

src/compiler/checker.ts

Lines changed: 1295 additions & 765 deletions
Large diffs are not rendered by default.

src/compiler/commandLineParser.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module ts {
2424
type: "boolean",
2525
},
2626
{
27-
name: "emitBOM",
27+
name: "emitBOM",
2828
type: "boolean"
2929
},
3030
{
@@ -102,10 +102,10 @@ module ts {
102102
{
103103
name: "target",
104104
shortName: "t",
105-
type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5 },
106-
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_or_ES5,
105+
type: { "es3": ScriptTarget.ES3, "es5": ScriptTarget.ES5, "es6": ScriptTarget.ES6 },
106+
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental,
107107
paramType: Diagnostics.VERSION,
108-
error: Diagnostics.Argument_for_target_option_must_be_es3_or_es5
108+
error: Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6
109109
},
110110
{
111111
name: "version",
@@ -118,6 +118,11 @@ module ts {
118118
shortName: "w",
119119
type: "boolean",
120120
description: Diagnostics.Watch_input_files,
121+
},
122+
{
123+
name: "preserveConstEnums",
124+
type: "boolean",
125+
description: Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
121126
}
122127
];
123128

@@ -183,9 +188,10 @@ module ts {
183188
break;
184189
// If not a primitive, the possible types are specified in what is effectively a map of options.
185190
default:
186-
var value = (args[i++] || "").toLowerCase();
187-
if (hasProperty(opt.type, value)) {
188-
options[opt.name] = opt.type[value];
191+
var map = <Map<number>>opt.type;
192+
var key = (args[i++] || "").toLowerCase();
193+
if (hasProperty(map, key)) {
194+
options[opt.name] = map[key];
189195
}
190196
else {
191197
errors.push(createCompilerDiagnostic(opt.error));

src/compiler/core.ts

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
/// <reference path="types.ts"/>
22

33
module ts {
4+
5+
// Ternary values are defined such that
6+
// x & y is False if either x or y is False.
7+
// x & y is Maybe if either x or y is Maybe, but neither x or y is False.
8+
// x & y is True if both x and y are True.
9+
// x | y is False if both x and y are False.
10+
// x | y is Maybe if either x or y is Maybe, but neither x or y is True.
11+
// x | y is True if either x or y is True.
12+
export const enum Ternary {
13+
False = 0,
14+
Maybe = 1,
15+
True = -1
16+
}
17+
418
export interface Map<T> {
519
[index: string]: T;
620
}
721

22+
export const enum Comparison {
23+
LessThan = -1,
24+
EqualTo = 0,
25+
GreaterThan = 1
26+
}
27+
828
export interface StringSet extends Map<any> { }
929

1030
export function forEach<T, U>(array: T[], callback: (element: T) => U): U {
@@ -79,6 +99,7 @@ module ts {
7999
export function concatenate<T>(array1: T[], array2: T[]): T[] {
80100
if (!array2 || !array2.length) return array1;
81101
if (!array1 || !array1.length) return array2;
102+
82103
return array1.concat(array2);
83104
}
84105

@@ -232,7 +253,8 @@ module ts {
232253

233254
messageText: text,
234255
category: message.category,
235-
code: message.code
256+
code: message.code,
257+
isEarly: message.isEarly
236258
};
237259
}
238260

@@ -251,7 +273,8 @@ module ts {
251273

252274
messageText: text,
253275
category: message.category,
254-
code: message.code
276+
code: message.code,
277+
isEarly: message.isEarly
255278
};
256279
}
257280

@@ -272,6 +295,12 @@ module ts {
272295
};
273296
}
274297

298+
export function concatenateDiagnosticMessageChains(headChain: DiagnosticMessageChain, tailChain: DiagnosticMessageChain): DiagnosticMessageChain {
299+
Debug.assert(!headChain.next);
300+
headChain.next = tailChain;
301+
return headChain;
302+
}
303+
275304
export function flattenDiagnosticChain(file: SourceFile, start: number, length: number, diagnosticChain: DiagnosticMessageChain, newLine: string): Diagnostic {
276305
Debug.assert(start >= 0, "start must be non-negative, is " + start);
277306
Debug.assert(length >= 0, "length must be non-negative, is " + length);
@@ -304,11 +333,11 @@ module ts {
304333
};
305334
}
306335

307-
export function compareValues<T>(a: T, b: T): number {
308-
if (a === b) return 0;
309-
if (a === undefined) return -1;
310-
if (b === undefined) return 1;
311-
return a < b ? -1 : 1;
336+
export function compareValues<T>(a: T, b: T): Comparison {
337+
if (a === b) return Comparison.EqualTo;
338+
if (a === undefined) return Comparison.LessThan;
339+
if (b === undefined) return Comparison.GreaterThan;
340+
return a < b ? Comparison.LessThan : Comparison.GreaterThan;
312341
}
313342

314343
function getDiagnosticFilename(diagnostic: Diagnostic): string {
@@ -333,7 +362,7 @@ module ts {
333362
var previousDiagnostic = diagnostics[0];
334363
for (var i = 1; i < diagnostics.length; i++) {
335364
var currentDiagnostic = diagnostics[i];
336-
var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0;
365+
var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === Comparison.EqualTo;
337366
if (!isDupe) {
338367
newDiagnostics.push(currentDiagnostic);
339368
previousDiagnostic = currentDiagnostic;
@@ -608,7 +637,7 @@ module ts {
608637
getSignatureConstructor: () => <any>Signature
609638
}
610639

611-
export enum AssertionLevel {
640+
export const enum AssertionLevel {
612641
None = 0,
613642
Normal = 1,
614643
Aggressive = 2,
@@ -622,7 +651,7 @@ module ts {
622651
return currentAssertionLevel >= level;
623652
}
624653

625-
export function assert(expression: any, message?: string, verboseDebugInfo?: () => string): void {
654+
export function assert(expression: boolean, message?: string, verboseDebugInfo?: () => string): void {
626655
if (!expression) {
627656
var verboseDebugString = "";
628657
if (verboseDebugInfo) {

0 commit comments

Comments
 (0)