adding in thingers.
This commit is contained in:
parent
f950717e5a
commit
da234b1d8f
@ -21,9 +21,10 @@
|
|||||||
from hy.errors import HyError
|
from hy.errors import HyError
|
||||||
|
|
||||||
from hy.models.expression import HyExpression
|
from hy.models.expression import HyExpression
|
||||||
from hy.models.symbol import HySymbol
|
|
||||||
from hy.models.integer import HyInteger
|
from hy.models.integer import HyInteger
|
||||||
from hy.models.string import HyString
|
from hy.models.string import HyString
|
||||||
|
from hy.models.symbol import HySymbol
|
||||||
|
from hy.models.list import HyList
|
||||||
|
|
||||||
import ast
|
import ast
|
||||||
|
|
||||||
@ -169,6 +170,14 @@ class HyASTCompiler(object):
|
|||||||
col_offset=expression.start_column,
|
col_offset=expression.start_column,
|
||||||
targets=[name], value=what)
|
targets=[name], value=what)
|
||||||
|
|
||||||
|
@builds(HyList)
|
||||||
|
def compile_list(self, expr):
|
||||||
|
return ast.List(
|
||||||
|
elts=[self.compile(x) for x in expr],
|
||||||
|
ctx=ast.Load(),
|
||||||
|
lineno=expr.start_line,
|
||||||
|
col_offset=expr.start_column)
|
||||||
|
|
||||||
@builds("fn")
|
@builds("fn")
|
||||||
def compile_fn_expression(self, expression):
|
def compile_fn_expression(self, expression):
|
||||||
expression.pop(0) # fn
|
expression.pop(0) # fn
|
||||||
|
@ -2,3 +2,4 @@
|
|||||||
|
|
||||||
import hy
|
import hy
|
||||||
from .native_tests.math import *
|
from .native_tests.math import *
|
||||||
|
from .native_tests.language import *
|
||||||
|
4
tests/native_tests/language.hy
Normal file
4
tests/native_tests/language.hy
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
;
|
||||||
|
|
||||||
|
(def test_lists (fn []
|
||||||
|
(assert (= [1 2 3 4] (+ [1 2] [3 4])))))
|
Loading…
x
Reference in New Issue
Block a user