|
@@ -13246,9 +13246,7 @@ class InterpLfun(InterpLtup):
|
|
|
def apply_fun(self, fun, args, e):
|
|
|
match fun:
|
|
|
case Function(name, xs, body, env):
|
|
|
- new_env = {x: v for (x,v) in env.items()}
|
|
|
- for (x,arg) in zip(xs, args):
|
|
|
- new_env[x] = arg
|
|
|
+ new_env = env.copy().update(zip(xs, args))
|
|
|
return self.interp_stmts(body, new_env)
|
|
|
case _:
|
|
|
raise Exception('apply_fun: unexpected: ' + repr(fun))
|
|
@@ -13395,9 +13393,7 @@ class TypeCheckLfun(TypeCheckLtup):
|
|
|
return
|
|
|
match ss[0]:
|
|
|
case FunctionDef(name, params, body, dl, returns, comment):
|
|
|
- new_env = {x: t for (x,t) in env.items()}
|
|
|
- for (x,t) in params:
|
|
|
- new_env[x] = t
|
|
|
+ new_env = env.copy().update(params)
|
|
|
rt = self.type_check_stmts(body, new_env)
|
|
|
check_type_equal(returns, rt, ss[0])
|
|
|
return self.type_check_stmts(ss[1:], env)
|