Skip to content

Commit 036a4ae

Browse files
Merge branch 'master'
2 parents 65a7587 + e6390ef commit 036a4ae

File tree

444 files changed

+8501
-1778
lines changed

Some content is hidden

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

444 files changed

+8501
-1778
lines changed

.github/ISSUE_TEMPLATE/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ contact_links:
1414
name: "TypeScript FAQ"
1515
url: "https://github.com./microsoft/TypeScript/wiki/FAQ"
1616
-
17-
about: "Please raise issues about the site on it's own repo."
17+
about: "Please raise issues about the site on its own repo."
1818
name: Website
1919
url: "https://github.com./microsoft/TypeScript-Website/issues/new"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "typescript",
33
"author": "Microsoft Corp.",
44
"homepage": "https://www.typescriptlang.org/",
5-
"version": "3.9.0",
5+
"version": "4.0.0",
66
"license": "Apache-2.0",
77
"description": "TypeScript is a language for application scale JavaScript development",
88
"keywords": [

src/compiler/binder.ts

+6-16
Original file line numberDiff line numberDiff line change
@@ -320,16 +320,6 @@ namespace ts {
320320
}
321321
}
322322

323-
function setValueDeclaration(symbol: Symbol, node: Declaration): void {
324-
const { valueDeclaration } = symbol;
325-
if (!valueDeclaration ||
326-
(isAssignmentDeclaration(valueDeclaration) && !isAssignmentDeclaration(node)) ||
327-
(valueDeclaration.kind !== node.kind && isEffectiveModuleDeclaration(valueDeclaration))) {
328-
// other kinds of value declarations take precedence over modules and assignment declarations
329-
symbol.valueDeclaration = node;
330-
}
331-
}
332-
333323
// Should not be called on a declaration with a computed property name,
334324
// unless it is a well known Symbol.
335325
function getDeclarationName(node: Declaration): __String | undefined {
@@ -423,7 +413,7 @@ namespace ts {
423413
function declareSymbol(symbolTable: SymbolTable, parent: Symbol | undefined, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags, isReplaceableByMethod?: boolean): Symbol {
424414
Debug.assert(!hasDynamicName(node));
425415

426-
const isDefaultExport = hasModifier(node, ModifierFlags.Default);
416+
const isDefaultExport = hasModifier(node, ModifierFlags.Default) || isExportSpecifier(node) && node.name.escapedText === "default";
427417

428418
// The exported symbol for an export default function/class node is always named "default"
429419
const name = isDefaultExport && parent ? InternalSymbolName.Default : getDeclarationName(node);
@@ -659,7 +649,7 @@ namespace ts {
659649
}
660650
// We create a return control flow graph for IIFEs and constructors. For constructors
661651
// we use the return control flow graph in strict property initialization checks.
662-
currentReturnTarget = isIIFE || node.kind === SyntaxKind.Constructor ? createBranchLabel() : undefined;
652+
currentReturnTarget = isIIFE || node.kind === SyntaxKind.Constructor || (isInJSFile && (node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.FunctionExpression)) ? createBranchLabel() : undefined;
663653
currentExceptionTarget = undefined;
664654
currentBreakTarget = undefined;
665655
currentContinueTarget = undefined;
@@ -680,8 +670,8 @@ namespace ts {
680670
if (currentReturnTarget) {
681671
addAntecedent(currentReturnTarget, currentFlow);
682672
currentFlow = finishFlowLabel(currentReturnTarget);
683-
if (node.kind === SyntaxKind.Constructor) {
684-
(<ConstructorDeclaration>node).returnFlowNode = currentFlow;
673+
if (node.kind === SyntaxKind.Constructor || (isInJSFile && (node.kind === SyntaxKind.FunctionDeclaration || node.kind === SyntaxKind.FunctionExpression))) {
674+
(<FunctionLikeDeclaration>node).returnFlowNode = currentFlow;
685675
}
686676
}
687677
if (!isIIFE) {
@@ -2974,7 +2964,7 @@ namespace ts {
29742964

29752965
function bindSpecialPropertyAssignment(node: BindablePropertyAssignmentExpression) {
29762966
// Class declarations in Typescript do not allow property declarations
2977-
const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression);
2967+
const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, container) || lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer) ;
29782968
if (!isInJSFile(node) && !isFunctionSymbol(parentSymbol)) {
29792969
return;
29802970
}
@@ -3083,7 +3073,7 @@ namespace ts {
30833073
}
30843074

30853075
function bindPropertyAssignment(name: BindableStaticNameExpression, propertyAccess: BindableStaticAccessExpression, isPrototypeProperty: boolean, containerIsClass: boolean) {
3086-
let namespaceSymbol = lookupSymbolForPropertyAccess(name);
3076+
let namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer);
30873077
const isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
30883078
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty, containerIsClass);
30893079
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);

0 commit comments

Comments
 (0)