Merge pull request #6679 from RyanCavanaugh/fix6645
Allow multiple 'this' property assignments in Salsa
This commit is contained in:
commit
554ea1b57c
|
@ -1435,7 +1435,8 @@ namespace ts {
|
|||
// Declare a 'member' in case it turns out the container was an ES5 class
|
||||
if (container.kind === SyntaxKind.FunctionExpression || container.kind === SyntaxKind.FunctionDeclaration) {
|
||||
container.symbol.members = container.symbol.members || {};
|
||||
declareSymbol(container.symbol.members, container.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
||||
// It's acceptable for multiple 'this' assignments of the same identifier to occur
|
||||
declareSymbol(container.symbol.members, container.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2837,7 +2837,7 @@ namespace ts {
|
|||
}
|
||||
// Handle module.exports = expr
|
||||
if (declaration.kind === SyntaxKind.BinaryExpression) {
|
||||
return links.type = checkExpression((<BinaryExpression>declaration).right);
|
||||
return links.type = getUnionType(map(symbol.declarations, (decl: BinaryExpression) => checkExpressionCached(decl.right)));
|
||||
}
|
||||
if (declaration.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
// Declarations only exist for property access expressions for certain
|
||||
|
|
14
tests/cases/fourslash/getJavaScriptSemanticDiagnostics23.ts
Normal file
14
tests/cases/fourslash/getJavaScriptSemanticDiagnostics23.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
//// function Person(age) {
|
||||
//// if (age >= 18) {
|
||||
//// this.canVote = true;
|
||||
//// } else {
|
||||
//// this.canVote = false;
|
||||
//// }
|
||||
//// }
|
||||
|
||||
verify.getSyntacticDiagnostics(`[]`);
|
||||
verify.getSemanticDiagnostics(`[]`);
|
16
tests/cases/fourslash/getJavaScriptSemanticDiagnostics24.ts
Normal file
16
tests/cases/fourslash/getJavaScriptSemanticDiagnostics24.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
//// function Person(age) {
|
||||
//// if (age >= 18) {
|
||||
//// this.canVote = true;
|
||||
//// } else {
|
||||
//// this.canVote = 23;
|
||||
//// }
|
||||
//// }
|
||||
//// let x = new Person(100);
|
||||
//// x.canVote/**/;
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs('(property) Person.canVote: boolean | number');
|
Loading…
Reference in a new issue