From e9f7c47663f4833fe9d19f29f1f3ada3828a73f1 Mon Sep 17 00:00:00 2001 From: Nicolas Dandrimont Date: Wed, 1 May 2013 19:50:06 +0200 Subject: [PATCH] Do the macro processing in the compiler --- hy/compiler.py | 3 +++ hy/importer.py | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hy/compiler.py b/hy/compiler.py index c45a972..b023524 100644 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -35,6 +35,8 @@ from hy.models.float import HyFloat from hy.models.list import HyList from hy.models.dict import HyDict +from hy.core import process + from hy.util import str_type import codecs @@ -361,6 +363,7 @@ class HyASTCompiler(object): def compile_atom(self, atom_type, atom): if atom_type in _compile_table: + atom = process(atom) ret = _compile_table[atom_type](self, atom) if not isinstance(ret, Result): ret = Result() + ret diff --git a/hy/importer.py b/hy/importer.py index 1287d8b..2368439 100644 --- a/hy/importer.py +++ b/hy/importer.py @@ -21,7 +21,6 @@ from py_compile import wr_long, MAGIC from hy.compiler import hy_compile from hy.models import HyObject -from hy.core import process from hy.lex import tokenize @@ -48,7 +47,7 @@ def ast_compile(ast, filename, mode): def import_buffer_to_hst(buf): """Import content from buf and return an Hy AST.""" - return process(tokenize(buf + "\n")) + return tokenize(buf + "\n") def import_file_to_hst(fpath):