Skip to content

Commit 8dba4d6

Browse files
committed
Merge branch 'master' of https://github.com/Microsoft/TypeScript into bug/29880
2 parents 6cd9921 + 7ff97d1 commit 8dba4d6

File tree

552 files changed

+42127
-5411
lines changed

Some content is hidden

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

552 files changed

+42127
-5411
lines changed

README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
2-
[![VSTS Build Status](https://dev.azure.com/typescript/TypeScript/_apis/build/status/Typescript/node10)](https://dev.azure.com/typescript/TypeScript/_build/latest?definitionId=4&view=logs)
3-
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
4-
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
51

62
# TypeScript
73

84
[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5+
[![Build Status](https://travis-ci.org/microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
6+
[![VSTS Build Status](https://dev.azure.com/typescript/TypeScript/_apis/build/status/Typescript/node10)](https://dev.azure.com/typescript/TypeScript/_build/latest?definitionId=4&view=logs)
7+
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
8+
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
9+
10+
911

1012
[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescript).
1113

@@ -28,14 +30,14 @@ npm install -g typescript@next
2830
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
2931
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
3032
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
31-
* Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript).
33+
* Engage with other TypeScript users and developers on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript).
3234
* Join the [#typescript](https://twitter.com/search?q=%23TypeScript) discussion on Twitter.
3335
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
3436
* Read the language specification ([docx](https://github.com/Microsoft/TypeScript/blob/master/doc/TypeScript%20Language%20Specification.docx?raw=true),
3537
[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)).
3638

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

4143
## Documentation
@@ -71,17 +73,17 @@ npm install
7173
Use one of the following to build and test:
7274

7375
```
74-
gulp local # Build the compiler into built/local
75-
gulp clean # Delete the built compiler
76+
gulp local # Build the compiler into built/local
77+
gulp clean # Delete the built compiler
7678
gulp LKG # Replace the last known good with the built one.
7779
# Bootstrapping step to be executed when the built compiler reaches a stable state.
78-
gulp tests # Build the test infrastructure using the built compiler.
79-
gulp runtests # Run tests using the built compiler and test infrastructure.
80-
# You can override the host or specify a test for this command.
81-
# Use --host=<hostName> or --tests=<testPath>.
80+
gulp tests # Build the test infrastructure using the built compiler.
81+
gulp runtests # Run tests using the built compiler and test infrastructure.
82+
# You can override the host or specify a test for this command.
83+
# Use --host=<hostName> or --tests=<testPath>.
8284
gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
8385
gulp lint # Runs tslint on the TypeScript source.
84-
gulp help # List the above commands.
86+
gulp help # List the above commands.
8587
```
8688

8789

src/compiler/binder.ts

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2515,7 +2515,7 @@ namespace ts {
25152515
break;
25162516

25172517
default:
2518-
Debug.fail(Debug.showSyntaxKind(thisContainer));
2518+
Debug.failBadSyntaxKind(thisContainer);
25192519
}
25202520
}
25212521

@@ -2581,7 +2581,7 @@ namespace ts {
25812581
// Fix up parent pointers since we're going to use these nodes before we bind into them
25822582
node.left.parent = node;
25832583
node.right.parent = node;
2584-
if (isIdentifier(lhs.expression) && container === file && isNameOfExportsOrModuleExportsAliasDeclaration(file, lhs.expression)) {
2584+
if (isIdentifier(lhs.expression) && container === file && isExportsOrModuleExportsOrAlias(file, lhs.expression)) {
25852585
// This can be an alias for the 'exports' or 'module.exports' names, e.g.
25862586
// var util = module.exports;
25872587
// util.property = function ...
@@ -2975,21 +2975,27 @@ namespace ts {
29752975
}
29762976

29772977
export function isExportsOrModuleExportsOrAlias(sourceFile: SourceFile, node: Expression): boolean {
2978-
return isExportsIdentifier(node) ||
2979-
isModuleExportsPropertyAccessExpression(node) ||
2980-
isIdentifier(node) && isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node);
2981-
}
2982-
2983-
function isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile: SourceFile, node: Identifier): boolean {
2984-
const symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText);
2985-
return !!symbol && !!symbol.valueDeclaration && isVariableDeclaration(symbol.valueDeclaration) &&
2986-
!!symbol.valueDeclaration.initializer && isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, symbol.valueDeclaration.initializer);
2987-
}
2988-
2989-
function isExportsOrModuleExportsOrAliasOrAssignment(sourceFile: SourceFile, node: Expression): boolean {
2990-
return isExportsOrModuleExportsOrAlias(sourceFile, node) ||
2991-
(isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) && (
2992-
isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.left) || isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.right)));
2978+
let i = 0;
2979+
const q = [node];
2980+
while (q.length && i < 100) {
2981+
i++;
2982+
node = q.shift()!;
2983+
if (isExportsIdentifier(node) || isModuleExportsPropertyAccessExpression(node)) {
2984+
return true;
2985+
}
2986+
else if (isIdentifier(node)) {
2987+
const symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText);
2988+
if (!!symbol && !!symbol.valueDeclaration && isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
2989+
const init = symbol.valueDeclaration.initializer;
2990+
q.push(init);
2991+
if (isAssignmentExpression(init, /*excludeCompoundAssignment*/ true)) {
2992+
q.push(init.left);
2993+
q.push(init.right);
2994+
}
2995+
}
2996+
}
2997+
}
2998+
return false;
29932999
}
29943000

29953001
function lookupSymbolForNameWorker(container: Node, name: __String): Symbol | undefined {

0 commit comments

Comments
 (0)