Skip to content

Commit ea3752a

Browse files
committed
Merge remote-tracking branch 'origin/master' into go_to_implementation_pr
Refactored goToImplementation out of services
2 parents b6f7dd7 + e9178a5 commit ea3752a

File tree

2,832 files changed

+82199
-28775
lines changed

Some content is hidden

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

2,832 files changed

+82199
-28775
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,4 @@ internal/
5454
!tests/cases/projects/projectOption/**/node_modules
5555
!tests/cases/projects/NodeModulesSearch/**/*
5656
!tests/baselines/reference/project/nodeModules*/**/*
57+
.idea

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ matrix:
2323
branches:
2424
only:
2525
- master
26-
- transforms
26+
- release-2.0
2727

2828
install:
2929
- npm uninstall typescript

CONTRIBUTING.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ In general, things we find useful when reviewing suggestions are:
4040

4141
# Instructions for Contributing Code
4242

43-
## Code of Conduct
44-
45-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
46-
4743
## Contributing bug fixes
4844

4945
TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.

Gulpfile.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ const gulp = helpMaker(originalGulp);
3939
const mochaParallel = require("./scripts/mocha-parallel.js");
4040
const {runTestsInParallel} = mochaParallel;
4141

42+
Error.stackTraceLimit = 1000;
43+
4244
const cmdLineOptions = minimist(process.argv.slice(2), {
4345
boolean: ["debug", "light", "colors", "lint", "soft"],
44-
string: ["browser", "tests", "host", "reporter"],
46+
string: ["browser", "tests", "host", "reporter", "stackTraceLimit"],
4547
alias: {
4648
d: "debug",
4749
t: "tests",
@@ -559,6 +561,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
559561
const debug = cmdLineOptions["debug"];
560562
const tests = cmdLineOptions["tests"];
561563
const light = cmdLineOptions["light"];
564+
const stackTraceLimit = cmdLineOptions["stackTraceLimit"];
562565
const testConfigFile = "test.config";
563566
if (fs.existsSync(testConfigFile)) {
564567
fs.unlinkSync(testConfigFile);
@@ -578,7 +581,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
578581
}
579582

580583
if (tests || light || taskConfigsFolder) {
581-
writeTestConfigFile(tests, light, taskConfigsFolder, workerCount);
584+
writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit);
582585
}
583586

584587
if (tests && tests.toLocaleLowerCase() === "rwc") {
@@ -727,6 +730,7 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo
727730
sourcemaps: {
728731
"built/local/_stream_0.js": originalMap,
729732
"built/local/bundle.js": maps,
733+
"node_modules/source-map-support/source-map-support.js": undefined,
730734
}
731735
});
732736
const finalMap = chain.apply();
@@ -756,8 +760,8 @@ function cleanTestDirs(done: (e?: any) => void) {
756760
}
757761

758762
// used to pass data from jake command line directly to run.js
759-
function writeTestConfigFile(tests: string, light: boolean, taskConfigsFolder?: string, workerCount?: number) {
760-
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light: light, workerCount: workerCount, taskConfigsFolder: taskConfigsFolder });
763+
function writeTestConfigFile(tests: string, light: boolean, taskConfigsFolder?: string, workerCount?: number, stackTraceLimit?: string) {
764+
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder });
761765
console.log("Running tests with config: " + testConfigContents);
762766
fs.writeFileSync("test.config", testConfigContents);
763767
}
@@ -887,7 +891,7 @@ gulp.task(loggedIOJsPath, false, [], (done) => {
887891
const temp = path.join(builtLocalDirectory, "temp");
888892
mkdirP(temp, (err) => {
889893
if (err) { console.error(err); done(err); process.exit(1); };
890-
exec(host, [LKGCompiler, "--outdir", temp, loggedIOpath], () => {
894+
exec(host, [LKGCompiler, "--types --outdir", temp, loggedIOpath], () => {
891895
fs.renameSync(path.join(temp, "/harness/loggedIO.js"), loggedIOJsPath);
892896
del(temp).then(() => done(), done);
893897
}, done);
@@ -908,8 +912,8 @@ gulp.task(instrumenterJsPath, false, [servicesFile], () => {
908912
.pipe(gulp.dest("."));
909913
});
910914

911-
gulp.task("tsc-instrumented", "Builds an instrumented tsc.js", [loggedIOJsPath, instrumenterJsPath, servicesFile], (done) => {
912-
exec(host, [instrumenterJsPath, "record", "iocapture", builtLocalDirectory, compilerFilename], done, done);
915+
gulp.task("tsc-instrumented", "Builds an instrumented tsc.js", ["local", loggedIOJsPath, instrumenterJsPath, servicesFile], (done) => {
916+
exec(host, [instrumenterJsPath, "record", "iocapture", builtLocalCompiler], done, done);
913917
});
914918

915919
gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", serverFile], () => {

Jakefile.js

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,29 @@ var servicesSources = [
120120
].map(function (f) {
121121
return path.join(compilerDirectory, f);
122122
}).concat([
123+
"types.ts",
124+
"utilities.ts",
123125
"breakpoints.ts",
126+
"classifier.ts",
127+
"completions.ts",
128+
"documentHighlights.ts",
129+
"documentRegistry.ts",
130+
"findAllReferences.ts",
131+
"goToDefinition.ts",
132+
"goToImplementation.ts",
133+
"jsDoc.ts",
134+
"jsTyping.ts",
124135
"navigateTo.ts",
125136
"navigationBar.ts",
126137
"outliningElementsCollector.ts",
127138
"patternMatcher.ts",
139+
"preProcess.ts",
140+
"rename.ts",
128141
"services.ts",
129142
"shims.ts",
130143
"signatureHelp.ts",
131-
"types.ts",
132-
"utilities.ts",
144+
"symbolDisplay.ts",
145+
"transpile.ts",
133146
"formatting/formatting.ts",
134147
"formatting/formattingContext.ts",
135148
"formatting/formattingRequestKind.ts",
@@ -204,6 +217,7 @@ var harnessSources = harnessCoreSources.concat([
204217
"moduleResolution.ts",
205218
"tsconfigParsing.ts",
206219
"commandLineParsing.ts",
220+
"configurationExtension.ts",
207221
"convertCompilerOptionsFromJson.ts",
208222
"convertTypingOptionsFromJson.ts",
209223
"tsserverProjectSystem.ts",
@@ -776,7 +790,7 @@ function cleanTestDirs() {
776790

777791
// used to pass data from jake command line directly to run.js
778792
function writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit) {
779-
var testConfigContents = JSON.stringify({
793+
var testConfigContents = JSON.stringify({
780794
test: tests ? [tests] : undefined,
781795
light: light,
782796
workerCount: workerCount,
@@ -992,15 +1006,18 @@ function acceptBaseline(containerFolder) {
9921006
var deleteEnding = '.delete';
9931007
for (var i in files) {
9941008
var filename = files[i];
995-
if (filename.substr(filename.length - deleteEnding.length) === deleteEnding) {
996-
filename = filename.substr(0, filename.length - deleteEnding.length);
997-
fs.unlinkSync(path.join(targetFolder, filename));
998-
} else {
999-
var target = path.join(targetFolder, filename);
1000-
if (fs.existsSync(target)) {
1001-
fs.unlinkSync(target);
1009+
var fullLocalPath = path.join(sourceFolder, filename);
1010+
if (fs.statSync(fullLocalPath).isFile()) {
1011+
if (filename.substr(filename.length - deleteEnding.length) === deleteEnding) {
1012+
filename = filename.substr(0, filename.length - deleteEnding.length);
1013+
fs.unlinkSync(path.join(targetFolder, filename));
1014+
} else {
1015+
var target = path.join(targetFolder, filename);
1016+
if (fs.existsSync(target)) {
1017+
fs.unlinkSync(target);
1018+
}
1019+
fs.renameSync(path.join(sourceFolder, filename), target);
10021020
}
1003-
fs.renameSync(path.join(sourceFolder, filename), target);
10041021
}
10051022
}
10061023
}
@@ -1039,7 +1056,7 @@ var loggedIOJsPath = builtLocalDirectory + 'loggedIO.js';
10391056
file(loggedIOJsPath, [builtLocalDirectory, loggedIOpath], function () {
10401057
var temp = builtLocalDirectory + 'temp';
10411058
jake.mkdirP(temp);
1042-
var options = "--outdir " + temp + ' ' + loggedIOpath;
1059+
var options = "--types --outdir " + temp + ' ' + loggedIOpath;
10431060
var cmd = host + " " + LKGDirectory + compilerFilename + " " + options + " ";
10441061
console.log(cmd + "\n");
10451062
var ex = jake.createExec([cmd]);

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob
3030
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
3131
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
3232
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
33-
* Read the language specification ([docx](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true), [pdf](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.pdf?raw=true), [md](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)).
33+
* Read the language specification ([docx](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true),
34+
[pdf](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.pdf?raw=true), [md](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)).
3435

36+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see
37+
the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected])
38+
with any additional questions or comments.
3539

3640
## Documentation
3741

@@ -91,4 +95,4 @@ node built/local/tsc.js hello.ts
9195

9296
## Roadmap
9397

94-
For details on our planned features and future direction please refer to our [roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap).
98+
For details on our planned features and future direction please refer to our [roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap).

lib/lib.es2015.collection.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface Map<K, V> {
2020
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
2121
get(key: K): V | undefined;
2222
has(key: K): boolean;
23-
set(key: K, value?: V): this;
23+
set(key: K, value: V): this;
2424
readonly size: number;
2525
}
2626

@@ -36,7 +36,7 @@ interface WeakMap<K, V> {
3636
delete(key: K): boolean;
3737
get(key: K): V | undefined;
3838
has(key: K): boolean;
39-
set(key: K, value?: V): this;
39+
set(key: K, value: V): this;
4040
}
4141

4242
interface WeakMapConstructor {

lib/lib.es2015.proxy.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface ProxyHandler<T> {
1919
setPrototypeOf? (target: T, v: any): boolean;
2020
isExtensible? (target: T): boolean;
2121
preventExtensions? (target: T): boolean;
22-
getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor;
22+
getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor | undefined;
2323
has? (target: T, p: PropertyKey): boolean;
2424
get? (target: T, p: PropertyKey, receiver: any): any;
2525
set? (target: T, p: PropertyKey, value: any, receiver: any): boolean;
@@ -35,4 +35,4 @@ interface ProxyConstructor {
3535
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
3636
new <T>(target: T, handler: ProxyHandler<T>): T
3737
}
38-
declare var Proxy: ProxyConstructor;
38+
declare var Proxy: ProxyConstructor;

scripts/tslint/preferConstRule.ts

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,12 @@ export class Rule extends Lint.Rules.AbstractRule {
99
}
1010
}
1111

12-
function isBindingPattern(node: ts.Node): node is ts.BindingPattern {
13-
return !!node && (node.kind === ts.SyntaxKind.ArrayBindingPattern || node.kind === ts.SyntaxKind.ObjectBindingPattern);
14-
}
15-
16-
function walkUpBindingElementsAndPatterns(node: ts.Node): ts.Node {
17-
while (node && (node.kind === ts.SyntaxKind.BindingElement || isBindingPattern(node))) {
18-
node = node.parent;
19-
}
20-
21-
return node;
22-
}
23-
24-
function getCombinedNodeFlags(node: ts.Node): ts.NodeFlags {
25-
node = walkUpBindingElementsAndPatterns(node);
26-
27-
let flags = node.flags;
28-
if (node.kind === ts.SyntaxKind.VariableDeclaration) {
29-
node = node.parent;
30-
}
31-
32-
if (node && node.kind === ts.SyntaxKind.VariableDeclarationList) {
33-
flags |= node.flags;
34-
node = node.parent;
35-
}
36-
37-
if (node && node.kind === ts.SyntaxKind.VariableStatement) {
38-
flags |= node.flags;
39-
}
40-
41-
return flags;
42-
}
43-
4412
function isLet(node: ts.Node) {
45-
return !!(getCombinedNodeFlags(node) & ts.NodeFlags.Let);
13+
return !!(ts.getCombinedNodeFlags(node) & ts.NodeFlags.Let);
4614
}
4715

4816
function isExported(node: ts.Node) {
49-
return !!(getCombinedNodeFlags(node) & ts.NodeFlags.Export);
17+
return !!(ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export);
5018
}
5119

5220
function isAssignmentOperator(token: ts.SyntaxKind): boolean {
@@ -125,11 +93,16 @@ class PreferConstWalker extends Lint.RuleWalker {
12593

12694
private visitBindingPatternIdentifiers(pattern: ts.BindingPattern) {
12795
for (const element of pattern.elements) {
128-
if (element.name.kind === ts.SyntaxKind.Identifier) {
129-
this.markAssignment(element.name as ts.Identifier);
96+
if (element.kind !== ts.SyntaxKind.BindingElement) {
97+
continue;
98+
}
99+
100+
const name = (<ts.BindingElement>element).name;
101+
if (name.kind === ts.SyntaxKind.Identifier) {
102+
this.markAssignment(name as ts.Identifier);
130103
}
131104
else {
132-
this.visitBindingPatternIdentifiers(element.name as ts.BindingPattern);
105+
this.visitBindingPatternIdentifiers(name as ts.BindingPattern);
133106
}
134107
}
135108
}
@@ -223,7 +196,9 @@ class PreferConstWalker extends Lint.RuleWalker {
223196

224197
private collectBindingPatternIdentifiers(value: ts.VariableDeclaration, pattern: ts.BindingPattern, table: ts.MapLike<DeclarationUsages>) {
225198
for (const element of pattern.elements) {
226-
this.collectNameIdentifiers(value, element.name, table);
199+
if (element.kind === ts.SyntaxKind.BindingElement) {
200+
this.collectNameIdentifiers(value, (<ts.BindingElement>element).name, table);
201+
}
227202
}
228203
}
229204
}

src/compiler/binder.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,9 @@ namespace ts {
591591
case SyntaxKind.PrefixUnaryExpression:
592592
bindPrefixUnaryExpressionFlow(<PrefixUnaryExpression>node);
593593
break;
594+
case SyntaxKind.PostfixUnaryExpression:
595+
bindPostfixUnaryExpressionFlow(<PostfixUnaryExpression>node);
596+
break;
594597
case SyntaxKind.BinaryExpression:
595598
bindBinaryExpressionFlow(<BinaryExpression>node);
596599
break;
@@ -1106,6 +1109,16 @@ namespace ts {
11061109
}
11071110
else {
11081111
forEachChild(node, bind);
1112+
if (node.operator === SyntaxKind.PlusEqualsToken || node.operator === SyntaxKind.MinusMinusToken) {
1113+
bindAssignmentTargetFlow(node.operand);
1114+
}
1115+
}
1116+
}
1117+
1118+
function bindPostfixUnaryExpressionFlow(node: PostfixUnaryExpression) {
1119+
forEachChild(node, bind);
1120+
if (node.operator === SyntaxKind.PlusPlusToken || node.operator === SyntaxKind.MinusMinusToken) {
1121+
bindAssignmentTargetFlow(node.operand);
11091122
}
11101123
}
11111124

@@ -1150,8 +1163,8 @@ namespace ts {
11501163
currentFlow = finishFlowLabel(postExpressionLabel);
11511164
}
11521165

1153-
function bindInitializedVariableFlow(node: VariableDeclaration | BindingElement) {
1154-
const name = node.name;
1166+
function bindInitializedVariableFlow(node: VariableDeclaration | ArrayBindingElement) {
1167+
const name = !isOmittedExpression(node) ? node.name : undefined;
11551168
if (isBindingPattern(name)) {
11561169
for (const child of name.elements) {
11571170
bindInitializedVariableFlow(child);

0 commit comments

Comments
 (0)