Skip to content

Commit 5b9bd82

Browse files
author
Andy Hanson
committed
Merge branch 'master' into resolve_entity_name
2 parents 7908257 + fa991b5 commit 5b9bd82

File tree

246 files changed

+6044
-28291
lines changed

Some content is hidden

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

246 files changed

+6044
-28291
lines changed

.travis.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,33 @@ node_js:
77

88
sudo: false
99

10-
os:
11-
- linux
12-
- osx
10+
env:
11+
- workerCount=3
1312

1413
matrix:
1514
fast_finish: true
16-
exclude:
15+
include:
1716
- os: osx
18-
node_js: '4'
17+
node_js: stable
18+
osx_image: xcode7.3
19+
env: workerCount=2
20+
allow_failures:
1921
- os: osx
20-
node_js: '0.10'
2122

2223
branches:
2324
only:
2425
- master
25-
- transforms
26+
- transforms
27+
28+
install:
29+
- npm uninstall typescript
30+
- npm uninstall tslint
31+
- npm install
32+
- npm update
33+
34+
cache:
35+
directories:
36+
- node_modules
37+
38+
git:
39+
depth: 1

Gulpfile.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => {
449449
});
450450

451451
gulp.task("lssl", "Builds language service server library", [tsserverLibraryFile]);
452-
gulp.task("local", "Builds the full compiler and services", [builtLocalCompiler, servicesFile, serverFile, builtGeneratedDiagnosticMessagesJSON]);
452+
gulp.task("local", "Builds the full compiler and services", [builtLocalCompiler, servicesFile, serverFile, builtGeneratedDiagnosticMessagesJSON, tsserverLibraryFile]);
453453
gulp.task("tsc", "Builds only the compiler", [builtLocalCompiler]);
454454

455455

@@ -503,7 +503,7 @@ gulp.task("VerifyLKG", false, [], () => {
503503
return gulp.src(expectedFiles).pipe(gulp.dest(LKGDirectory));
504504
});
505505

506-
gulp.task("LKGInternal", false, ["lib", "local", "lssl"]);
506+
gulp.task("LKGInternal", false, ["lib", "local"]);
507507

508508
gulp.task("LKG", "Makes a new LKG out of the built js files", ["clean", "dontUseDebugMode"], () => {
509509
return runSequence("LKGInternal", "VerifyLKG");
@@ -956,6 +956,7 @@ const lintTargets = [
956956
"src/server/**/*.ts",
957957
"scripts/tslint/**/*.ts",
958958
"src/services/**/*.ts",
959+
"tests/*.ts", "tests/webhost/*.ts" // Note: does *not* descend recursively
959960
];
960961

961962

Jakefile.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibr
551551
compileFile(
552552
tsserverLibraryFile,
553553
languageServiceLibrarySources,
554-
[builtLocalDirectory, copyright].concat(languageServiceLibrarySources),
554+
[builtLocalDirectory, copyright, builtLocalCompiler].concat(languageServiceLibrarySources).concat(libraryTargets),
555555
/*prefixes*/ [copyright],
556556
/*useBuiltCompiler*/ true,
557557
{ noOutFile: false, generateDeclarations: true });
@@ -562,7 +562,7 @@ task("lssl", [tsserverLibraryFile, tsserverLibraryDefinitionFile]);
562562

563563
// Local target to build the compiler and services
564564
desc("Builds the full compiler and services");
565-
task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile, serverFile, builtGeneratedDiagnosticMessagesJSON]);
565+
task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile, serverFile, builtGeneratedDiagnosticMessagesJSON, "lssl"]);
566566

567567
// Local target to build only tsc.js
568568
desc("Builds only the compiler");
@@ -617,7 +617,7 @@ task("generate-spec", [specMd]);
617617

