forked from M-Labs/artiq
1
0
Fork 0

compiler.embedding: fix loc.

This commit is contained in:
whitequark 2015-10-09 00:53:14 +03:00
parent 7043b333a7
commit 7bcba52d6a
1 changed files with 6 additions and 2 deletions

View File

@ -94,9 +94,13 @@ class ASTSynthesizer:
begin_loc=begin_loc, end_loc=end_loc, begin_loc=begin_loc, end_loc=end_loc,
loc=begin_loc.join(end_loc)) loc=begin_loc.join(end_loc))
elif inspect.isfunction(value) or inspect.ismethod(value): 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) function_name, function_type = self.quote_function(value, self.expanded_from)
return asttyped.NameT(id=function_name, ctx=None, type=function_type, return asttyped.NameT(id=function_name, ctx=None, type=function_type, loc=loc)
loc=self._add(repr(value)))
else: else:
quote_loc = self._add('`') quote_loc = self._add('`')
repr_loc = self._add(repr(value)) repr_loc = self._add(repr(value))