mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-11 01:34:55 -06:00
Allow multiple 'this' property assignments in Salsa
Fixes issue #6645 (cherry picked from commit 7259b9fd4aa29ffb83acfffd14f55e6bee8c5d87)
This commit is contained in:
parent
6975e44346
commit
5de87e30c6
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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(`[]`);
|
||||
Loading…
x
Reference in New Issue
Block a user