Merge pull request #1625 from Kodiologist/potpourri
Miscellaneous small changes
This commit is contained in:
commit
d3bd7c1017
@ -328,14 +328,6 @@ def is_unpack(kind, x):
|
||||
and x[0] == "unpack-" + kind)
|
||||
|
||||
|
||||
def ends_with_else(expr):
|
||||
return (expr and
|
||||
isinstance(expr[-1], HyExpression) and
|
||||
expr[-1] and
|
||||
isinstance(expr[-1][0], HySymbol) and
|
||||
expr[-1][0] == HySymbol("else"))
|
||||
|
||||
|
||||
class HyASTCompiler(object):
|
||||
|
||||
def __init__(self, module_name):
|
||||
@ -1350,9 +1342,8 @@ class HyASTCompiler(object):
|
||||
|
||||
orel = Result()
|
||||
if else_expr is not None:
|
||||
for else_body in else_expr:
|
||||
orel += self.compile(else_body)
|
||||
orel += orel.expr_as_stmt()
|
||||
orel = self._compile_branch(else_expr)
|
||||
orel += orel.expr_as_stmt()
|
||||
|
||||
body = self._compile_branch(body)
|
||||
body += body.expr_as_stmt()
|
||||
|
@ -17,9 +17,8 @@ exclude_lines =
|
||||
ignore_errors = True
|
||||
|
||||
[tool:pytest]
|
||||
# Be sure to include Hy test functions whose names end with "?",
|
||||
# which will be mangled to begin with "is_".
|
||||
python_functions=test_* is_test_*
|
||||
# Be sure to include Hy test functions with mangled names.
|
||||
python_functions=test_* is_test_* hyx_test_* hyx_is_test_*
|
||||
filterwarnings =
|
||||
once::DeprecationWarning
|
||||
once::PendingDeprecationWarning
|
||||
|
@ -173,8 +173,7 @@
|
||||
"Don't treat strings as symbols in the calling position"
|
||||
(with [(pytest.raises TypeError)] ("setv" True 3)) ; A special form
|
||||
(with [(pytest.raises TypeError)] ("abs" -2)) ; A function
|
||||
(with [(pytest.raises TypeError)] ("when" 1 2)) ; A macro
|
||||
None) ; Avoid https://github.com/hylang/hy/issues/1320
|
||||
(with [(pytest.raises TypeError)] ("when" 1 2))) ; A macro
|
||||
|
||||
|
||||
(defn test-for-loop []
|
||||
|
@ -194,7 +194,7 @@
|
||||
(assert (in (mangle "_;a|") s2))
|
||||
(assert (not (= s1 s2))))
|
||||
|
||||
(defn test-defmacro-g! []
|
||||
(defn test-defmacro/g! []
|
||||
(import ast)
|
||||
(import [astor.code-gen [to-source]])
|
||||
(import [hy.importer [import_buffer_to_ast]])
|
||||
@ -213,8 +213,8 @@
|
||||
(setv _ast2 (import_buffer_to_ast macro1 "foo"))
|
||||
(setv s1 (to_source _ast1))
|
||||
(setv s2 (to_source _ast2))
|
||||
(assert (in "_;res|" s1))
|
||||
(assert (in "_;res|" s2))
|
||||
(assert (in (mangle "_;res|") s1))
|
||||
(assert (in (mangle "_;res|") s2))
|
||||
(assert (not (= s1 s2)))
|
||||
|
||||
;; defmacro/g! didn't like numbers initially because they
|
||||
@ -242,8 +242,8 @@
|
||||
(setv _ast2 (import_buffer_to_ast macro1 "foo"))
|
||||
(setv s1 (to_source _ast1))
|
||||
(setv s2 (to_source _ast2))
|
||||
(assert (in "_;res|" s1))
|
||||
(assert (in "_;res|" s2))
|
||||
(assert (in (mangle "_;res|") s1))
|
||||
(assert (in (mangle "_;res|") s2))
|
||||
(assert (not (= s1 s2)))
|
||||
|
||||
;; defmacro/g! didn't like numbers initially because they
|
||||
|
Loading…
Reference in New Issue
Block a user