Use mkexpr
in HyASTCompiler.imports_as_stmts
This commit is contained in:
parent
349da353d6
commit
3afb4fdabe
@ -402,21 +402,11 @@ class HyASTCompiler(object):
|
|||||||
ret = Result()
|
ret = Result()
|
||||||
for module, names in self.imports.items():
|
for module, names in self.imports.items():
|
||||||
if None in names:
|
if None in names:
|
||||||
e = HyExpression([
|
ret += self.compile(mkexpr('import', module).replace(expr))
|
||||||
HySymbol("import"),
|
|
||||||
HySymbol(module),
|
|
||||||
]).replace(expr)
|
|
||||||
ret += self.compile(e)
|
|
||||||
names = sorted(name for name in names if name)
|
names = sorted(name for name in names if name)
|
||||||
if names:
|
if names:
|
||||||
e = HyExpression([
|
ret += self.compile(mkexpr('import',
|
||||||
HySymbol("import"),
|
mklist(module, mklist(*names))))
|
||||||
HyList([
|
|
||||||
HySymbol(module),
|
|
||||||
HyList([HySymbol(name) for name in names])
|
|
||||||
])
|
|
||||||
]).replace(expr)
|
|
||||||
ret += self.compile(e)
|
|
||||||
self.imports = defaultdict(set)
|
self.imports = defaultdict(set)
|
||||||
return ret.stmts
|
return ret.stmts
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user