aboutsummaryrefslogtreecommitdiff
path: root/neb/__init__.py
diff options
context:
space:
mode:
authormryouse2022-06-23 02:52:49 +0000
committermryouse2022-06-23 02:53:51 +0000
commit8e1e9531e587783dd4518b8464cce5e497dfd0ff (patch)
treecc3d4fd846616a3b3f07256255af0beb867094da /neb/__init__.py
parent9a18ade08ed9eb845d2d18156ef43db5902f1f1a (diff)
try and speed up typechecking by calling function directly
Diffstat (limited to 'neb/__init__.py')
-rw-r--r--neb/__init__.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/neb/__init__.py b/neb/__init__.py
index 7e3075b..c9e385e 100644
--- a/neb/__init__.py
+++ b/neb/__init__.py
@@ -177,13 +177,16 @@ class TypeWrap:
# if it's an any type, it's valid
if self.parent is None:
return Bool(True)
- valid = self.is_func.call(List([None, target]), env, ns)
+ if isinstance(self.is_func, UserFunction):
+ valid = self.is_func.call(Expr([None, target]), env, ns)
+ else:
+ valid = self.is_func(None, [target], env, ns)
if valid.value == True:
return valid
parent_type = env.get(f"{target.type_}")
while valid.value != True and parent_type.parent is not None:
parent_type = env.get(f"{parent_type.parent}")
- valid = Bool(self.name == parent_type.name)
+ valid = Bool(self.name == parent_type.name) # TODO wrong
return valid
def __str__(self):