mirror of https://github.com/tbklang/tlang.git
HashMapper needing .dup for stack allocation workaround #164
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: 36 minutes 18 seconds
Due Date
deavmi
36 minutes 18 seconds
Dependencies
No dependencies set.
Reference: tlang/tlang#164
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?
HashMapper
For some reason the value returned is some stack allocation and hence we need to
dup
it to get a heap-allocated copy we can actually return. Else we end up returning a stack pointer which then gets overwritten before usage.Code below:
Not so lekker thingsto HahsMapper needing .dup for stack allocation workaroundI added the
.dup
but I don't like that solution.HahsMapper needing .dup for stack allocation workaroundto HashMapper needing .dup for stack allocation workaroundI should probably look at this again/
// We do
.dup
because the hex string is allocated on the stack and// returning that wll only be valid still the stack grows into the
// space it uccopies again later, so copy it to the heap rather
// and return that
Removed the
.dup
because when we use the format string a new one is allocated so it is no lonmger needed:Waiting on semantic tests to run...
All tests pass ✅
I am now satisfied with this