added len and range
This commit is contained in:
parent
ee7c1713a5
commit
b8719e5214
@ -12,6 +12,7 @@ i64 = types['int64']
|
||||
f32 = types['float']
|
||||
b = types['bool']
|
||||
I = TypeVariable('I', [i32, i64, f32])
|
||||
A = TypeVariable('A', [])
|
||||
|
||||
def impl_math(ty):
|
||||
ty.methods['__add__'] = ([SelfType(), ty], ty, set())
|
||||
@ -66,4 +67,6 @@ i64.methods['__init__'] = ([SelfType(), I], None, {'I'})
|
||||
f32.methods['__init__'] = ([SelfType(), I], None, {'I'})
|
||||
|
||||
simplest_ctx = Context({}, types)
|
||||
simplest_ctx.functions['len'] = ([ListType(A)], i32, {'A'})
|
||||
simplest_ctx.functions['range'] = ([i32], ListType(i32), set())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user