diff --git a/rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll b/rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll index 8796e55a125fd..9300c2c6109c7 100644 --- a/rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll +++ b/rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll @@ -1,6 +1,8 @@ private import rust private import codeql.rust.elements.internal.generated.ParentChild private import codeql.rust.elements.internal.ExprImpl::Impl as ExprImpl +private import codeql.rust.elements.internal.PathExprImpl::Impl as PathExprImpl +private import codeql.rust.elements.internal.ImplicitVariableAccessImpl::Impl as ImplicitVariableAccessImpl private import codeql.util.DenseRank module Impl { @@ -450,7 +452,8 @@ module Impl { private class TVariableAccess = Synth::TPathExpr or Synth::TImplicitVariableAccess; /** A variable access. */ - class VariableAccess extends ExprImpl::Expr, TVariableAccess instanceof VariableAccessCand { + abstract class VariableAccess extends ExprImpl::Expr, TVariableAccess instanceof VariableAccessCand + { private string name; private Variable v; @@ -467,6 +470,18 @@ module Impl { override string getAPrimaryQlClass() { result = "VariableAccess" } } + private class VariableAccessPathExpr extends VariableAccess, PathExprImpl::PathExpr { + override string getAPrimaryQlClass() { result = VariableAccess.super.getAPrimaryQlClass() } + } + + private class VariableAccessImplicitVariableAccess extends VariableAccess, + ImplicitVariableAccessImpl::ImplicitVariableAccess + { + override string toString() { result = VariableAccess.super.toString() } + + override string getAPrimaryQlClass() { result = VariableAccess.super.getAPrimaryQlClass() } + } + /** Holds if `e` occurs in the LHS of an assignment or compound assignment. */ private predicate assignmentExprDescendant(Expr e) { e = any(AssignmentExpr ae).getLhs()