Fixing the "olasd" bug

This commit is contained in:
Paul R. Tagliamonte 2013-04-03 20:18:56 -04:00
parent 1763cb7a60
commit d421d869af
2 changed files with 23 additions and 4 deletions

View File

@ -72,10 +72,21 @@ class HyASTCompiler(object):
ret.append(ast.Return(value=el,
lineno=el.lineno,
col_offset=el.col_offset))
ret += [ast.Expr(value=el,
lineno=el.lineno,
col_offset=el.col_offset)
if not isinstance(el, ast.stmt) else el for el in tree] # NOQA
for el in tree:
if type(el) == list:
blob = self._mangle_branch(el)
blob.reverse()
ret += blob
continue
if isinstance(el, ast.stmt):
ret.append(el)
continue
ret.append(ast.Expr(value=el,
lineno=el.lineno,
col_offset=el.col_offset))
ret.reverse()
return ret

View File

@ -212,6 +212,14 @@
(with-as (open "README.md" "r") fd
(pass)))
(defn test-for-doodle []
"NATIVE: test for-do"
(setf (, x y) (, 0 0))
(foreach [- [1 2]]
(do
(setf x (+ x 1))
(setf y (+ y 1))))
(assert (= y x 2)))
(defn test-comprehensions []
"NATIVE: test list comprehensions"