mirror of https://github.com/m-labs/artiq.git
compiler: fixed embedding annotation evaluation
This commit is contained in:
parent
c29a149d16
commit
f531af510c
|
@ -954,21 +954,25 @@ class Stitcher:
|
||||||
else:
|
else:
|
||||||
host_function = function
|
host_function = function
|
||||||
|
|
||||||
embedded_function = host_function.artiq_embedded.function
|
if hasattr(host_function, 'artiq_embedded'):
|
||||||
|
embedded_function = host_function.artiq_embedded.function
|
||||||
|
else:
|
||||||
|
embedded_function = host_function
|
||||||
|
|
||||||
if isinstance(embedded_function, str):
|
if isinstance(embedded_function, str):
|
||||||
embedded_function = host_function
|
embedded_function = host_function
|
||||||
|
|
||||||
if isinstance(annot, str):
|
if isinstance(annot, str):
|
||||||
if annot not in embedded_function.__globals__:
|
try:
|
||||||
|
annot = eval(annot, embedded_function.__globals__)
|
||||||
|
except Exception:
|
||||||
diag = diagnostic.Diagnostic(
|
diag = diagnostic.Diagnostic(
|
||||||
"error",
|
"error",
|
||||||
"type annotation for {kind}, {annot}, is not defined",
|
"type annotation for {kind}, {annot}, cannot be evaluated",
|
||||||
{"kind": kind, "annot": repr(annot)},
|
{"kind": kind, "annot": repr(annot)},
|
||||||
self._function_loc(function),
|
self._function_loc(function),
|
||||||
notes=self._call_site_note(call_loc, fn_kind))
|
notes=self._call_site_note(call_loc, fn_kind))
|
||||||
self.engine.process(diag)
|
self.engine.process(diag)
|
||||||
annot = embedded_function.__globals__[annot]
|
|
||||||
|
|
||||||
if not isinstance(annot, types.Type):
|
if not isinstance(annot, types.Type):
|
||||||
diag = diagnostic.Diagnostic("error",
|
diag = diagnostic.Diagnostic("error",
|
||||||
|
|
Loading…
Reference in New Issue