def _call_eager(self, expr: E.Apply, arguments: List[V.Base]) -> V.Base: argument_values = [arg.coerce(ty) for arg, ty in zip(arguments, self.argument_types)] try: ans: V.Base = self.F(*argument_values) except Exception as exn: raise Error.EvalError(expr, "function evaluation failed") from exn return ans.coerce(self.return_type)
def _call_eager(self, expr: E.Apply, arguments: List[V.Base]) -> V.Base: arg0 = arguments[0] assert isinstance(arg0, V.Int) if arg0.value < 0: raise Error.EvalError(expr, "range() got negative argument") return V.Array(T.Array(T.Int()), [V.Int(x) for x in range(arg0.value)])