mirror of https://github.com/tbklang/tlang.git
⚡ Feature: Aliases support #176
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 hours 55 minutes
Due Date
deavmi
5 hours 55 minutes
Depends on
#178 ⚡ Feature: Collector-based resolveUp
tlang/tlang
Reference: tlang/tlang#176
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?
Purpose ✍️
To add support for declaring aliases and then using them. An alias should be declared and have a right-hand-side expression associated with it. Then the
MetaProcessor
should do the following:Module
AliasExpression
s with the alias's valueTodo :note
MCloneable
)Working on this now to see what I can get done.
I now have alias declarations. I now need to work on the
MetaProcessor
to now firstly look up allVariableExpression
(s) and then find those with alias names and replace them with theAliasDeclaration
'sgetExpression()
result.Okay, alias searching is working. Now for the replacement stratergy.
It works! 🥓
This need to sort out places where
MCloneable
is not implemented etc.Busy with this now...
Fixed ✅
Will push code later tonight
Oh no it brokey actually, with this
cnt()
example :(It's not replacing for some reason, I feel as though this is some obvious error in the loop but I can't pinpoint it.
Looks like not being replaced after all 🤔
it is falling through and hitting an
MStatementReplaceable
of theExpression
in VarAss, need to see why that keeps returningtrue
Ah it is falling into
FunctionCall
which is not finished yet, and keeps returningtrue
GREAT!
FunctionCall
false
for now (ass it is not implemented)MCloneable
supportMetaProcessor
Added CI/CD tests and also added it to unittests (for code coverage)
For ordering like this:
We may need to do a first pass to discover all aliases and then sort them. BUT then the context is sort of lacking? Unless we get all
parentOf()
's and then distance between containers. Eish!Maybe, I have an idea. We are actually just doing the search not from the right place. Perhaps, on the place of the
VarExp
, we should callparentOf()
and maybe search from there. So anchor it at the reference point of the alias name, not at the call todoAliasProcess(...)
This looks right at least:
Found bug, needing to make
Program
replaceable, did now and looks goodEy! Stuff is coming together. Just really putting a lot of
MCloneable
s in different places.Time for a break now