File tree Expand file tree Collapse file tree
javascript/ql/src/semmle/javascript Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -248,4 +248,25 @@ module Closure {
248248 DataFlow:: SourceNode moduleImport ( string moduleName ) {
249249 getClosureNamespaceFromSourceNode ( result ) = moduleName
250250 }
251+
252+ /**
253+ * A call to `goog.bind`, as a partial function invocation.
254+ */
255+ private class BindCall extends DataFlow:: PartialInvokeNode:: Range , DataFlow:: CallNode {
256+ BindCall ( ) { this = moduleImport ( "goog.bind" ) .getACall ( ) }
257+
258+ override predicate isPartialArgument ( DataFlow:: Node callback , DataFlow:: Node argument , int index ) {
259+ index >= 0 and
260+ callback = getArgument ( 0 ) and
261+ argument = getArgument ( index + 2 )
262+ }
263+
264+ override DataFlow:: SourceNode getBoundFunction ( DataFlow:: Node callback , int boundArgs ) {
265+ boundArgs = getNumArgument ( ) - 2 and
266+ callback = getArgument ( 0 ) and
267+ result = this
268+ }
269+
270+ override DataFlow:: Node getBoundReceiver ( ) { result = getArgument ( 1 ) }
271+ }
251272}
Original file line number Diff line number Diff line change @@ -1080,3 +1080,24 @@ private class DependencyInjectedArgumentInitializer extends DataFlow::AnalyzedVa
10801080 result = service .getALocalValue ( )
10811081 }
10821082}
1083+
1084+ /**
1085+ * A call to `angular.bind`, as a partial function invocation.
1086+ */
1087+ private class BindCall extends DataFlow:: PartialInvokeNode:: Range , DataFlow:: CallNode {
1088+ BindCall ( ) { this = angular ( ) .getAMemberCall ( "bind" ) }
1089+
1090+ override predicate isPartialArgument ( DataFlow:: Node callback , DataFlow:: Node argument , int index ) {
1091+ index >= 0 and
1092+ callback = getArgument ( 1 ) and
1093+ argument = getArgument ( index + 2 )
1094+ }
1095+
1096+ override DataFlow:: SourceNode getBoundFunction ( DataFlow:: Node callback , int boundArgs ) {
1097+ callback = getArgument ( 1 ) and
1098+ boundArgs = getNumArgument ( ) - 2 and
1099+ result = this
1100+ }
1101+
1102+ override DataFlow:: Node getBoundReceiver ( ) { result = getArgument ( 0 ) }
1103+ }
You can’t perform that action at this time.
0 commit comments