Fix multiple Salsa assignment-declarations
Previously, all assignment-declarations needed to be of the same kind: either all `this.p = ...` assignments or `C.prototype.p = ...` assignments.
This commit is contained in:
parent
f0d5ff6c94
commit
4721b91527
1 changed files with 11 additions and 11 deletions
|
@ -3166,17 +3166,17 @@ namespace ts {
|
|||
}
|
||||
|
||||
let type: Type = undefined;
|
||||
// Handle module.exports = expr or this.p = expr
|
||||
if (declaration.kind === SyntaxKind.BinaryExpression) {
|
||||
type = getUnionType(map(symbol.declarations, (decl: BinaryExpression) => checkExpressionCached(decl.right)));
|
||||
}
|
||||
else if (declaration.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
// Declarations only exist for property access expressions for certain
|
||||
// special assignment kinds
|
||||
if (declaration.parent.kind === SyntaxKind.BinaryExpression) {
|
||||
// Handle exports.p = expr or className.prototype.method = expr
|
||||
type = checkExpressionCached((<BinaryExpression>declaration.parent).right);
|
||||
}
|
||||
// Handle certain special assignment kinds, which happen to union across multiple declarations:
|
||||
// * module.exports = expr
|
||||
// * exports.p = expr
|
||||
// * this.p = expr
|
||||
// * className.prototype.method = expr
|
||||
if (declaration.kind === SyntaxKind.BinaryExpression ||
|
||||
declaration.kind === SyntaxKind.PropertyAccessExpression && declaration.parent.kind === SyntaxKind.BinaryExpression) {
|
||||
type = getUnionType(map(symbol.declarations,
|
||||
decl => decl.kind === SyntaxKind.BinaryExpression ?
|
||||
checkExpressionCached((<BinaryExpression>decl).right) :
|
||||
checkExpressionCached((<BinaryExpression>decl.parent).right)));
|
||||
}
|
||||
|
||||
if (type === undefined) {
|
||||
|
|
Loading…
Reference in a new issue