@@ -1433,7 +1433,7 @@ def step_call(
14331433 if not isinstance (closure , FunctionBlock ):
14341434 msg = f"Type error: { block .call } is of type { type (closure )} but should be a function."
14351435 if isinstance (closure , str ) and isinstance (scope .get (closure ), FunctionBlock ):
1436- msg += " You might want to call `${ " + block .call + " }`."
1436+ msg += " You might want to call `${ " + str ( block .call ) + " }`."
14371437 raise PDLRuntimeError (
14381438 msg ,
14391439 loc = append (loc , "call" ),
@@ -1449,12 +1449,17 @@ def step_call(
14491449 trace = block .model_copy (),
14501450 )
14511451 f_body = closure .returns
1452- f_scope = closure .scope | {"pdl_context" : scope ["pdl_context" ]} | args
1453- fun_loc = LocationType (
1454- file = closure .location .file ,
1455- path = closure .location .path + ["return" ],
1456- table = loc .table ,
1452+ f_scope = (
1453+ (closure .scope or {}) | {"pdl_context" : scope ["pdl_context" ]} | (args or {})
14571454 )
1455+ if closure .location is not None :
1456+ fun_loc = LocationType (
1457+ file = closure .location .file ,
1458+ path = closure .location .path + ["return" ],
1459+ table = loc .table ,
1460+ )
1461+ else :
1462+ fun_loc = empty_block_location
14581463 try :
14591464 result , background , _ , f_trace = yield from step_block (
14601465 state , f_scope , f_body , fun_loc
0 commit comments