c3c icon indicating copy to clipboard operation
c3c copied to clipboard

Improve lvalue handling in the compiler.

Open lerno opened this issue 1 year ago • 0 comments

Currently there is some special handling to be able to do things like

(&foo[x]).a = 123;

The reason for this is that the compiler doesn't model lvalues in a consistent way. To solve this, we can note that it is possible even directly from parsing to know what is an lvalue and separate expressions into lvalue and rvalue expressions. If not at parsing, at least the expression analysis should from top down have different analysis for lvalue and rvalue expressions.

Things that this will fix:

int* a = &l[0].a;

Where l is a type with &[] overload.

l[0].a = 123;

Again where l is a type with &[] overload. We might probably fix some other corner cases when doing this.

lerno avatar Aug 13 '24 19:08 lerno