@@ -1977,33 +1977,25 @@ namespace ts {
1977
1977
}
1978
1978
1979
1979
function bindThisPropertyAssignment ( node : BinaryExpression ) {
1980
+ Debug . assert ( isInJavaScriptFile ( node ) ) ;
1980
1981
// Declare a 'member' if the container is an ES5 class or ES6 constructor
1981
- let assignee : Node ;
1982
1982
if ( container . kind === SyntaxKind . FunctionDeclaration || container . kind === SyntaxKind . FunctionExpression ) {
1983
- assignee = container ;
1983
+ container . symbol . members = container . symbol . members || createMap < Symbol > ( ) ;
1984
+ // It's acceptable for multiple 'this' assignments of the same identifier to occur
1985
+ declareSymbol ( container . symbol . members , container . symbol , node , SymbolFlags . Property , SymbolFlags . PropertyExcludes & ~ SymbolFlags . Property ) ;
1984
1986
}
1985
1987
else if ( container . kind === SyntaxKind . Constructor ) {
1986
- if ( isInJavaScriptFile ( node ) ) {
1987
- // this.foo assignment in a JavaScript class
1988
- // Bind this property to the containing class
1989
- const saveContainer = container ;
1990
- container = container . parent ;
1991
- bindPropertyOrMethodOrAccessor ( node , SymbolFlags . Property , SymbolFlags . None ) ;
1992
- container = saveContainer ;
1993
- return ;
1994
- }
1995
- else {
1996
- assignee = container . parent ;
1988
+ // this.foo assignment in a JavaScript class
1989
+ // Bind this property to the containing class
1990
+ const saveContainer = container ;
1991
+ container = container . parent ;
1992
+ // AND it can be overwritten by subsequent method declarations
1993
+ const symbol = bindPropertyOrMethodOrAccessor ( node , SymbolFlags . Property , SymbolFlags . None ) ;
1994
+ if ( symbol ) {
1995
+ ( symbol as Symbol ) . isReplaceableByMethod = true ;
1997
1996
}
1997
+ container = saveContainer ;
1998
1998
}
1999
- else {
2000
- return ;
2001
- }
2002
- assignee . symbol . members = assignee . symbol . members || createMap < Symbol > ( ) ;
2003
- // It's acceptable for multiple 'this' assignments of the same identifier to occur
2004
- // AND it can be overwritten by subsequent method declarations
2005
- const symbol = declareSymbol ( assignee . symbol . members , assignee . symbol , node , SymbolFlags . Property , SymbolFlags . PropertyExcludes & ~ SymbolFlags . Property ) ;
2006
- symbol . isReplaceableByMethod = true ;
2007
1999
}
2008
2000
2009
2001
function bindPrototypePropertyAssignment ( node : BinaryExpression ) {
0 commit comments