diff options
Diffstat (limited to 'neb/__init__.py')
| -rw-r--r-- | neb/__init__.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/neb/__init__.py b/neb/__init__.py index c505a04..16d5e44 100644 --- a/neb/__init__.py +++ b/neb/__init__.py @@ -143,11 +143,10 @@ class UserFunction(Function): args.append(Arg(param.name, TypeEnum.ANY)) prev_type = False elif isinstance(param, Type) and not prev_type and not first: - typ = TypeEnum.__getattr__(param.name[1:].upper()) if many is None: - args[-1].type_ = typ + args[-1].type_ = param.name else: - many.type_ = typ + many.type_ = param.name prev_type = True else: raise NebPanic("invalid :func signature", param) @@ -164,7 +163,6 @@ class UserFunction(Function): # if we got "many", wrap the rest in a list if self.many: this_env.register(self.many.name, List(evaluated_args[len(self.params):])) - return interpret(self.body, env=this_env, ns=ns) @@ -176,7 +174,10 @@ class TypeWrap: self.is_func = is_func def validate_type(self, target, env, ns): - valid = self.is_func(None, [target], env, ns) + # 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 valid.value == True: return valid parent_type = env.get(f"{target.type_}") |
