File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,25 @@ module API {
200
200
pragma [ inline_late]
201
201
DataFlow:: Node asSink ( ) { result = asSinkInline ( this ) }
202
202
203
+ /**
204
+ * Gets a callable that can reach this sink.
205
+ *
206
+ * For example:
207
+ * ```ruby
208
+ * Foo.bar do |x| # API::getTopLevelMember("Foo").getMethod("bar").getBlock().asCallable()
209
+ * end
210
+ *
211
+ * class Baz
212
+ * def m # API::getTopLevelMember("Foo").getMethod("bar").getArgument(0).getMethod("m").asCallable()
213
+ * end
214
+ * end
215
+ * Foo.bar(Baz.new)
216
+ * ```
217
+ */
218
+ bindingset [ this ]
219
+ pragma [ inline_late]
220
+ DataFlow:: CallableNode asCallable ( ) { Impl:: asCallable ( this .getAnEpsilonSuccessor ( ) , result ) }
221
+
203
222
/**
204
223
* Get a data-flow node that transitively flows to this value, provided that this value corresponds
205
224
* to a sink.
@@ -1196,6 +1215,11 @@ module API {
1196
1215
)
1197
1216
}
1198
1217
1218
+ cached
1219
+ predicate asCallable ( Node apiNode , DataFlow:: CallableNode callable ) {
1220
+ apiNode = getBackwardStartNode ( callable )
1221
+ }
1222
+
1199
1223
cached
1200
1224
predicate contentEdge ( Node pred , DataFlow:: Content content , Node succ ) {
1201
1225
exists (
You can’t perform that action at this time.
0 commit comments