Skip to content

Commit 50a9481

Browse files
committed
Merged with master
2 parents 86b6b6c + 8dc3b2e commit 50a9481

File tree

1,489 files changed

+19546
-8286
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,489 files changed

+19546
-8286
lines changed

Jakefile.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ var harnessSources = harnessCoreSources.concat([
150150
"reuseProgramStructure.ts",
151151
"cachingInServerLSHost.ts",
152152
"moduleResolution.ts",
153-
"tsconfigParsing.ts"
153+
"tsconfigParsing.ts",
154+
"commandLineParsing.ts",
155+
"convertCompilerOptionsFromJson.ts",
156+
"convertTypingOptionsFromJson.ts"
154157
].map(function (f) {
155158
return path.join(unittestsDirectory, f);
156159
})).concat([
@@ -652,7 +655,7 @@ function deleteTemporaryProjectOutput() {
652655
}
653656
}
654657

655-
function runConsoleTests(defaultReporter, defaultSubsets, postLint) {
658+
function runConsoleTests(defaultReporter, defaultSubsets) {
656659
cleanTestDirs();
657660
var debug = process.env.debug || process.env.d;
658661
tests = process.env.test || process.env.tests || process.env.t;
@@ -685,13 +688,13 @@ function runConsoleTests(defaultReporter, defaultSubsets, postLint) {
685688
subsetRegexes = subsets.map(function (sub) { return "^" + sub + ".*$"; });
686689
subsetRegexes.push("^(?!" + subsets.join("|") + ").*$");
687690
}
688-
subsetRegexes.forEach(function (subsetRegex) {
691+
subsetRegexes.forEach(function (subsetRegex, i) {
689692
tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '';
690693
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
691694
console.log(cmd);
692695
exec(cmd, function () {
693696
deleteTemporaryProjectOutput();
694-
if (postLint) {
697+
if (i === 0) {
695698
var lint = jake.Task['lint'];
696699
lint.addListener('complete', function () {
697700
complete();
@@ -713,7 +716,7 @@ task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], functio
713716

714717
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.");
715718
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
716-
runConsoleTests('mocha-fivemat-progress-reporter', [], /*postLint*/ true);
719+
runConsoleTests('mocha-fivemat-progress-reporter', []);
717720
}, {async: true});
718721

719722
desc("Generates code coverage data via instanbul");

scripts/ior.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ module Commands {
7676
fs.mkdirSync(directoryPath);
7777
}
7878
}
79+
function normalizeSlashes(path: string): string {
80+
return path.replace(/\\/g, "/");
81+
}
7982
function transalatePath(outputFolder:string, path: string): string {
80-
return outputFolder + directorySeparator + path.replace(":", "");
83+
return normalizeSlashes(outputFolder + directorySeparator + path.replace(":", ""));
8184
}
8285
function fileExists(path: string): boolean {
8386
return fs.existsSync(path);
@@ -86,7 +89,7 @@ module Commands {
8689
var filename = transalatePath(outputFolder, f.path);
8790
ensureDirectoriesExist(getDirectoryPath(filename));
8891
console.log("writing filename: " + filename);
89-
fs.writeFile(filename, f.result.contents, (err) => { });
92+
fs.writeFileSync(filename, f.result.contents);
9093
});
9194

9295
console.log("Command: tsc ");

src/compiler/binder.ts

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ namespace ts {
279279
Debug.assert(!hasDynamicName(node));
280280

281281
const isDefaultExport = node.flags & NodeFlags.Default;
282+
282283
// The exported symbol for an export default function/class node is always named "default"
283284
const name = isDefaultExport && parent ? "default" : getDeclarationName(node);
284285

@@ -753,6 +754,7 @@ namespace ts {
753754
case SyntaxKind.GetAccessor:
754755
case SyntaxKind.SetAccessor:
755756
case SyntaxKind.FunctionType:
757+
case SyntaxKind.JSDocFunctionType:
756758
case SyntaxKind.ConstructorType:
757759
case SyntaxKind.FunctionExpression:
758760
case SyntaxKind.ArrowFunction:
@@ -900,7 +902,12 @@ namespace ts {
900902
if (node.flags & NodeFlags.Export) {
901903
errorOnFirstToken(node, Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);
902904
}
903-
declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
905+
if (isExternalModuleAugmentation(node)) {
906+
declareSymbolAndAddToSymbolTable(node, SymbolFlags.NamespaceModule, SymbolFlags.NamespaceModuleExcludes);
907+
}
908+
else {
909+
declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
910+
}
904911
}
905912
else {
906913
const state = getModuleInstanceState(node);
@@ -1349,6 +1356,8 @@ namespace ts {
13491356
case SyntaxKind.ImportSpecifier:
13501357
case SyntaxKind.ExportSpecifier:
13511358
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Alias, SymbolFlags.AliasExcludes);
1359+
case SyntaxKind.GlobalModuleExportDeclaration:
1360+
return bindGlobalModuleExportDeclaration(<GlobalModuleExportDeclaration>node);
13521361
case SyntaxKind.ImportClause:
13531362
return bindImportClause(<ImportClause>node);
13541363
case SyntaxKind.ExportDeclaration:
@@ -1398,6 +1407,33 @@ namespace ts {
13981407
}
13991408
}
14001409

1410+
function bindGlobalModuleExportDeclaration(node: GlobalModuleExportDeclaration) {
1411+
if (node.modifiers && node.modifiers.length) {
1412+
file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Modifiers_cannot_appear_here));
1413+
}
1414+
1415+
if (node.parent.kind !== SyntaxKind.SourceFile) {
1416+
file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Global_module_exports_may_only_appear_at_top_level));
1417+
return;
1418+
}
1419+
else {
1420+
const parent = node.parent as SourceFile;
1421+
1422+
if (!isExternalModule(parent)) {
1423+
file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Global_module_exports_may_only_appear_in_module_files));
1424+
return;
1425+
}
1426+
1427+
if (!parent.isDeclarationFile) {
1428+
file.bindDiagnostics.push(createDiagnosticForNode(node, Diagnostics.Global_module_exports_may_only_appear_in_declaration_files));
1429+
return;
1430+
}
1431+
}
1432+
1433+
file.symbol.globalExports = file.symbol.globalExports || {};
1434+
declareSymbol(file.symbol.globalExports, file.symbol, node, SymbolFlags.Alias, SymbolFlags.AliasExcludes);
1435+
}
1436+
14011437
function bindExportDeclaration(node: ExportDeclaration) {
14021438
if (!container.symbol || !container.symbol.exports) {
14031439
// Export * in some sort of block construct
@@ -1432,7 +1468,7 @@ namespace ts {
14321468
function bindModuleExportsAssignment(node: BinaryExpression) {
14331469
// 'module.exports = expr' assignment
14341470
setCommonJsModuleIndicator(node);
1435-
bindExportAssignment(node);
1471+
declareSymbol(file.symbol.exports, file.symbol, node, SymbolFlags.Property | SymbolFlags.Export | SymbolFlags.ValueModule, SymbolFlags.None);
14361472
}
14371473

14381474
function bindThisPropertyAssignment(node: BinaryExpression) {

0 commit comments

Comments
 (0)