-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
165 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Provides subclasses of `CfgNode` that represents different types of nodes in | ||
* the control flow graph. | ||
*/ | ||
|
||
private import rust | ||
private import ControlFlowGraph | ||
|
||
/** A CFG node that corresponds to an element in the AST. */ | ||
class AstCfgNode extends CfgNode { | ||
AstCfgNode() { exists(this.getAstNode()) } | ||
} | ||
|
||
/** A CFG node that corresponds to an expression in the AST. */ | ||
class ExprCfgNode extends AstCfgNode { | ||
ExprCfgNode() { this.getAstNode() instanceof Expr } | ||
|
||
/** Gets the underlying expression. */ | ||
Expr getExpr() { result = this.getAstNode() } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters