Skip to content

Commit

Permalink
Merge pull request #38434 from typescript-bot/pick/38270/release-3.9
Browse files Browse the repository at this point in the history
🤖 Pick PR #38270 (Improve assert message in binder) into release-3.9
  • Loading branch information
DanielRosenwasser authored May 8, 2020
2 parents a073560 + 7eb4cde commit 8bd8a88
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2977,23 +2977,22 @@ namespace ts {
// util.property = function ...
bindExportsPropertyAssignment(node as BindableStaticPropertyAssignmentExpression);
}
else if (hasDynamicName(node)) {
bindAnonymousDeclaration(node, SymbolFlags.Property | SymbolFlags.Assignment, InternalSymbolName.Computed);
const sym = bindPotentiallyMissingNamespaces(parentSymbol, node.left.expression, isTopLevelNamespaceAssignment(node.left), /*isPrototype*/ false, /*containerIsClass*/ false);
addLateBoundAssignmentDeclarationToSymbol(node, sym);
}
else {
if (hasDynamicName(node)) {
bindAnonymousDeclaration(node, SymbolFlags.Property | SymbolFlags.Assignment, InternalSymbolName.Computed);
const sym = bindPotentiallyMissingNamespaces(parentSymbol, node.left.expression, isTopLevelNamespaceAssignment(node.left), /*isPrototype*/ false, /*containerIsClass*/ false);
addLateBoundAssignmentDeclarationToSymbol(node, sym);
}
else {
bindStaticPropertyAssignment(cast(node.left, isBindableStaticAccessExpression));
}
bindStaticPropertyAssignment(cast(node.left, isBindableStaticNameExpression));
}
}

/**
* For nodes like `x.y = z`, declare a member 'y' on 'x' if x is a function (or IIFE) or class or {}, or not declared.
* Also works for expression statements preceded by JSDoc, like / ** @type number * / x.y;
*/
function bindStaticPropertyAssignment(node: BindableStaticAccessExpression) {
function bindStaticPropertyAssignment(node: BindableStaticNameExpression) {
Debug.assert(!isIdentifier(node));
node.expression.parent = node;
bindPropertyAssignment(node.expression, node, /*isPrototypeProperty*/ false, /*containerIsClass*/ false);
}
Expand Down

0 comments on commit 8bd8a88

Please sign in to comment.