Skip to content

Commit 7259b9f

Browse files
committed
Allow multiple 'this' property assignments in Salsa
Fixes issue #6645
1 parent fd879bb commit 7259b9f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/compiler/binder.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,8 @@ namespace ts {
14351435
// Declare a 'member' in case it turns out the container was an ES5 class
14361436
if (container.kind === SyntaxKind.FunctionExpression || container.kind === SyntaxKind.FunctionDeclaration) {
14371437
container.symbol.members = container.symbol.members || {};
1438-
declareSymbol(container.symbol.members, container.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
1438+
// It's acceptable for multiple 'this' assignments of the same identifier to occur
1439+
declareSymbol(container.symbol.members, container.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
14391440
}
14401441
}
14411442

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @allowJs: true
4+
// @Filename: a.js
5+
//// function Person(age) {
6+
//// if (age >= 18) {
7+
//// this.canVote = true;
8+
//// } else {
9+
//// this.canVote = false;
10+
//// }
11+
//// }
12+
13+
verify.getSyntacticDiagnostics(`[]`);
14+
verify.getSemanticDiagnostics(`[]`);

0 commit comments

Comments
 (0)