@@ -128,12 +128,15 @@ private predicate isArgumentForCall(ExprCfgNode arg, CallExprBaseCfgNode call, P
128128 arg = call .( MethodCallExprCfgNode ) .getReceiver ( ) and pos .isSelf ( )
129129}
130130
131+ /**
132+ * Provides the `Node` class and subclasses thereof.
133+ *
134+ * Classes with names ending in `Public` are exposed as `final` aliases in the
135+ * public `DataFlow` API, so they should not expose internal implementation details.
136+ */
131137module Node {
132- /**
133- * An element, viewed as a node in a data flow graph. Either an expression
134- * (`ExprNode`) or a parameter (`ParameterNode`).
135- */
136- abstract class Node extends TNode {
138+ /** An element, viewed as a node in a data flow graph. */
139+ abstract class NodePublic extends TNode {
137140 /** Gets the location of this node. */
138141 abstract Location getLocation ( ) ;
139142
@@ -149,7 +152,9 @@ module Node {
149152 * Gets the pattern that corresponds to this node, if any.
150153 */
151154 PatCfgNode asPat ( ) { none ( ) }
155+ }
152156
157+ abstract class Node extends NodePublic {
153158 /** Gets the enclosing callable. */
154159 DataFlowCallable getEnclosingCallable ( ) { result = TCfgScope ( this .getCfgScope ( ) ) }
155160
@@ -160,11 +165,6 @@ module Node {
160165 * Gets the control flow node that corresponds to this data flow node.
161166 */
162167 CfgNode getCfgNode ( ) { none ( ) }
163-
164- /**
165- * Gets this node's underlying SSA definition, if any.
166- */
167- Ssa:: Definition asDefinition ( ) { none ( ) }
168168 }
169169
170170 /** A node type that is not implemented. */
@@ -462,10 +462,12 @@ module Node {
462462 * Nodes corresponding to AST elements, for example `ExprNode`, usually refer
463463 * to the value before the update.
464464 */
465- abstract class PostUpdateNode extends Node {
465+ abstract class PostUpdateNodePublic extends NodePublic {
466466 /** Gets the node before the state update. */
467- abstract Node getPreUpdateNode ( ) ;
467+ abstract NodePublic getPreUpdateNode ( ) ;
468+ }
468469
470+ abstract class PostUpdateNode extends PostUpdateNodePublic , Node {
469471 override string toString ( ) { result = "[post] " + this .getPreUpdateNode ( ) .toString ( ) }
470472 }
471473
@@ -857,12 +859,13 @@ private module Aliases {
857859
858860module RustDataFlow implements InputSig< Location > {
859861 private import Aliases
862+ private import codeql.rust.dataflow.DataFlow
860863
861864 /**
862865 * An element, viewed as a node in a data flow graph. Either an expression
863866 * (`ExprNode`) or a parameter (`ParameterNode`).
864867 */
865- final class Node = Node :: Node ;
868+ class Node = DataFlow :: Node ;
866869
867870 final class ParameterNode = Node:: ParameterNode ;
868871
@@ -872,7 +875,7 @@ module RustDataFlow implements InputSig<Location> {
872875
873876 final class OutNode = Node:: OutNode ;
874877
875- final class PostUpdateNode = Node :: PostUpdateNode ;
878+ class PostUpdateNode = DataFlow :: PostUpdateNode ;
876879
877880 final class CastNode = Node:: NaNode ;
878881
@@ -886,7 +889,9 @@ module RustDataFlow implements InputSig<Location> {
886889 n .isArgumentOf ( call , pos )
887890 }
888891
889- DataFlowCallable nodeGetEnclosingCallable ( Node node ) { result = node .getEnclosingCallable ( ) }
892+ DataFlowCallable nodeGetEnclosingCallable ( Node node ) {
893+ result = node .( Node:: Node ) .getEnclosingCallable ( )
894+ }
890895
891896 DataFlowType getNodeType ( Node node ) { any ( ) }
892897
@@ -901,9 +906,9 @@ module RustDataFlow implements InputSig<Location> {
901906 }
902907
903908 predicate neverSkipInPathGraph ( Node node ) {
904- node .getCfgNode ( ) = any ( LetStmtCfgNode s ) .getPat ( )
909+ node .( Node :: Node ) . getCfgNode ( ) = any ( LetStmtCfgNode s ) .getPat ( )
905910 or
906- node .getCfgNode ( ) = any ( AssignmentExprCfgNode a ) .getLhs ( )
911+ node .( Node :: Node ) . getCfgNode ( ) = any ( AssignmentExprCfgNode a ) .getLhs ( )
907912 or
908913 exists ( MatchExprCfgNode match |
909914 node .asExpr ( ) = match .getScrutinee ( ) or
0 commit comments