Skip to content

Commit a027353

Browse files
committed
Ruby: Remove some DefinitionExt references and deprecate the rest.
1 parent 38bf9c6 commit a027353

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ CfgNodes::ExprCfgNode getAPostUpdateNodeForArg(Argument arg) {
7474

7575
/** Gets the SSA definition node corresponding to parameter `p`. */
7676
pragma[nomagic]
77-
SsaImpl::DefinitionExt getParameterDef(NamedParameter p) {
77+
Ssa::Definition getParameterDef(NamedParameter p) {
7878
exists(BasicBlock bb, int i |
7979
bb.getNode(i).getAstNode() = p.getDefiningAccess() and
80-
result.definesAt(_, bb, i, _)
80+
result.definesAt(_, bb, i)
8181
)
8282
}
8383

@@ -388,15 +388,15 @@ module VariableCapture {
388388
Flow::clearsContent(asClosureNode(node), c.getVariable())
389389
}
390390

391-
class CapturedSsaDefinitionExt extends SsaImpl::DefinitionExt {
392-
CapturedSsaDefinitionExt() { this.getSourceVariable() instanceof CapturedVariable }
391+
class CapturedSsaDefinition extends SsaImpl::Definition {
392+
CapturedSsaDefinition() { this.getSourceVariable() instanceof CapturedVariable }
393393
}
394394

395395
// From an assignment or implicit initialization of a captured variable to its flow-insensitive node
396396
private predicate flowInsensitiveWriteStep(
397397
SsaDefinitionNodeImpl node1, CapturedVariableNode node2, CapturedVariable v
398398
) {
399-
exists(CapturedSsaDefinitionExt def |
399+
exists(CapturedSsaDefinition def |
400400
def = node1.getDefinition() and
401401
def.getSourceVariable() = v and
402402
(
@@ -412,7 +412,7 @@ module VariableCapture {
412412
private predicate flowInsensitiveReadStep(
413413
CapturedVariableNode node1, SsaDefinitionNodeImpl node2, CapturedVariable v
414414
) {
415-
exists(CapturedSsaDefinitionExt def |
415+
exists(CapturedSsaDefinition def |
416416
node1.getVariable() = v and
417417
def = node2.getDefinition() and
418418
def.getSourceVariable() = v and
@@ -772,7 +772,7 @@ class SsaNode extends NodeImpl, TSsaNode {
772772
class SsaDefinitionNodeImpl extends SsaNode {
773773
override SsaImpl::DataFlowIntegration::SsaDefinitionNode node;
774774

775-
SsaImpl::Definition getDefinition() { result = node.getDefinition() }
775+
Ssa::Definition getDefinition() { result = node.getDefinition() }
776776

777777
override predicate isHidden() {
778778
exists(SsaImpl::Definition def | def = this.getDefinition() |
@@ -2478,7 +2478,7 @@ module TypeInference {
24782478
n = def or
24792479
n.asExpr() =
24802480
any(CfgNodes::ExprCfgNode read |
2481-
read = def.getDefinition().(SsaImpl::DefinitionExt).getARead() and
2481+
read = def.getDefinition().getARead() and
24822482
not isTypeCheckedRead(read, _) // could in principle be checked against a new type
24832483
)
24842484
)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ import Cached
421421
*
422422
* Only intended for internal use.
423423
*/
424-
class DefinitionExt extends Impl::DefinitionExt {
424+
deprecated class DefinitionExt extends Impl::DefinitionExt {
425425
VariableReadAccessCfgNode getARead() { result = getARead(this) }
426426

427427
override string toString() { result = this.(Ssa::Definition).toString() }
@@ -434,7 +434,7 @@ class DefinitionExt extends Impl::DefinitionExt {
434434
*
435435
* Only intended for internal use.
436436
*/
437-
class PhiReadNode extends DefinitionExt, Impl::PhiReadNode {
437+
deprecated class PhiReadNode extends DefinitionExt, Impl::PhiReadNode {
438438
override string toString() { result = "SSA phi read(" + this.getSourceVariable() + ")" }
439439

440440
override Location getLocation() { result = Impl::PhiReadNode.super.getLocation() }
@@ -453,10 +453,10 @@ class NormalParameter extends Parameter {
453453

454454
/** Gets the SSA definition node corresponding to parameter `p`. */
455455
pragma[nomagic]
456-
DefinitionExt getParameterDef(NamedParameter p) {
456+
Definition getParameterDef(NamedParameter p) {
457457
exists(Cfg::BasicBlock bb, int i |
458458
bb.getNode(i).getAstNode() = p.getDefiningAccess() and
459-
result.definesAt(_, bb, i, _)
459+
result.definesAt(_, bb, i)
460460
)
461461
}
462462

0 commit comments

Comments
 (0)