adjust calling bits to allow ((foo))

This commit is contained in:
Paul R. Tagliamonte 2013-03-09 16:42:07 -05:00
parent 276df1b103
commit ccfcefe207
2 changed files with 11 additions and 8 deletions

View File

@ -214,10 +214,11 @@ class HyASTCompiler(object):
@builds(HyExpression)
def compile_expression(self, expression):
fn = expression[0]
if fn in _compile_table:
return _compile_table[fn](self, expression)
if isinstance(fn, HyString):
if fn in _compile_table:
return _compile_table[fn](self, expression)
return ast.Call(func=self.compile_symbol(fn),
return ast.Call(func=self.compile(fn),
args=[self.compile(x) for x in expression[1:]],
keywords=[],
starargs=None,

View File

@ -19,6 +19,7 @@
# DEALINGS IN THE SOFTWARE.
from hy.models.expression import HyExpression
from hy.models.string import HyString
from hy.models.list import HyList
_hy_macros = {}
@ -36,11 +37,12 @@ def process(tree):
fn = tree[0]
ntree = HyExpression([fn] + [process(x) for x in tree[1:]])
if fn in _hy_macros:
m = _hy_macros[fn]
obj = m(ntree)
obj.replace(tree)
return obj
if isinstance(fn, HyString):
if fn in _hy_macros:
m = _hy_macros[fn]
obj = m(ntree)
obj.replace(tree)
return obj
ntree.replace(tree)
return ntree