Allow setv to take no arguments (closes #901)
This commit is contained in:
parent
ead65b646b
commit
7e611947a4
@ -1977,10 +1977,15 @@ class HyASTCompiler(object):
|
||||
|
||||
@builds("def")
|
||||
@builds("setv")
|
||||
@checkargs(min=2)
|
||||
def compile_def_expression(self, expression):
|
||||
expression.pop(0)
|
||||
if len(expression) == 2:
|
||||
root = expression.pop(0)
|
||||
if not expression:
|
||||
result = Result()
|
||||
result += ast.Name(id='None', ctx=ast.Load(),
|
||||
lineno=root.start_line,
|
||||
col_offset=root.start_column)
|
||||
return result
|
||||
elif len(expression) == 2:
|
||||
return self._compile_assign(expression[0], expression[1],
|
||||
expression.start_line,
|
||||
expression.start_column)
|
||||
|
@ -34,6 +34,11 @@
|
||||
(assert (= #{} (set))))
|
||||
|
||||
|
||||
(defn test-setv-empty []
|
||||
"NATIVE: test setv works with no arguments"
|
||||
(assert (is (setv) nil)))
|
||||
|
||||
|
||||
(defn test-setv-get []
|
||||
"NATIVE: test setv works on a get expression"
|
||||
(setv foo [0 1 2])
|
||||
|
Loading…
Reference in New Issue
Block a user