CFG: Reintroduce toString()s

This commit is contained in:
Tom Hvitved
2021-02-11 18:37:18 +01:00
parent 307db73c9c
commit c4ee79ed27
4 changed files with 29 additions and 18 deletions

View File

@@ -213,7 +213,7 @@ class Module extends ModuleBase, ConstantWriteAccess, @module {
* global scope, as in this example:
*
* ```rb
* class ::Foo
* module ::Foo
* end
* ```
*/

View File

@@ -53,9 +53,10 @@ module Call {
final override Generated::Call generated;
final override Expr getReceiver() {
if exists(generated.getReceiver())
then result = generated.getReceiver()
else result = generated.getMethod().(Generated::ScopeResolution).getScope()
result = generated.getReceiver()
or
not exists(generated.getReceiver()) and
result = generated.getMethod().(Generated::ScopeResolution).getScope()
}
final override string getMethodName() {

View File

@@ -85,6 +85,16 @@ class AstCfgNode extends CfgNode, TAstNode {
or
n = any(Generated::For f).getValue() and
s = "In"
or
// TODO: Remove these nodes from the CFG
n = any(Generated::Class c).getName() and
s = n.toString()
or
n = any(Generated::Module m).getName() and
s = n.toString()
or
n = any(Generated::ScopeResolution sc).getName() and
s = n.toString()
|
result = "[" + this.getSplitsString() + "] " + s
or