File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
test/query-tests/Expressions/UnboundEventHandlerReceiver Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,11 @@ private predicate isBoundInMethod(MethodDeclaration method) {
4545 )
4646 or
4747 exists ( Expr decoration , string name |
48- decoration = method .getADecorator ( ) .getExpression ( ) and
48+ (
49+ decoration = method .getADecorator ( ) .getExpression ( )
50+ or
51+ decoration = method .getDeclaringType ( ) .( ClassDefinition ) .getADecorator ( ) .getExpression ( )
52+ ) and
4953 name .regexpMatch ( "(?i).*(bind|bound).*" ) |
5054 // @autobind
5155 decoration .( Identifier ) .getName ( ) = name or
Original file line number Diff line number Diff line change @@ -120,4 +120,18 @@ class Component1 extends React.Component {
120120
121121}
122122
123+ @autobind
124+ class Component2 extends React . Component {
125+
126+ render ( ) {
127+ return < div >
128+ < div onClick = { this . bound_throughClassDecorator_autobind } /> // OK
129+ </ div > ;
130+ }
131+
132+ bound_throughClassDecorator_autobind ( ) {
133+ this . setState ( { } ) ;
134+ }
135+
136+ }
123137// semmle-extractor-options: --experimental
You can’t perform that action at this time.
0 commit comments