forked from M-Labs/artiq
1
0
Fork 0

Add builtin definitions for len(), round(), range() and syscall().

This commit is contained in:
whitequark 2015-06-24 11:28:24 +03:00
parent 8762729e80
commit 710a04cbee
1 changed files with 15 additions and 0 deletions

View File

@ -5,6 +5,8 @@ types, such as int or float.
from . import types
# Types
class TNone(types.TMono):
def __init__(self):
super().__init__("NoneType")
@ -29,6 +31,19 @@ class TList(types.TMono):
elt = types.TVar()
super().__init__("list", {"elt": elt})
def fn_len():
return types.TBuiltin("len")
def fn_round():
return types.TBuiltin("round")
def fn_range():
return types.TBuiltin("range")
def fn_syscall():
return types.TBuiltin("syscall")
# Accessors
def is_none(typ):
return types.is_mono(typ, "NoneType")