Logo
Explore Help
Sign In
ada/langkit
0
0
Fork 0
You've already forked langkit
mirror of https://github.com/AdaCore/langkit.git synced 2026-02-12 12:28:12 -08:00
Code Issues Packages Projects Releases Wiki Activity
Files
master
langkit/testsuite/tests/misc/file_reader/extensions/python

15 lines
339 B
Plaintext
Raw Permalink Normal View History

Make it possible to bypass file readers to parse internal units 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
2021-05-03 18:19:23 +02:00
## 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)
Reference in New Issue Copy Permalink
Powered by Gitea Page: 296ms Template: 12ms
English
English
Licenses API