Adding back in keywords.

Yes, I'm your hero, @algernon
This commit is contained in:
Paul Tagliamonte 2013-06-18 22:57:51 -04:00
parent f9b13a625f
commit 289586b340
2 changed files with 14 additions and 0 deletions

View File

@ -1399,10 +1399,19 @@ class HyASTCompiler(object):
return ret return ret
@checkargs(1)
def _compile_keyword_call(self, expression):
expression.append(expression.pop(0))
expression.insert(0, HySymbol("get"))
return self.compile(expression)
@builds(HyExpression) @builds(HyExpression)
def compile_expression(self, expression): def compile_expression(self, expression):
fn = expression[0] fn = expression[0]
func = None func = None
if isinstance(fn, HyKeyword):
return self._compile_keyword_call(expression)
if isinstance(fn, HyString): if isinstance(fn, HyString):
ret = self.compile_atom(fn, expression) ret = self.compile_atom(fn, expression)
if ret: if ret:

View File

@ -732,3 +732,8 @@
(defn test-encoding-nightmares [] (defn test-encoding-nightmares []
"NATIVE: test unicode encoding escaping crazybits" "NATIVE: test unicode encoding escaping crazybits"
(assert (= (len "ℵℵℵ♥♥♥\t♥♥\r\n") 11))) (assert (= (len "ℵℵℵ♥♥♥\t♥♥\r\n") 11)))
(defn test-keyword-dict-access []
"NATIVE: test keyword dict access"
(assert (= "test" (:foo {:foo "test"}))))