Allow quoting lambda list keywords.
This fixes an obvious bug where LambdaListKeywords couldn't be quoted.
This commit is contained in:
parent
acfc5c6aa5
commit
9278b24318
@ -24,6 +24,7 @@ __version__ = "0.9.10"
|
|||||||
|
|
||||||
|
|
||||||
from hy.models.expression import HyExpression # NOQA
|
from hy.models.expression import HyExpression # NOQA
|
||||||
|
from hy.models.lambdalist import HyLambdaListKeyword # NOQA
|
||||||
from hy.models.integer import HyInteger # NOQA
|
from hy.models.integer import HyInteger # NOQA
|
||||||
from hy.models.keyword import HyKeyword # NOQA
|
from hy.models.keyword import HyKeyword # NOQA
|
||||||
from hy.models.complex import HyComplex # NOQA
|
from hy.models.complex import HyComplex # NOQA
|
||||||
|
@ -618,7 +618,7 @@ class HyASTCompiler(object):
|
|||||||
return imports, HyExpression([HySymbol(name),
|
return imports, HyExpression([HySymbol(name),
|
||||||
contents]).replace(form), False
|
contents]).replace(form), False
|
||||||
|
|
||||||
elif isinstance(form, HySymbol):
|
elif isinstance(form, (HySymbol, HyLambdaListKeyword)):
|
||||||
return imports, HyExpression([HySymbol(name),
|
return imports, HyExpression([HySymbol(name),
|
||||||
HyString(form)]).replace(form), False
|
HyString(form)]).replace(form), False
|
||||||
|
|
||||||
|
@ -75,3 +75,10 @@
|
|||||||
(assert (= (len q) 3))
|
(assert (= (len q) 3))
|
||||||
(assert (= (get qq 1) (quote (quasiquote (unquote (+ 1 5))))))
|
(assert (= (get qq 1) (quote (quasiquote (unquote (+ 1 5))))))
|
||||||
(assert (= q qq)))
|
(assert (= q qq)))
|
||||||
|
|
||||||
|
|
||||||
|
(defn test-quote-lambdalistkeyword []
|
||||||
|
"NATIVE: test quoting lambda list keywords"
|
||||||
|
(setv opt (quote &optional))
|
||||||
|
(assert (isinstance opt hy.HyLambdaListKeyword))
|
||||||
|
(assert (= (str opt) "&optional")))
|
||||||
|
Loading…
Reference in New Issue
Block a user