2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-19 08:26:30 +08:00

compiler.embedding: actually use qualified name when embedding methods.

Previous commit 6b55e3b only did this for embedded types.
This commit is contained in:
whitequark 2015-08-28 02:22:16 -05:00
parent 9605e8215f
commit 677cc69643

View File

@ -420,7 +420,7 @@ class Stitcher:
embedded_function = function.artiq_embedded.function
source_code = textwrap.dedent(inspect.getsource(embedded_function))
filename = embedded_function.__code__.co_filename
module_name, _ = os.path.splitext(os.path.basename(filename))
module_name = embedded_function.__globals__['__name__']
first_line = embedded_function.__code__.co_firstlineno
# Extract function environment.
@ -436,7 +436,7 @@ class Stitcher:
function_node = parsetree.body[0]
# Mangle the name, since we put everything into a single module.
function_node.name = "{}.{}".format(module_name, function_node.name)
function_node.name = "{}.{}".format(module_name, function.__qualname__)
# Normally, LocalExtractor would populate the typing environment
# of the module with the function name. However, since we run