Closed MrDaiki closed 1 week ago
I did some cleaning and spotted a bug (see the fresh test case): checking of the LHS should occur before the RHS is added to the environment.
I did some cleaning and spotted a bug (see the fresh test case): checking of the LHS should occur before the RHS is added to the environment.
To solve this case, I think we will need to call tt_expr
instead of tt_assign
(or we consider that tt_assign checks can be redundant)
I’ve done the small changes you suggested. I let Alexandre decide whether he wants to change the data-type.
Issue
This is a duplicate of issue #899 based on #901 refactoring of pre-typing. The feature requested is to add a new syntax that authorize variable initialization when they are declared.
The syntax is as follow :
Implementation
With the proposed implementation, we can also initialize multiple variables at the same time:
The current implementation doesn't support array initializing with this feature because array can currently be explicitly created only at top level. Allowing it would require reworking a large part of the grammar and pre-typing analysis.
In terms of semantic, the proposed implementation works as follow :
is abstractly equivalent to :