Allow multiple 'this' property assignments in Salsa

Fixes issue #6645
This commit is contained in:
Ryan Cavanaugh
2016-01-27 14:00:33 -08:00
parent fd879bb268
commit 7259b9fd4a
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(`[]`);