From 7bcba52d6ad853cd5c33fe97202d1d5da66c4942 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 9 Oct 2015 00:53:14 +0300 Subject: [PATCH] compiler.embedding: fix loc. --- artiq/compiler/embedding.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/artiq/compiler/embedding.py b/artiq/compiler/embedding.py index 89bdf8f51..a2cf1aa34 100644 --- a/artiq/compiler/embedding.py +++ b/artiq/compiler/embedding.py @@ -94,9 +94,13 @@ class ASTSynthesizer: begin_loc=begin_loc, end_loc=end_loc, loc=begin_loc.join(end_loc)) elif inspect.isfunction(value) or inspect.ismethod(value): + quote_loc = self._add('`') + repr_loc = self._add(repr(value)) + unquote_loc = self._add('`') + loc = quote_loc.join(unquote_loc) + function_name, function_type = self.quote_function(value, self.expanded_from) - return asttyped.NameT(id=function_name, ctx=None, type=function_type, - loc=self._add(repr(value))) + return asttyped.NameT(id=function_name, ctx=None, type=function_type, loc=loc) else: quote_loc = self._add('`') repr_loc = self._add(repr(value))