mirror of https://github.com/tbklang/tlang.git
VariableExpression recursive path initialization #10
Labels
No Label
dependency
emit
hashmapper
lebanonmapper
lexer
meta
needsfix
parser
qol
question
resolution
typing
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Reference: tlang/tlang#10
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?
We need to recursively go down the path
x.y.z
and chop off and visit:x.y.z
x
y
z
This is needed to be done in
core.d
inexpressionPass()
independency/
.This should also statically initialize classes as well as we will visit the correct nodes. So we need this really.
We need to get the order right because currently we might do a
ClassStaticAllocate
onx
but make whatever the current dnode is require the class static allocation and we get a lot of wrongly order stuff somewhat.We need to take a look at this.
Example input code:
Output dependency list:
It seems partially right actually, the last two make sense, declare and assign only once the above "init shananigans" is done. It is this "init shananigans" which we need to fix (re-order).
I wonder, for re-ordering we may need to tag things with some rolling count. It's easy enough re-ordering when we have to for example flip
VarAssign
andVarDec
because they logically appear next to each other. But now we would probably have to flip a lot and we need a way to relate it I think 🤔Actually, the specific problem is that we are doing a
ClassStaticAllocate
midway an assignment expression (due to assigning a path containing a class,TestClass
), almost like we need to make them float to the top somehow.One thing to be fixed is:
We should, when coming across the next:
[INFO] 2/3: [Instruction: compiler.codegen.instruction.ClassStaticInitAllocate:classStaticInitAllocate: simple_class_ref.TestClass]
, is some sort of push back based on matching path names within our class with a staticInitScope
- and then stopping potentially.We should look at the placement of:
On line 678 of
typecheck/core.d
, that seems like a simple fix.Also, double check the logic of the loop there, it might have bene reversed? As stuff looks reversed, check the usage of
insert()
onkept.insert()
and the final for-loop at the end.Ah, we should be checking:
The code for variables belonging to classes looks incomplete, no swapping like we see with the module code, so we should take a look at that before moving on.
I believe this plays a role, current problem is swapping but we have a order of:
We end up swapping the first two, which is a problem, we need to search till we find a match.
I think this is still actually the problem - mmmh. I think when we do the
ClassStaticInit
we need to notbreak
- mmmh.We also may be generating too many
expression
chains incore/dependency.d
, only one is needed.This can be seen in:
Hence the need for reductive recursion.
It seems to rear its ugly head with this darn expression (specifically
VariableExpression
) stuff as I add a lot of shit but should return one only actually, reduction recursion.I should maintain some sort of deps list though as we go down and then clear once done (ONLY when doing
VariableExpression
withx.y.z
). Then before returning atif(nearestDot == -1)
we make thatVariableNode
.needs()
each item in this deps list.We can maintain a map of if we have:
x.y.z1
x.y.z2
Then
z1
->[deps list]
Then
z2
->[deps list]
Yeah nah. We ain't doing this.