Open Nickforall opened 6 years ago
So, we have this AST, representing 100 + 200 + 300.
100 + 200 + 300
{ "type": "binary", "operator": "+", "left": { "type": "binary", "operator": "+", "left": { "type": "numberLiteral", "value": 100 }, "right": { "type": "numberLiteral", "value": 200 } }, "right": { "type": "numberLiteral", "value": 300 } }
In the end they are all number literals, so we can just optimize this to the expression below, because at compiletime we know these numbers will never change, they are constant.
{ "type": "numberLiteral", "value": 600 }
oh, we could also optimize this, but that looks really hard
fn some_function { test = 40 yo = 1000 hello = 10 print yo * test + hello }
I'll probably make a different issue sometime
So, we have this AST, representing
100 + 200 + 300
.In the end they are all number literals, so we can just optimize this to the expression below, because at compiletime we know these numbers will never change, they are constant.