mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
33 lines
639 B
Python
33 lines
639 B
Python
import sys
|
|
|
|
import libfoolang
|
|
|
|
|
|
ctx = libfoolang.AnalysisContext()
|
|
u = ctx.get_from_buffer("source.txt", b"example")
|
|
if u.diagnostics:
|
|
for d in u.diagnostics:
|
|
print(d)
|
|
sys.exit(1)
|
|
|
|
|
|
def test():
|
|
print(" Calling AnalysisUnit.populate_lexical_env()...")
|
|
try:
|
|
u.populate_lexical_env()
|
|
except libfoolang.PropertyError:
|
|
print(" Got a PropertyError")
|
|
else:
|
|
print(" Got no PropertyError")
|
|
|
|
|
|
print("Not discarding errors...")
|
|
ctx.discard_errors_in_populate_lexical_env(False)
|
|
test()
|
|
|
|
print("Discarding errors...")
|
|
ctx.discard_errors_in_populate_lexical_env(True)
|
|
test()
|
|
|
|
print("Done.")
|