adjust calling bits to allow ((foo))
This commit is contained in:
parent
276df1b103
commit
ccfcefe207
@ -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,
|
||||
|
12
hy/macros.py
12
hy/macros.py
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user