File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
test/query-tests/Expressions/UnboundEventHandlerReceiver Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,11 @@ private predicate isBoundInMethod(MethodDeclaration method) {
2828 )
2929 or
3030 // require("auto-bind")(this)
31- thiz .flowsTo ( DataFlow:: moduleImport ( "auto-bind" ) .getACall ( ) .getArgument ( 0 ) )
31+ exists ( string mod |
32+ mod = "auto-bind" or
33+ mod = "react-autobind" |
34+ thiz .flowsTo ( DataFlow:: moduleImport ( mod ) .getACall ( ) .getArgument ( 0 ) )
35+ )
3236 or
3337 exists ( string name | name = method .getName ( ) |
3438 exists ( DataFlow:: MethodCallNode bind |
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import autoBind from 'auto-bind' ;
3-
3+ import reactAutobind from 'react-autobind' ;
44class Component0 extends React . Component {
55
66 render ( ) {
@@ -155,4 +155,22 @@ class Component3 extends React.Component {
155155 }
156156}
157157
158+ class Component4 extends React . Component {
159+
160+ render ( ) {
161+ return < div >
162+ < div onClick = { this . bound_throughReactAutobind } /> // OK
163+ </ div >
164+ }
165+
166+ constructor ( props ) {
167+ super ( props ) ;
168+ reactAutobind ( this ) ;
169+ }
170+
171+ bound_throughReactAutobind ( ) {
172+ this . setState ( { } ) ;
173+ }
174+ }
175+
158176// semmle-extractor-options: --experimental
You can’t perform that action at this time.
0 commit comments