Allow macros to return None, fixes #357

Allows Hy macros to return None, to test this

  (defmacro foo [])
  (foo)

Should work now
This commit is contained in:
Abhishek L 2013-12-05 03:29:49 +05:30
parent f9a1995be8
commit f1c68bd51a
2 changed files with 5 additions and 1 deletions

View File

@ -84,7 +84,8 @@ _wrappers = {
complex: HyComplex,
str_type: HyString,
dict: lambda d: HyDict(_wrap_value(x) for x in sum(d.items(), ())),
list: lambda l: HyList(_wrap_value(x) for x in l)
list: lambda l: HyList(_wrap_value(x) for x in l),
type(None): lambda foo: HySymbol("None"),
}

View File

@ -34,6 +34,9 @@
(defmacro a-dict [] {1 2})
(assert (= (a-dict) {1 2}))
(defmacro a-none [])
(assert (= (a-none) None))
; A macro calling a previously defined function
(eval-when-compile
(defn foo [x y]