forked from M-Labs/artiq
compiler: embed host exception constructors as such (fixes #204).
This commit is contained in:
parent
8051fe9592
commit
502e570e86
|
@ -124,6 +124,9 @@ class ASTSynthesizer:
|
|||
OrderedDict())
|
||||
instance_type.attributes['__objectid__'] = builtins.TInt32()
|
||||
|
||||
if issubclass(typ, BaseException):
|
||||
constructor_type = types.TExceptionConstructor(instance_type)
|
||||
else:
|
||||
constructor_type = types.TConstructor(instance_type)
|
||||
constructor_type.attributes['__objectid__'] = builtins.TInt32()
|
||||
instance_type.constructor = constructor_type
|
||||
|
|
|
@ -6,6 +6,12 @@ from artiq.master.worker_db import DeviceManager
|
|||
from artiq.coredevice.core import Core, CompileError
|
||||
|
||||
def main():
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "+diag":
|
||||
del sys.argv[1]
|
||||
diag = True
|
||||
else:
|
||||
diag = False
|
||||
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "+compile":
|
||||
del sys.argv[1]
|
||||
compile_only = True
|
||||
|
@ -30,6 +36,8 @@ def main():
|
|||
core.comm.clear_log()
|
||||
except CompileError as error:
|
||||
print("\n".join(error.__cause__.diagnostic.render(only_line=True)))
|
||||
if not diag:
|
||||
exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s >%t
|
||||
# RUN: %python -m artiq.compiler.testbench.embedding +diag %s >%t
|
||||
# RUN: OutputCheck %s --file-to-check=%t
|
||||
|
||||
from artiq.language.core import *
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
# RUN: %python -m artiq.compiler.testbench.embedding %s
|
||||
|
||||
from artiq.language.core import *
|
||||
from artiq.language.types import *
|
||||
from artiq.coredevice.exceptions import RTIOUnderflow
|
||||
|
||||
@kernel
|
||||
def entrypoint():
|
||||
try:
|
||||
pass
|
||||
except RTIOUnderflow:
|
||||
pass
|
Loading…
Reference in New Issue