diff --git a/src/internals/irDump.ts b/src/internals/irDump.ts index 21abbf6d..2fc558ff 100644 --- a/src/internals/irDump.ts +++ b/src/internals/irDump.ts @@ -76,7 +76,9 @@ export class GraphvizDumper { output += ` color=lightgrey;\n`; } cfg.forEachNode(cu.ast, (stmt, node) => { - output += ` "${prefix}_${node.idx}" [label="${this.ppSummary(stmt)}"];\n`; + const color = + node.kind.kind === "return" ? ',style=filled,fillcolor="#66A7DB"' : ""; + output += ` "${prefix}_${node.idx}" [label="${this.ppSummary(stmt)}"${color}];\n`; }); cfg.forEachEdge((edge) => { output += ` "${prefix}_${edge.src}" -> "${prefix}_${edge.dst}";\n`; diff --git a/test/contracts/conditional-1.cfg.dot b/test/contracts/conditional-1.cfg.dot index 6726e022..7ddaec1e 100644 --- a/test/contracts/conditional-1.cfg.dot +++ b/test/contracts/conditional-1.cfg.dot @@ -6,7 +6,7 @@ digraph "conditional-1" { "test_142" [label="if (a > 42)"]; "test_144" [label="a = 23"]; "test_146" [label="let b: Int = a + 1"]; - "test_148" [label="return b"]; + "test_148" [label="return b",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_144" -> "test_146"; diff --git a/test/contracts/conditional-2.cfg.dot b/test/contracts/conditional-2.cfg.dot index c0ea57f3..706774eb 100644 --- a/test/contracts/conditional-2.cfg.dot +++ b/test/contracts/conditional-2.cfg.dot @@ -6,7 +6,7 @@ digraph "conditional-2" { "test_142" [label="if (a > 42)"]; "test_144" [label="a = 23"]; "test_146" [label="a = 22"]; - "test_148" [label="return a"]; + "test_148" [label="return a",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_142" -> "test_146"; diff --git a/test/contracts/div-before-mul-1.cfg.dot b/test/contracts/div-before-mul-1.cfg.dot index 2ed28411..04f1e1cf 100644 --- a/test/contracts/div-before-mul-1.cfg.dot +++ b/test/contracts/div-before-mul-1.cfg.dot @@ -6,7 +6,7 @@ digraph "div-before-mul-1" { "test_142" [label="let b: Int = 3"]; "test_144" [label="let c: Int = 2"]; "test_146" [label="let result: Int = a / b * c"]; - "test_148" [label="return result"]; + "test_148" [label="return result",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_144" -> "test_146"; diff --git a/test/contracts/div-before-mul-2.cfg.dot b/test/contracts/div-before-mul-2.cfg.dot index 9b5b53ed..d65ad31d 100644 --- a/test/contracts/div-before-mul-2.cfg.dot +++ b/test/contracts/div-before-mul-2.cfg.dot @@ -6,7 +6,7 @@ digraph "div-before-mul-2" { "test_142" [label="let b: Int = 3"]; "test_144" [label="let c: Int = 2"]; "test_146" [label="let result: Int = a * c / b"]; - "test_148" [label="return result"]; + "test_148" [label="return result",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_144" -> "test_146"; diff --git a/test/contracts/div-before-mul-3.cfg.dot b/test/contracts/div-before-mul-3.cfg.dot index 05dd1673..b28e17eb 100644 --- a/test/contracts/div-before-mul-3.cfg.dot +++ b/test/contracts/div-before-mul-3.cfg.dot @@ -7,7 +7,7 @@ digraph "div-before-mul-3" { "test_144" [label="let taintedWithA1: Int = 2 - a"]; "test_146" [label="let taintedWithA2: Int = 55 + taintedWithA1"]; "test_148" [label="let result: Int = taintedWithA2 * c"]; - "test_150" [label="return result"]; + "test_150" [label="return result",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_144" -> "test_146"; diff --git a/test/contracts/linear-flow-1.cfg.dot b/test/contracts/linear-flow-1.cfg.dot index 27916767..a99c3706 100644 --- a/test/contracts/linear-flow-1.cfg.dot +++ b/test/contracts/linear-flow-1.cfg.dot @@ -5,7 +5,7 @@ digraph "linear-flow-1" { "test_141" [label="let a: Int = 20"]; "test_142" [label="let b: Int = 22"]; "test_144" [label="let c: Int = a + b"]; - "test_146" [label="return c"]; + "test_146" [label="return c",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_144" -> "test_146"; diff --git a/test/contracts/loops-1.cfg.dot b/test/contracts/loops-1.cfg.dot index b1d0dc07..4f0f8325 100644 --- a/test/contracts/loops-1.cfg.dot +++ b/test/contracts/loops-1.cfg.dot @@ -7,7 +7,7 @@ digraph "loops-1" { "test_144" [label="while (i < 10)"]; "test_146" [label="i = i + 1"]; "test_148" [label="sum = sum + i"]; - "test_151" [label="return sum"]; + "test_151" [label="return sum",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_144" -> "test_146"; diff --git a/test/contracts/loops-2.cfg.dot b/test/contracts/loops-2.cfg.dot index 6207a671..59b53eba 100644 --- a/test/contracts/loops-2.cfg.dot +++ b/test/contracts/loops-2.cfg.dot @@ -7,7 +7,7 @@ digraph "loops-2" { "test_144" [label="until (i < 10)"]; "test_146" [label="i = i + 1"]; "test_148" [label="sum = sum + i"]; - "test_151" [label="return sum"]; + "test_151" [label="return sum",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_144" -> "test_146"; diff --git a/test/contracts/loops-3.cfg.dot b/test/contracts/loops-3.cfg.dot index a9390a88..dca7f94f 100644 --- a/test/contracts/loops-3.cfg.dot +++ b/test/contracts/loops-3.cfg.dot @@ -7,7 +7,7 @@ digraph "loops-3" { "test_144" [label="repeat (10)"]; "test_146" [label="i = i + 1"]; "test_148" [label="sum = sum + i"]; - "test_151" [label="return sum"]; + "test_151" [label="return sum",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_144" -> "test_146"; diff --git a/test/contracts/never-accessed-1.cfg.dot b/test/contracts/never-accessed-1.cfg.dot index d87578aa..2b43fd73 100644 --- a/test/contracts/never-accessed-1.cfg.dot +++ b/test/contracts/never-accessed-1.cfg.dot @@ -5,7 +5,7 @@ digraph "never-accessed-1" { "test_141" [label="let a: Int = 20"]; "test_142" [label="if (true)"]; "test_144" [label="a = 42"]; - "test_146" [label="return 42"]; + "test_146" [label="return 42",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_144" -> "test_146"; diff --git a/test/contracts/never-accessed-2.cfg.dot b/test/contracts/never-accessed-2.cfg.dot index b42d1eda..7ec95662 100644 --- a/test/contracts/never-accessed-2.cfg.dot +++ b/test/contracts/never-accessed-2.cfg.dot @@ -6,6 +6,6 @@ digraph "never-accessed-2" { } subgraph "cluster_FieldTest__use_f1" { label="FieldTest__use_f1"; - "FieldTest__use_f1_143" [label="return self.f1"]; + "FieldTest__use_f1_143" [label="return self.f1",style=filled,fillcolor="#66A7DB"]; } } diff --git a/test/contracts/readonly-1.cfg.dot b/test/contracts/readonly-1.cfg.dot index 396d8237..d3dc3254 100644 --- a/test/contracts/readonly-1.cfg.dot +++ b/test/contracts/readonly-1.cfg.dot @@ -7,7 +7,7 @@ digraph "readonly-1" { "test_144" [label="let c: Int = 24"]; "test_146" [label="if (true)"]; "test_148" [label="c = a + b"]; - "test_150" [label="return c"]; + "test_150" [label="return c",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_144" -> "test_146"; diff --git a/test/contracts/readonly-2.cfg.dot b/test/contracts/readonly-2.cfg.dot index 4e252bf6..eb497122 100644 --- a/test/contracts/readonly-2.cfg.dot +++ b/test/contracts/readonly-2.cfg.dot @@ -4,7 +4,7 @@ digraph "readonly-2" { label="test1"; "test1_141" [label="let a: Int = 20"]; "test1_142" [label="let b: Int = 22"]; - "test1_144" [label="return b"]; + "test1_144" [label="return b",style=filled,fillcolor="#66A7DB"]; "test1_141" -> "test1_142"; "test1_142" -> "test1_144"; } diff --git a/test/contracts/traits-1.cfg.dot b/test/contracts/traits-1.cfg.dot index 73c0b3fb..8f4eae78 100644 --- a/test/contracts/traits-1.cfg.dot +++ b/test/contracts/traits-1.cfg.dot @@ -2,6 +2,6 @@ digraph "traits-1" { node [shape=box]; subgraph "cluster_TestContract__getter" { label="TestContract__getter"; - "TestContract__getter_141" [label="return 0"]; + "TestContract__getter_141" [label="return 0",style=filled,fillcolor="#66A7DB"]; } } diff --git a/test/contracts/unbound-loop-1.cfg.dot b/test/contracts/unbound-loop-1.cfg.dot index 0ae5274e..b68e7797 100644 --- a/test/contracts/unbound-loop-1.cfg.dot +++ b/test/contracts/unbound-loop-1.cfg.dot @@ -4,7 +4,7 @@ digraph "unbound-loop-1" { label="test"; "test_141" [label="let a: Int = 20"]; "test_142" [label="while (a > 10)"]; - "test_145" [label="return a"]; + "test_145" [label="return a",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_142"; "test_142" -> "test_145"; diff --git a/test/contracts/unbound-loop-2.cfg.dot b/test/contracts/unbound-loop-2.cfg.dot index 6b086bb9..e66a91db 100644 --- a/test/contracts/unbound-loop-2.cfg.dot +++ b/test/contracts/unbound-loop-2.cfg.dot @@ -4,7 +4,7 @@ digraph "unbound-loop-2" { label="test"; "test_141" [label="let a: Int = 20"]; "test_142" [label="until (a > 10)"]; - "test_145" [label="return a"]; + "test_145" [label="return a",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_142"; "test_142" -> "test_145"; diff --git a/test/contracts/unbound-loop-3.cfg.dot b/test/contracts/unbound-loop-3.cfg.dot index 6eb3e166..34e98202 100644 --- a/test/contracts/unbound-loop-3.cfg.dot +++ b/test/contracts/unbound-loop-3.cfg.dot @@ -5,7 +5,7 @@ digraph "unbound-loop-3" { "test_141" [label="let a: Int = 20"]; "test_142" [label="while (a > 10)"]; "test_144" [label="a += 1"]; - "test_147" [label="return a"]; + "test_147" [label="return a",style=filled,fillcolor="#66A7DB"]; "test_141" -> "test_142"; "test_142" -> "test_144"; "test_144" -> "test_142"; diff --git a/test/contracts/unbound-loop-4.cfg.dot b/test/contracts/unbound-loop-4.cfg.dot index 81ce9775..04d3ebd1 100644 --- a/test/contracts/unbound-loop-4.cfg.dot +++ b/test/contracts/unbound-loop-4.cfg.dot @@ -8,7 +8,7 @@ digraph "unbound-loop-4" { "test_142" [label="let a: Int = 20"]; "test_143" [label="while (a > 10)"]; "test_145" [label="fn(a)"]; - "test_148" [label="return a"]; + "test_148" [label="return a",style=filled,fillcolor="#66A7DB"]; "test_142" -> "test_143"; "test_143" -> "test_145"; "test_145" -> "test_143";