Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into useReturnedThisFrom…
Browse files Browse the repository at this point in the history
…SuperCalls
  • Loading branch information
DanielRosenwasser committed Sep 19, 2016
2 parents f11c646 + bbf80a7 commit a63a0d8
Show file tree
Hide file tree
Showing 2,836 changed files with 82,115 additions and 28,426 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ internal/
!tests/cases/projects/projectOption/**/node_modules
!tests/cases/projects/NodeModulesSearch/**/*
!tests/baselines/reference/project/nodeModules*/**/*
.idea
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ matrix:
branches:
only:
- master
- release.2.0
- release-2.0

install:
- npm uninstall typescript
Expand Down
4 changes: 0 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ In general, things we find useful when reviewing suggestions are:

# Instructions for Contributing Code

## Code of Conduct

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.

## Contributing bug fixes

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.
Expand Down
18 changes: 11 additions & 7 deletions Gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ const gulp = helpMaker(originalGulp);
const mochaParallel = require("./scripts/mocha-parallel.js");
const {runTestsInParallel} = mochaParallel;

Error.stackTraceLimit = 1000;

const cmdLineOptions = minimist(process.argv.slice(2), {
boolean: ["debug", "light", "colors", "lint", "soft"],
string: ["browser", "tests", "host", "reporter"],
string: ["browser", "tests", "host", "reporter", "stackTraceLimit"],
alias: {
d: "debug",
t: "tests",
Expand Down Expand Up @@ -559,6 +561,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
const debug = cmdLineOptions["debug"];
const tests = cmdLineOptions["tests"];
const light = cmdLineOptions["light"];
const stackTraceLimit = cmdLineOptions["stackTraceLimit"];
const testConfigFile = "test.config";
if (fs.existsSync(testConfigFile)) {
fs.unlinkSync(testConfigFile);
Expand All @@ -578,7 +581,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
}

if (tests || light || taskConfigsFolder) {
writeTestConfigFile(tests, light, taskConfigsFolder, workerCount);
writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit);
}

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

// used to pass data from jake command line directly to run.js
function writeTestConfigFile(tests: string, light: boolean, taskConfigsFolder?: string, workerCount?: number) {
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light: light, workerCount: workerCount, taskConfigsFolder: taskConfigsFolder });
function writeTestConfigFile(tests: string, light: boolean, taskConfigsFolder?: string, workerCount?: number, stackTraceLimit?: string) {
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder });
console.log("Running tests with config: " + testConfigContents);
fs.writeFileSync("test.config", testConfigContents);
}
Expand Down Expand Up @@ -887,7 +891,7 @@ gulp.task(loggedIOJsPath, false, [], (done) => {
const temp = path.join(builtLocalDirectory, "temp");
mkdirP(temp, (err) => {
if (err) { console.error(err); done(err); process.exit(1); };
exec(host, [LKGCompiler, "--outdir", temp, loggedIOpath], () => {
exec(host, [LKGCompiler, "--types --outdir", temp, loggedIOpath], () => {
fs.renameSync(path.join(temp, "/harness/loggedIO.js"), loggedIOJsPath);
del(temp).then(() => done(), done);
}, done);
Expand All @@ -908,8 +912,8 @@ gulp.task(instrumenterJsPath, false, [servicesFile], () => {
.pipe(gulp.dest("."));
});

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

gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", serverFile], () => {
Expand Down
38 changes: 27 additions & 11 deletions Jakefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,28 @@ var servicesSources = [
].map(function (f) {
return path.join(compilerDirectory, f);
}).concat([
"types.ts",
"utilities.ts",
"breakpoints.ts",
"classifier.ts",
"completions.ts",
"documentHighlights.ts",
"documentRegistry.ts",
"findAllReferences.ts",
"goToDefinition.ts",
"jsDoc.ts",
"jsTyping.ts",
"navigateTo.ts",
"navigationBar.ts",
"outliningElementsCollector.ts",
"patternMatcher.ts",
"preProcess.ts",
"rename.ts",
"services.ts",
"shims.ts",
"signatureHelp.ts",
"types.ts",
"utilities.ts",
"symbolDisplay.ts",
"transpile.ts",
"formatting/formatting.ts",
"formatting/formattingContext.ts",
"formatting/formattingRequestKind.ts",
Expand Down Expand Up @@ -204,6 +216,7 @@ var harnessSources = harnessCoreSources.concat([
"moduleResolution.ts",
"tsconfigParsing.ts",
"commandLineParsing.ts",
"configurationExtension.ts",
"convertCompilerOptionsFromJson.ts",
"convertTypingOptionsFromJson.ts",
"tsserverProjectSystem.ts",
Expand Down Expand Up @@ -992,15 +1005,18 @@ function acceptBaseline(containerFolder) {
var deleteEnding = '.delete';
for (var i in files) {
var filename = files[i];
if (filename.substr(filename.length - deleteEnding.length) === deleteEnding) {
filename = filename.substr(0, filename.length - deleteEnding.length);
fs.unlinkSync(path.join(targetFolder, filename));
} else {
var target = path.join(targetFolder, filename);
if (fs.existsSync(target)) {
fs.unlinkSync(target);
var fullLocalPath = path.join(sourceFolder, filename);
if (fs.statSync(fullLocalPath).isFile()) {
if (filename.substr(filename.length - deleteEnding.length) === deleteEnding) {
filename = filename.substr(0, filename.length - deleteEnding.length);
fs.unlinkSync(path.join(targetFolder, filename));
} else {
var target = path.join(targetFolder, filename);
if (fs.existsSync(target)) {
fs.unlinkSync(target);
}
fs.renameSync(path.join(sourceFolder, filename), target);
}
fs.renameSync(path.join(sourceFolder, filename), target);
}
}
}
Expand Down Expand Up @@ -1039,7 +1055,7 @@ var loggedIOJsPath = builtLocalDirectory + 'loggedIO.js';
file(loggedIOJsPath, [builtLocalDirectory, loggedIOpath], function () {
var temp = builtLocalDirectory + 'temp';
jake.mkdirP(temp);
var options = "--outdir " + temp + ' ' + loggedIOpath;
var options = "--types --outdir " + temp + ' ' + loggedIOpath;
var cmd = host + " " + LKGDirectory + compilerFilename + " " + options + " ";
console.log(cmd + "\n");
var ex = jake.createExec([cmd]);
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
* 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)).
* 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)).

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.

## Documentation

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

## Roadmap

For details on our planned features and future direction please refer to our [roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap).
For details on our planned features and future direction please refer to our [roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap).
4 changes: 2 additions & 2 deletions lib/lib.es2015.collection.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface Map<K, V> {
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
get(key: K): V | undefined;
has(key: K): boolean;
set(key: K, value?: V): this;
set(key: K, value: V): this;
readonly size: number;
}

Expand All @@ -36,7 +36,7 @@ interface WeakMap<K, V> {
delete(key: K): boolean;
get(key: K): V | undefined;
has(key: K): boolean;
set(key: K, value?: V): this;
set(key: K, value: V): this;
}

interface WeakMapConstructor {
Expand Down
4 changes: 2 additions & 2 deletions lib/lib.es2015.proxy.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface ProxyHandler<T> {
setPrototypeOf? (target: T, v: any): boolean;
isExtensible? (target: T): boolean;
preventExtensions? (target: T): boolean;
getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor;
getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor | undefined;
has? (target: T, p: PropertyKey): boolean;
get? (target: T, p: PropertyKey, receiver: any): any;
set? (target: T, p: PropertyKey, value: any, receiver: any): boolean;
Expand All @@ -35,4 +35,4 @@ interface ProxyConstructor {
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
new <T>(target: T, handler: ProxyHandler<T>): T
}
declare var Proxy: ProxyConstructor;
declare var Proxy: ProxyConstructor;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"ts-node": "latest",
"tsd": "latest",
"tslint": "next",
"typescript": "2.1.0-dev.20160906"
"typescript": "next"
},
"scripts": {
"pretest": "jake tests",
Expand Down
51 changes: 13 additions & 38 deletions scripts/tslint/preferConstRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,12 @@ export class Rule extends Lint.Rules.AbstractRule {
}
}

function isBindingPattern(node: ts.Node): node is ts.BindingPattern {
return !!node && (node.kind === ts.SyntaxKind.ArrayBindingPattern || node.kind === ts.SyntaxKind.ObjectBindingPattern);
}

function walkUpBindingElementsAndPatterns(node: ts.Node): ts.Node {
while (node && (node.kind === ts.SyntaxKind.BindingElement || isBindingPattern(node))) {
node = node.parent;
}

return node;
}

function getCombinedNodeFlags(node: ts.Node): ts.NodeFlags {
node = walkUpBindingElementsAndPatterns(node);

let flags = node.flags;
if (node.kind === ts.SyntaxKind.VariableDeclaration) {
node = node.parent;
}

if (node && node.kind === ts.SyntaxKind.VariableDeclarationList) {
flags |= node.flags;
node = node.parent;
}

if (node && node.kind === ts.SyntaxKind.VariableStatement) {
flags |= node.flags;
}

return flags;
}

function isLet(node: ts.Node) {
return !!(getCombinedNodeFlags(node) & ts.NodeFlags.Let);
return !!(ts.getCombinedNodeFlags(node) & ts.NodeFlags.Let);
}

function isExported(node: ts.Node) {
return !!(getCombinedNodeFlags(node) & ts.NodeFlags.Export);
return !!(ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export);
}

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

private visitBindingPatternIdentifiers(pattern: ts.BindingPattern) {
for (const element of pattern.elements) {
if (element.name.kind === ts.SyntaxKind.Identifier) {
this.markAssignment(element.name as ts.Identifier);
if (element.kind !== ts.SyntaxKind.BindingElement) {
continue;
}

const name = (<ts.BindingElement>element).name;
if (name.kind === ts.SyntaxKind.Identifier) {
this.markAssignment(name as ts.Identifier);
}
else {
this.visitBindingPatternIdentifiers(element.name as ts.BindingPattern);
this.visitBindingPatternIdentifiers(name as ts.BindingPattern);
}
}
}
Expand Down Expand Up @@ -223,7 +196,9 @@ class PreferConstWalker extends Lint.RuleWalker {

private collectBindingPatternIdentifiers(value: ts.VariableDeclaration, pattern: ts.BindingPattern, table: ts.MapLike<DeclarationUsages>) {
for (const element of pattern.elements) {
this.collectNameIdentifiers(value, element.name, table);
if (element.kind === ts.SyntaxKind.BindingElement) {
this.collectNameIdentifiers(value, (<ts.BindingElement>element).name, table);
}
}
}
}
17 changes: 15 additions & 2 deletions src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ namespace ts {
case SyntaxKind.PrefixUnaryExpression:
bindPrefixUnaryExpressionFlow(<PrefixUnaryExpression>node);
break;
case SyntaxKind.PostfixUnaryExpression:
bindPostfixUnaryExpressionFlow(<PostfixUnaryExpression>node);
break;
case SyntaxKind.BinaryExpression:
bindBinaryExpressionFlow(<BinaryExpression>node);
break;
Expand Down Expand Up @@ -1106,6 +1109,16 @@ namespace ts {
}
else {
forEachChild(node, bind);
if (node.operator === SyntaxKind.PlusEqualsToken || node.operator === SyntaxKind.MinusMinusToken) {
bindAssignmentTargetFlow(node.operand);
}
}
}

function bindPostfixUnaryExpressionFlow(node: PostfixUnaryExpression) {
forEachChild(node, bind);
if (node.operator === SyntaxKind.PlusPlusToken || node.operator === SyntaxKind.MinusMinusToken) {
bindAssignmentTargetFlow(node.operand);
}
}

Expand Down Expand Up @@ -1150,8 +1163,8 @@ namespace ts {
currentFlow = finishFlowLabel(postExpressionLabel);
}

function bindInitializedVariableFlow(node: VariableDeclaration | BindingElement) {
const name = node.name;
function bindInitializedVariableFlow(node: VariableDeclaration | ArrayBindingElement) {
const name = !isOmittedExpression(node) ? node.name : undefined;
if (isBindingPattern(name)) {
for (const child of name.elements) {
bindInitializedVariableFlow(child);
Expand Down
Loading

0 comments on commit a63a0d8

Please sign in to comment.