Allow multiple 'this' property assignments in Salsa

Fixes issue #6645

(cherry picked from commit 7259b9fd4aa29ffb83acfffd14f55e6bee8c5d87)
This commit is contained in:
Ryan Cavanaugh 2016-01-27 14:00:33 -08:00 committed by Bill Ticehurst
parent 6975e44346
commit 5de87e30c6
2 changed files with 16 additions and 1 deletions

View File

@ -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);
}
}

View 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(`[]`);