mirror of https://github.com/tbklang/tlang.git
Alternative generateName behaviour for symbolLookup in DGen #49
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.
Dependencies
No dependencies set.
Reference: tlang/tlang#49
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?
Currently
If you pass a Container
c
and Entitye
togenerateName(Container, Entity)
but the entity is not contained by the given container (even if the container provided is contained byu the container that the Entity is contained by), then we get an assertion failure.Currently we have an example code of:
Now rightfully so,
k
- theVariable
has aContainer
which is theModule
. So therefore the assertion will fail as we pass in aFunction
as a container.I don't really want to change the behaviour of our resolver, so maybe it might be a good idea to come up with something else. Like, yeah?
Idea 1
What we could do perhaps, instead of chanigng things around could be to cache symbol lookups, as that is the entire point of this really, for name generation.
We already have (and working):
All we want:
Is
generateName
basically but to hash it, so perhaps we should cache it in the SymbolMapper, then we avoid things like this. So if it doesn't exist, then do the lookup with thegenerateName
and all, but if it does exist then we should simply get a cached copy returned to us bySymbolMapper
.Alternative generateName behaviourto Alternative generateName behaviour for symbolLookup in DGenIdea 2
Better approach, we keep stuff as is in the
DGen
class to keep it simple and clean but in theVarStdAssignment
we set the context there like this:Instead of this:
Effectively using the context of the variable the standalone assignment refers to which should always be correct.
Going with idea 2
Fixed with commit
2a12c310a66e42783a524cd58f040454c1c36197
on branchvardec_varass_dependency