mirror of https://github.com/tbklang/tlang.git
Pointer support #80
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
Reference: tlang/tlang#80
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?
What is to be done?
To add support for pointers, so we will need to add support for doing:
Marked duplicate of #17
We need support for
*deref
as expression and not*deref =
(ASSIGN).We need to indicate this somehow.
Todo
(*ptr)+1
works but not*ptr+1
(it gets confused a little.)6b3fccfc159cee77e8113ac084d27f522e7fa49c
onpointers
branchcast(int*)
fails - gets choked up by the fact there is a*
present.Pointer
support forisSameType(Type, Type)
true
then which is wrong as we are not checking referred typeI need to work on adding arithmetic support this week - as it still isn't added.
Tomorrow I will finish up my
attemptPointerAriehmeticCoercion(Value, Value)
method for implementing coercion of pointer arithmetic operands to support the arithmetic stuff.Arithmetic is almost done, added coercion but also I have updated the
DGen
to emit*(<expr>)
instead of*<expr>
as then one could have<expr> := <expr1>+<expr2>
which wouldn't work out well as you would have*<expr1>+<expr2>
which wouldn't deref the sum but rather the left hand side, then add the dereferenced value to the right hand side.Arithmetic ✅
We fixed it in the manner described above. Coercion was in
b5e8ba0b31c6cd7a2faea45b74a9274b545710e4
(tagged aspointers_coerce
) andDGen
emit ind58e5aad4d3eb1091960d8e13b7562e99e47bc75
.Testing it now on
simple_pointer_cast_le.t
and it looks like it works, see commit87ebae209ef01126bf6c7ce8634055b197715754
(tag:pointer_cast_merge
).This is good for casting support.
All that remains is the newly added "Assignment type checking".
I have updated
isSameType(Type t1, Type t2)
to now handle pointer comparisons explicitly:Assignment type checking seems to actually be working, most likely as the
isSameType(Type t1, Type t2)
is updated.Look:
Here it correctly errors out:
All looks good, I will merge this soon. I should just finish #111 first and then upstream it into here - test again - and then we can merge this.
This is now since fixed, waiting on CI for merge.
- [ ] I should now go and test function calls that haveint[]
in themLooks like it broke something, that is, merging in #111
Nvm, had to compile - no wodner CI passed ;)
It is struggling with this:
As we are getting this error:
Solution ✅ (misunderstanding)
IT was a misunderstanding, support for
[]
-based pointer syntax (the so-called "array syntax") is in thearrays
branch.I should be able to close this soon.
Merging now, waiting CI/CD on
vardec_varass_dependency
CI/CD is all green