An EnumType has a ctype view, thus, to unwrap it, it is unecessary to
call the unwrap function.
The wrap function was not being affected by the issue.
wrap and unwrap functions are required only if a type does not define a
ctype view. Thus, refactor the code to reflect this.
Code to implement the "As_Unit" logic for unparsers does not need to be
tied to the Unparse overload that specifically returns strings. Facter
it out so that an upcoming commit can use it in the Unparse overload
that returns unbounded text values.
TN: S919-008
Now that the C wrapper to create a context uses the internal API, there
is no automatic dec-ref anymore (from the public Analysis_Context
controlled type) and thus no need to manually inc-ref it.
TN: S823-010
Internal unit providers (or rather accesses to them) are the entities
used at the C API boundary and in $.Implementation. As a consequence,
their lifetimes depend both on their use in C API users and both by the
lifetime of the analysis contexts that reference them.
In order to properly handle their resources allocation, this commit
introduces ref-counting primitives for internal unit providers so that
they are deallocated only when it is safe to do so.
TN: S910-015
Through its properties DSL, Langkit tries as much as possible to protect
users of generated libraries from logic errors in language
specifications. However, one case that can happen a lot while
processing invalid input source code is infinite recursion. So far we
had no protection against this.
This commit adds a mechanism to code generation for properties so that
we raise a Property_Error when the call depth reaches a specific
threshold.
TN: S903-011
When we reparse but don't ask for a specific charset, we should use the
charset that was used to parse the analysis unit last time. This commit
adjusts parsing code to work this way: we used not to, which made it
impossible to perform rewriting on non-ASCII sources.
TN: S903-011