The routine for grouping lexical envs would previously always flatten grouped
envs. However, this process would discard the `default_md` field of the nested
grouped envs.
The implementation now decides to flatten grouped envs only if the resulting
env behavior is the same.
When a property raises an error, for instance because it tries to get
some field in a null node, it would be nice to include the sloc of the
node in that property, so that error messages give users a clue about
how it relates to the Ada source code that Libadalang analyzes, which
would be useful to workaround or investigate an issue.
Note that adding this sloc information is done on a best effort basis.
As a notable example, the Property_Error exception raised in the lexical
environment lookup system do not provide it, as the "Self" node for the
property that triggers a lexical env lookup is not available there, and
taking this information to this point would require a lot of logistics,
and possibly run time performance degradation.
Closes#635
Depending on the order picked by Langkit for node type lowering,
processing the definition of a derived list node could crash. The
problem was that lowering code just assumed so far that the root node
was lowered before list nodes, and that list element nodes were lowered
before the corresponding list nodes as well, whereas this has never been
guaranteed.
To fix this, we now force the lowering of the element node when lowering
a list node, and stop assuming that the root node is lowered first.
For #622
In exception handlers, we must free resources when it *is* a "legit"
exception taht is raised, and leave them unchanged in other cases. This
fixes a memory leak in the former case.
For #632
Given rebindings L and R with R = R1 -> .. -> Rn, the previous implementation
returned Rn -> .. -> R1 -> L, so the order of the parents in R was reversed in
the result. We now correctly return R1 -> .. -> Rn -> L.
Fix the "p_old" property so that it returns the old env (not the new
one). Also remove lots of useless bits in this testcase, to avoid noise
to the readers.
TN: V708-016
When they return a list node type, parsers never return a null node:
they create instead an empty list. Fix the computation of "is_optional"
field information for this case. Also clarify the semantics of
"is_optional".
TN: V629-007
Use the correct path environment variable separator (':' or ';')
depending on the platfrom and the environment variable. This should fix
builds on Windows/GitHub.
For #631
So far, properties were allowed to raise Property_Error exceptions only:
other exceptions were considered as a low-level bug (i.e. assumed not
possible), which could corrupt the process state.
This commits allows language specs to allow additional kinds of
exceptions to be raised in property errors.
For #632
Environment names are mere symbols for quite a long time now (they used
to be an array of symbols, wrapped in a Env_Name_Record type). Remove
the pretty-printer that was associated to this type.
TN: V707-013
Whether properties are lazy fields is determined in the "compute
property attributes" compilation pass. However, array types, and thus
their "to_iterator" properties, can be created later on (when
constructing property expressions). As a result, in order for the "lazy
field" information to be properly initialized for "to_iterator", we need
to fill it in right at property creation.
For #630
GNAT complains when lines are too long in Ada source code. An upcoming
change will allow to memoize as many properties as possible, making
enum types used to implement memoization very big, so we need to break
up their declarations on multiple lines.
For #630