mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00

We assume that variable shadowing is impossible, so then there is no reason to keep distinct Declaration and Assignment operators after ReferenceResolvingPass.
251 lines
4.9 KiB
Text
251 lines
4.9 KiB
Text
===== AST after parser =====
|
|
f():
|
|
TreeList
|
|
IfBranch
|
|
UnresolvedReference cond1
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference a
|
|
MathematicalConstant 1
|
|
IfBranch
|
|
UnresolvedReference cond2
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference b
|
|
UnresolvedReference a
|
|
ElseIfBranch Else
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference b
|
|
MathematicalConstant 3
|
|
ElseIfBranch Else
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference b
|
|
MathematicalConstant 4
|
|
ReturnNode
|
|
UnresolvedReference b
|
|
|
|
===== AST after function-call-canonicalization =====
|
|
f():
|
|
TreeList
|
|
IfBranch
|
|
UnresolvedReference cond1
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference a
|
|
MathematicalConstant 1
|
|
IfBranch
|
|
UnresolvedReference cond2
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference b
|
|
UnresolvedReference a
|
|
ElseIfBranch Else
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference b
|
|
MathematicalConstant 3
|
|
ElseIfBranch Else
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference b
|
|
MathematicalConstant 4
|
|
ReturnNode
|
|
UnresolvedReference b
|
|
|
|
===== AST after if-branch-merging =====
|
|
f():
|
|
TreeList
|
|
IfElseIfChain
|
|
UnresolvedReference cond1
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference a
|
|
MathematicalConstant 1
|
|
IfElseIfChain
|
|
UnresolvedReference cond2
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference b
|
|
UnresolvedReference a
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference b
|
|
MathematicalConstant 3
|
|
TreeList
|
|
BinaryOperation Declaration
|
|
UnresolvedReference b
|
|
MathematicalConstant 4
|
|
ReturnNode
|
|
UnresolvedReference b
|
|
|
|
===== AST after reference-resolving =====
|
|
f():
|
|
TreeList
|
|
IfElseIfChain
|
|
UnresolvedReference cond1
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var a
|
|
MathematicalConstant 1
|
|
IfElseIfChain
|
|
UnresolvedReference cond2
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var b
|
|
Var a
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var b
|
|
MathematicalConstant 3
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var b
|
|
MathematicalConstant 4
|
|
ReturnNode
|
|
Var b
|
|
|
|
===== AST after cfg-building =====
|
|
f():
|
|
TreeList
|
|
IfElseIfChain
|
|
UnresolvedReference cond1
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var a
|
|
MathematicalConstant 1
|
|
IfElseIfChain
|
|
UnresolvedReference cond2
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var b
|
|
Var a
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var b
|
|
MathematicalConstant 3
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var b
|
|
MathematicalConstant 4
|
|
ReturnNode
|
|
Var b
|
|
|
|
===== CFG after cfg-building =====
|
|
f():
|
|
0:
|
|
ControlFlowBranch true=3 false=7
|
|
UnresolvedReference cond1
|
|
|
|
1:
|
|
ControlFlowFunctionReturn
|
|
Var $return
|
|
|
|
2:
|
|
BinaryOperation Assignment
|
|
Var $return
|
|
Var b
|
|
ControlFlowJump jump=1
|
|
|
|
3:
|
|
BinaryOperation Assignment
|
|
Var a
|
|
MathematicalConstant 1
|
|
ControlFlowBranch true=5 false=6
|
|
UnresolvedReference cond2
|
|
|
|
4:
|
|
ControlFlowJump jump=2
|
|
|
|
5:
|
|
BinaryOperation Assignment
|
|
Var b
|
|
Var a
|
|
ControlFlowJump jump=4
|
|
|
|
6:
|
|
BinaryOperation Assignment
|
|
Var b
|
|
MathematicalConstant 3
|
|
ControlFlowJump jump=4
|
|
|
|
7:
|
|
BinaryOperation Assignment
|
|
Var b
|
|
MathematicalConstant 4
|
|
ControlFlowJump jump=2
|
|
|
|
8:
|
|
BinaryOperation Assignment
|
|
Var $return
|
|
Error ""
|
|
ControlFlowJump jump=1
|
|
|
|
===== AST after cfg-simplification =====
|
|
f():
|
|
TreeList
|
|
IfElseIfChain
|
|
UnresolvedReference cond1
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var a
|
|
MathematicalConstant 1
|
|
IfElseIfChain
|
|
UnresolvedReference cond2
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var b
|
|
Var a
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var b
|
|
MathematicalConstant 3
|
|
TreeList
|
|
BinaryOperation Assignment
|
|
Var b
|
|
MathematicalConstant 4
|
|
ReturnNode
|
|
Var b
|
|
|
|
===== CFG after cfg-simplification =====
|
|
f():
|
|
0:
|
|
ControlFlowBranch true=3 false=6
|
|
UnresolvedReference cond1
|
|
|
|
1:
|
|
ControlFlowFunctionReturn
|
|
Var $return
|
|
|
|
2:
|
|
BinaryOperation Assignment
|
|
Var $return
|
|
Var b
|
|
ControlFlowJump jump=1
|
|
|
|
3:
|
|
BinaryOperation Assignment
|
|
Var a
|
|
MathematicalConstant 1
|
|
ControlFlowBranch true=4 false=5
|
|
UnresolvedReference cond2
|
|
|
|
4:
|
|
BinaryOperation Assignment
|
|
Var b
|
|
Var a
|
|
ControlFlowJump jump=2
|
|
|
|
5:
|
|
BinaryOperation Assignment
|
|
Var b
|
|
MathematicalConstant 3
|
|
ControlFlowJump jump=2
|
|
|
|
6:
|
|
BinaryOperation Assignment
|
|
Var b
|
|
MathematicalConstant 4
|
|
ControlFlowJump jump=2
|
|
|