mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
It is often necessary for generated libraries to handle some "intenal"
unit, that will define language builtins. This unit is generally not
represented as an actual source file ("filesystem" tense), but rather as
an in-memory source buffer, which is incompatible with file readers,
which currently forbid all in-memory parsing.
This commit introduces an internal hook (a new "Is_Internal" formal in
$.Implementation's Get_Unit) so that generated libraries can bypass file
readers and thus load their internal units from memory at all times.
TN: U422-030
15 lines
339 B
Plaintext
15 lines
339 B
Plaintext
## vim: ft=makopython
|
|
|
|
_get_internal_unit = _import_func(
|
|
'foo_get_internal_unit',
|
|
[AnalysisContext._c_type], AnalysisUnit._c_type
|
|
)
|
|
|
|
|
|
def _get_internal_unit_method(self):
|
|
c_value = _get_internal_unit(self._c_value)
|
|
return AnalysisUnit._wrap(c_value)
|
|
|
|
|
|
AnalysisContext.get_internal_unit = property(_get_internal_unit_method)
|