forked from M-Labs/artiq
1
0
Fork 0

compiler: embed host exception constructors as such (fixes #204).

This commit is contained in:
whitequark 2015-12-26 03:17:26 +08:00
parent 8051fe9592
commit 502e570e86
15 changed files with 36 additions and 13 deletions

View File

@ -124,7 +124,10 @@ class ASTSynthesizer:
OrderedDict())
instance_type.attributes['__objectid__'] = builtins.TInt32()
constructor_type = types.TConstructor(instance_type)
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

View File

@ -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()

View File

@ -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 *

View File

@ -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 *

View File

@ -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 *

View File

@ -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 *

View File

@ -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 *

View File

@ -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 *

View File

@ -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 *

View File

@ -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 *

View File

@ -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 *

View File

@ -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 *

View File

@ -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 *

View File

@ -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 *

View File

@ -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