618618
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
619619
desc("Makes a new LKG out of the built js files");
620-
task("LKG", ["clean", "release", "local", "lssl"].concat(libraryTargets), function() {
620+
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
621621
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile].concat(libraryTargets);
622622
var missingFiles = expectedFiles.filter(function (f) {
623623
return !fs.existsSync(f);
@@ -1041,7 +1041,8 @@ var lintTargets = compilerSources
10411041
.concat(serverCoreSources)
10421042
.concat(tslintRulesFiles)
10431043
.concat(servicesSources)
1044-
.concat(["Gulpfile.ts"]);
1044+
.concat(["Gulpfile.ts"])
1045+
.concat([nodeServerInFile, perftscPath, "tests/perfsys.ts", webhostPath]);
10451046

10461047

10471048
desc("Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex");

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
},
7979
"scripts": {
8080
"pretest": "jake tests",
81-
"test": "jake runtests",
81+
"test": "jake runtests-parallel",
8282
"build": "npm run build:compiler && npm run build:tests",
8383
"build:compiler": "jake local",
8484
"build:tests": "jake tests",

src/compiler/checker.ts

Lines changed: 214 additions & 75 deletions
Large diffs are not rendered by default.

src/compiler/core.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,12 @@ namespace ts {
334334
return keys;
335335
}
336336

337-
export function getProperty<T>(map: Map<T>, key: string): T {
338-
return hasOwnProperty.call(map, key) ? map[key] : undefined;
337+
export function getProperty<T>(map: Map<T>, key: string): T | undefined {
338+
return hasProperty(map, key) ? map[key] : undefined;
339+
}
340+
341+
export function getOrUpdateProperty<T>(map: Map<T>, key: string, makeValue: () => T): T {
342+
return hasProperty(map, key) ? map[key] : map[key] = makeValue();
339343
}
340344

341345
export function isEmpty<T>(map: Map<T>) {

src/compiler/diagnosticMessages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,6 +1947,10 @@
19471947
"category": "Error",
19481948
"code": 2689
19491949
},
1950+
"A class must be declared after its base class.": {
1951+
"category": "Error",
1952+
"code": 2690
1953+
},
19501954
"Import declaration '{0}' is using private name '{1}'.": {
19511955
"category": "Error",
19521956
"code": 4000

src/compiler/emitter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,7 +2578,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
25782578
operand = (<TypeAssertion | NonNullExpression>operand).expression;
25792579
}
25802580

2581-
// We have an expression of the form: (<Type>SubExpr)
2581+
// We have an expression of the form: (<Type>SubExpr) or (SubExpr as Type)
25822582
// Emitting this as (SubExpr) is really not desirable. We would like to emit the subexpr as is.
25832583
// Omitting the parentheses, however, could cause change in the semantics of the generated
25842584
// code if the casted expression has a lower precedence than the rest of the expression, e.g.:
@@ -2592,6 +2592,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
25922592
operand.kind !== SyntaxKind.DeleteExpression &&
25932593
operand.kind !== SyntaxKind.PostfixUnaryExpression &&
25942594
operand.kind !== SyntaxKind.NewExpression &&
2595+
!(operand.kind === SyntaxKind.BinaryExpression && node.expression.kind === SyntaxKind.AsExpression) &&
25952596
!(operand.kind === SyntaxKind.CallExpression && node.parent.kind === SyntaxKind.NewExpression) &&
25962597
!(operand.kind === SyntaxKind.FunctionExpression && node.parent.kind === SyntaxKind.CallExpression) &&
25972598
!(operand.kind === SyntaxKind.NumericLiteral && node.parent.kind === SyntaxKind.PropertyAccessExpression)) {
@@ -6841,7 +6842,7 @@ const _super = (function (geti, seti) {
68416842
// export { x, y }
68426843
for (const specifier of (<ExportDeclaration>node).exportClause.elements) {
68436844
const name = (specifier.propertyName || specifier.name).text;
6844-
(exportSpecifiers[name] || (exportSpecifiers[name] = [])).push(specifier);
6845+
getOrUpdateProperty(exportSpecifiers, name, () => []).push(specifier);
68456846
}
68466847
}
68476848
break;

src/compiler/program.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,19 +1055,15 @@ namespace ts {
10551055
return resolutions;
10561056
}
10571057

1058-
function getInferredTypesRoot(options: CompilerOptions, rootFiles: string[], host: CompilerHost) {
1059-
return computeCommonSourceDirectoryOfFilenames(rootFiles, host.getCurrentDirectory(), f => host.getCanonicalFileName(f));
1060-
}
1061-
10621058
/**
1063-
* Given a set of options and a set of root files, returns the set of type directive names
1059+
* Given a set of options, returns the set of type directive names
10641060
* that should be included for this program automatically.
10651061
* This list could either come from the config file,
10661062
* or from enumerating the types root + initial secondary types lookup location.
10671063
* More type directives might appear in the program later as a result of loading actual source files;
10681064
* this list is only the set of defaults that are implicitly included.
10691065
*/
1070-
export function getAutomaticTypeDirectiveNames(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string[] {
1066+
export function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[] {
10711067
// Use explicit type list from tsconfig.json
10721068
if (options.types) {
10731069
return options.types;
@@ -1080,7 +1076,10 @@ namespace ts {
10801076
if (typeRoots) {
10811077
for (const root of typeRoots) {
10821078
if (host.directoryExists(root)) {
1083-
result = result.concat(host.getDirectories(root));
1079+
for (const typeDirectivePath of host.getDirectories(root)) {
1080+
// Return just the type directive names
1081+
result = result.concat(getBaseFileName(normalizePath(typeDirectivePath)));
1082+
}
10841083
}
10851084
}
10861085
}
@@ -1155,11 +1154,11 @@ namespace ts {
11551154
forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false));
11561155

11571156
// load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders
1158-
const typeReferences: string[] = getAutomaticTypeDirectiveNames(options, rootNames, host);
1157+
const typeReferences: string[] = getAutomaticTypeDirectiveNames(options, host);
11591158

11601159
if (typeReferences) {
1161-
const inferredRoot = getInferredTypesRoot(options, rootNames, host);
1162-
const containingFilename = combinePaths(inferredRoot, "__inferred type names__.ts");
1160+
// This containingFilename needs to match with the one used in managed-side
1161+
const containingFilename = combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts");
11631162
const resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
11641163
for (let i = 0; i < typeReferences.length; i++) {
11651164
processTypeReferenceDirective(typeReferences[i], resolutions[i]);

src/compiler/types.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,16 @@ namespace ts {
16121612
antecedent: FlowNode;
16131613
}
16141614

1615+
export type FlowType = Type | IncompleteType;
1616+
1617+
// Incomplete types occur during control flow analysis of loops. An IncompleteType
1618+
// is distinguished from a regular type by a flags value of zero. Incomplete type
1619+
// objects are internal to the getFlowTypeOfRefecence function and never escape it.
1620+
export interface IncompleteType {
1621+
flags: TypeFlags; // No flags set
1622+
type: Type; // The type marked incomplete
1623+
}
1624+
16151625
export interface AmdDependency {
16161626
path: string;
16171627
name: string;
@@ -2156,6 +2166,8 @@ namespace ts {
21562166
mapper?: TypeMapper; // Type mapper for instantiation alias
21572167
referenced?: boolean; // True if alias symbol has been referenced as a value
21582168
containingType?: UnionOrIntersectionType; // Containing union or intersection type for synthetic property
2169+
hasCommonType?: boolean; // True if constituents of synthetic property all have same type
2170+
isDiscriminantProperty?: boolean; // True if discriminant synthetic property
21592171
resolvedExports?: SymbolTable; // Resolved exports of module
21602172
exportsChecked?: boolean; // True if exports of external module have been checked
21612173
isDeclarationWithCollidingName?: boolean; // True if symbol is block scoped redeclaration
@@ -2906,6 +2918,7 @@ namespace ts {
29062918
directoryExists?(directoryName: string): boolean;
29072919
realpath?(path: string): string;
29082920
getCurrentDirectory?(): string;
2921+
getDirectories?(path: string): string[];
29092922
}
29102923

29112924
export interface ResolvedModule {

0 commit comments

Comments
 (0)