Skip to content

Commit 118d0d9

Browse files
committed
Ruby: Use "Receiver" instead of "Self" in flow summaries
Flow summaries use the "outside view", i.e., the call sites, so "receiver" is better than "self", as the latter uses the "inside view", i.e. the callees.
1 parent 3a30f58 commit 118d0d9

File tree

3 files changed

+86
-86
lines changed

3 files changed

+86
-86
lines changed

ruby/ql/lib/codeql/ruby/dataflow/FlowSummary.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ module SummaryComponent {
2323

2424
predicate content = SC::content/1;
2525

26-
/** Gets a summary component that represents a `self` argument. */
27-
SummaryComponent self() { result = argument(any(ParameterPosition pos | pos.isSelf())) }
26+
/** Gets a summary component that represents a receiver. */
27+
SummaryComponent receiver() { result = argument(any(ParameterPosition pos | pos.isSelf())) }
2828

2929
/** Gets a summary component that represents a block argument. */
3030
SummaryComponent block() { result = argument(any(ParameterPosition pos | pos.isBlock())) }
@@ -67,8 +67,8 @@ module SummaryComponentStack {
6767

6868
predicate argument = SCS::argument/1;
6969

70-
/** Gets a singleton stack representing a `self` argument. */
71-
SummaryComponentStack self() { result = singleton(SummaryComponent::self()) }
70+
/** Gets a singleton stack representing a receiver. */
71+
SummaryComponentStack receiver() { result = singleton(SummaryComponent::receiver()) }
7272

7373
/** Gets a singleton stack representing a block argument. */
7474
SummaryComponentStack block() { result = singleton(SummaryComponent::block()) }

ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImplSpecific.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ predicate summaryElement(DataFlowCallable c, string input, string output, string
6060
*/
6161
bindingset[c]
6262
SummaryComponent interpretComponentSpecific(string c) {
63-
c = "Self" and
64-
result = FlowSummary::SummaryComponent::self()
63+
c = "Receiver" and
64+
result = FlowSummary::SummaryComponent::receiver()
6565
or
6666
c = "BlockArgument" and
6767
result = FlowSummary::SummaryComponent::block()

0 commit comments

Comments
 (0)