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 {
200200 pragma [ inline_late]
201201 DataFlow:: Node asSink ( ) { result = asSinkInline ( this ) }
202202
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+
203222 /**
204223 * Get a data-flow node that transitively flows to this value, provided that this value corresponds
205224 * to a sink.
@@ -1196,6 +1215,11 @@ module API {
11961215 )
11971216 }
11981217
1218+ cached
1219+ predicate asCallable ( Node apiNode , DataFlow:: CallableNode callable ) {
1220+ apiNode = getBackwardStartNode ( callable )
1221+ }
1222+
11991223 cached
12001224 predicate contentEdge ( Node pred , DataFlow:: Content content , Node succ ) {
12011225 exists (
You can’t perform that action at this time.
0 commit comments