Skip to content

Commit

Permalink
it works!
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashvin-Ranjan committed Jun 4, 2021
1 parent 81c89ed commit 2e3199d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions python/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,6 @@ async def eval_expr(self, expr):
elif expr.data == "function_callback" or expr.data == "function_callback_pipe":
if expr.data == "function_callback":
function, *arguments = expr.children[0].children
if len(arguments) == 0:
arguemnts.append(())
else:
mainarg = expr.children[0]
function, *arguments = expr.children[1].children
Expand All @@ -799,7 +797,7 @@ async def eval_expr(self, expr):
for arg in arguments:
arg_values.append(await self.eval_expr(arg))
if len(arg_values) == 0:
arg_values = ["unit"]
arg_values = [()]
return await (await self.eval_expr(function)).run(arg_values)
elif expr.data == "or_expression":
left, _, right = expr.children
Expand Down Expand Up @@ -1312,12 +1310,13 @@ def type_check_expr(self, expr):
elif expr.data == "function_callback" or expr.data == "function_callback_pipe":
if expr.data == "function_callback":
function, *arguments = expr.children[0].children
if len(arguments) == 0:
arguments.append("unit")
else:
mainarg = expr.children[0]
function, *arguments = expr.children[1].children
arguments.append(mainarg)

if len(arguments) == 0:
arguments.append("unit")
func_type = self.type_check_expr(function)
if func_type is None:
return None
Expand All @@ -1336,7 +1335,9 @@ def type_check_expr(self, expr):
for n, (argument, arg_type) in enumerate(
zip(arguments, arg_types), start=1
):
check_type = self.type_check_expr(argument)
check_type = argument
if(argument != "unit"):
check_type = self.type_check_expr(check_type)
if check_type is None:
parameters_have_none = True
resolved_arg_type = apply_generics(arg_type, check_type, generics)
Expand Down

0 comments on commit 2e3199d

Please sign in to comment.