mirror of https://github.com/tbklang/tlang.git
VarDec and VarAss refactor (old) #11
Labels
No Label
dependency
emit
hashmapper
lebanonmapper
lexer
meta
needsfix
parser
qol
question
resolution
typing
No Milestone
No project
No Assignees
1 Participants
Notifications
Total Time Spent: 5 minutes 35 seconds
Due Date
deavmi
5 minutes 35 seconds
Blocks
#13 Clean ups
tlang/tlang
Reference: tlang/tlang#11
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It doesn't make sense that we generate code which amounts to:
Firstly, this is what made us require that stupid swapping stuff.
Secondly, it's WRONG,
varAss
should depend onvarDec
.Implementation
Changes to
dependency/core.d
We currently visit the
VarDec
first, we thenvarDecNode = pool(VarDec)
. What we should then do, as we have a check for assignment existence is:The resulting dependency tree would look like:
Instead of (the wrong one):
Changes to
typecheck/core.d
Now linearizer would visit this graph and take eahc left-most node. Leaving us with the following linearization:
Which requires no swapping which is EXACTLY what we want and make more sense than what we are currently doing.
Test case 1
Given the following code:
We now, as of commit
31c52c0bebeb77e36155e3c62f5fb3d7a7ed7707
on branchvardec_varass_dependency
we now get the following output after some changes:The code queue looks VERY CORRECT:
Which looks correct 👍
I think I will be closing this soon as I realised that the
addInstr()/
addInstrB()` and non-embedding was what was causing typechecker issues.See #66
We can examine the whole issue #10 later, as it is not for the basics milestone.
VarDec and VarAss refactorto VarDec and VarAss refactor (old)vardec_varass_dependencyto conditionalsThis is fixed by #66 being fixed which is on the commit
4f899c69e2c1fc1d2b2adb3f1d11ac5e2d16b30d
on theconditionals
branch