Ruby: rename getSelfVariableAccess to getReceiver

This commit is contained in:
Arthur Baars
2022-05-23 11:30:29 +02:00
parent f6ca3921f9
commit 29ea1b2f24
6 changed files with 16 additions and 16 deletions

View File

@@ -183,14 +183,14 @@ class InstanceVariableAccess extends VariableAccess instanceof InstanceVariableA
final override string getAPrimaryQlClass() { result = "InstanceVariableAccess" }
/**
* Gets a synthetic `self` variable access.
* Gets the synthetic receiver(`self`) of this instance variable access.
*/
final SelfVariableAccess getSelfVariableAccess() { synthChild(this, 0, result) }
final SelfVariableAccess getReceiver() { synthChild(this, 0, result) }
final override AstNode getAChild(string pred) {
result = VariableAccess.super.getAChild(pred)
or
pred = "getSelfVariableAccess" and result = this.getSelfVariableAccess()
pred = "getReceiver" and result = this.getReceiver()
}
}

View File

@@ -616,7 +616,7 @@ module ExprNodes {
}
private class InstanceVariableAccessMapping extends ExprChildMapping, InstanceVariableAccess {
override predicate relevantChild(AstNode n) { n = this.getSelfVariableAccess() }
override predicate relevantChild(AstNode n) { n = this.getReceiver() }
}
/** A control-flow node that wraps a `InstanceVariableAccess` AST expression. */
@@ -626,9 +626,9 @@ module ExprNodes {
final override InstanceVariableAccess getExpr() { result = ExprCfgNode.super.getExpr() }
/**
* Gets a synthetic `self` variable access.
* Gets the synthetic receiver(`self`) of this instance variable access.
*/
final CfgNode getSelfVariableAccess() { e.hasCfgChild(e.getSelfVariableAccess(), this, result) }
final CfgNode getReceiver() { e.hasCfgChild(e.getReceiver(), this, result) }
}
/** A control-flow node that wraps a `VariableWriteAccess` AST expression. */

View File

@@ -1008,7 +1008,7 @@ module Trees {
private class InstanceVariableTree extends StandardPostOrderTree, InstanceVariableAccess {
final override ControlFlowTree getChildElement(int i) {
result = this.getSelfVariableAccess() and i = 0
result = this.getReceiver() and i = 0
}
}

View File

@@ -219,7 +219,7 @@ private module Cached {
TBlockParameterNode(MethodBase m) or
TExprPostUpdateNode(CfgNodes::ExprCfgNode n) {
n instanceof Argument or
n = any(CfgNodes::ExprNodes::InstanceVariableAccessCfgNode v).getSelfVariableAccess()
n = any(CfgNodes::ExprNodes::InstanceVariableAccessCfgNode v).getReceiver()
} or
TSummaryNode(
FlowSummaryImpl::Public::SummarizedCallable c,
@@ -804,7 +804,7 @@ predicate storeStep(Node node1, ContentSet c, Node node2) {
ct.getName() = var.getExpr().getVariable().getName()
))
)
).getSelfVariableAccess()
).getReceiver()
or
FlowSummaryImpl::Private::Steps::summaryStoreStep(node1, c, node2)
}
@@ -817,7 +817,7 @@ predicate readStep(Node node1, ContentSet c, Node node2) {
node2.asExpr() =
any(CfgNodes::ExprNodes::InstanceVariableAccessCfgNode var |
var.getExpr() instanceof InstanceVariableReadAccess and
node1.asExpr() = var.getSelfVariableAccess() and
node1.asExpr() = var.getReceiver() and
c.isSingleton(any(Content::FieldContent ct |
ct.getName() = var.getExpr().getVariable().getName()
))

View File

@@ -1234,7 +1234,7 @@ control/cases.rb:
# 150| getBranch: [InClause] in ... then ...
# 150| getPattern: [ReferencePattern] ^...
# 150| getExpr: [InstanceVariableAccess] @foo
# 150| getSelfVariableAccess: [SelfVariableAccess] self
# 150| getReceiver: [SelfVariableAccess] self
# 151| getBranch: [InClause] in ... then ...
# 151| getPattern: [ReferencePattern] ^...
# 151| getExpr: [ClassVariableAccess] @@foo
@@ -1247,7 +1247,7 @@ control/cases.rb:
# 156| getBranch: [InClause] in ... then ...
# 156| getPattern: [ReferencePattern] ^...
# 156| getExpr: [InstanceVariableAccess] @foo
# 156| getSelfVariableAccess: [SelfVariableAccess] self
# 156| getReceiver: [SelfVariableAccess] self
# 157| getBranch: [InClause] in ... then ...
# 157| getPattern: [ReferencePattern] ^...
# 157| getExpr: [AddExpr] ... + ...
@@ -2773,11 +2773,11 @@ operations/operations.rb:
# 87| getStmt: [ClassDeclaration] X
# 88| getStmt: [AssignExpr] ... = ...
# 88| getAnOperand/getLeftOperand: [InstanceVariableAccess] @x
# 88| getSelfVariableAccess: [SelfVariableAccess] self
# 88| getReceiver: [SelfVariableAccess] self
# 88| getAnOperand/getRightOperand: [IntegerLiteral] 1
# 89| getStmt: [AssignAddExpr] ... += ...
# 89| getAnOperand/getLeftOperand: [InstanceVariableAccess] @x
# 89| getSelfVariableAccess: [SelfVariableAccess] self
# 89| getReceiver: [SelfVariableAccess] self
# 89| getAnOperand/getRightOperand: [IntegerLiteral] 2
# 91| getStmt: [AssignExpr] ... = ...
# 91| getAnOperand/getLeftOperand: [ClassVariableAccess] @@y

View File

@@ -836,10 +836,10 @@ operations/operations.rb:
# 89| [AssignAddExpr] ... += ...
# 89| getDesugared: [AssignExpr] ... = ...
# 89| getAnOperand/getLeftOperand: [InstanceVariableAccess] @x
# 89| getSelfVariableAccess: [SelfVariableAccess] self
# 89| getReceiver: [SelfVariableAccess] self
# 89| getAnOperand/getRightOperand: [AddExpr] ... + ...
# 89| getAnOperand/getLeftOperand/getReceiver: [InstanceVariableAccess] @x
# 89| getSelfVariableAccess: [SelfVariableAccess] self
# 89| getReceiver: [SelfVariableAccess] self
# 89| getAnOperand/getArgument/getRightOperand: [IntegerLiteral] 2
# 92| [AssignDivExpr] ... /= ...
# 92| getDesugared: [AssignExpr] ... = ...