@@ -973,11 +973,11 @@ dropped all borrowed handles by the time `task.return` is called which means
973
973
that the caller can assume that all its lent handles have been returned to it
974
974
when it receives the ` SUBTASK ` ` RETURNED ` event.
975
975
``` python
976
- def return_ (self , results ):
976
+ def return_ (self , result ):
977
977
trap_if(self .state == Task.State.RESOLVED )
978
978
trap_if(self .num_borrows > 0 )
979
- assert (results is not None )
980
- self .on_resolve(results )
979
+ assert (result is not None )
980
+ self .on_resolve(result )
981
981
self .state = Task.State.RESOLVED
982
982
```
983
983
@@ -1061,11 +1061,11 @@ transitions:
1061
1061
self .state = Subtask.State.STARTED
1062
1062
return on_start()
1063
1063
1064
- def sync_on_resolve (results ):
1065
- assert (results is not None )
1064
+ def sync_on_resolve (result ):
1065
+ assert (result is not None )
1066
1066
assert (self .state == Subtask.State.STARTED )
1067
1067
self .state = Subtask.State.RETURNED
1068
- on_resolve(results )
1068
+ on_resolve(result )
1069
1069
1070
1070
await Task.call_sync(self .supertask, callee, sync_on_start, sync_on_resolve)
1071
1071
```
@@ -1114,8 +1114,8 @@ cancellation:
1114
1114
self .state = Subtask.State.STARTED
1115
1115
return on_start()
1116
1116
1117
- def async_on_resolve (results ):
1118
- if results is None :
1117
+ def async_on_resolve (result ):
1118
+ if result is None :
1119
1119
if self .state == Subtask.State.STARTING :
1120
1120
self .state = Subtask.State.CANCELLED_BEFORE_STARTED
1121
1121
else :
@@ -1124,7 +1124,7 @@ cancellation:
1124
1124
else :
1125
1125
assert (self .state == Subtask.State.STARTED )
1126
1126
self .state = Subtask.State.RETURNED
1127
- on_resolve(results )
1127
+ on_resolve(result )
1128
1128
1129
1129
async def async_on_block (awaitable ):
1130
1130
relinquish_control()
@@ -1690,7 +1690,7 @@ def contains(t, p):
1690
1690
case VariantType(cases):
1691
1691
return p(t) or any (contains(c.t, p) for c in cases)
1692
1692
case FuncType():
1693
- return any (p(u) for u in t.param_types() + t.result_types ())
1693
+ return any (p(u) for u in t.param_types() + t.result_type ())
1694
1694
case _:
1695
1695
assert (False )
1696
1696
```
@@ -2595,7 +2595,7 @@ MAX_FLAT_RESULTS = 1
2595
2595
2596
2596
def flatten_functype (opts , ft , context ):
2597
2597
flat_params = flatten_types(ft.param_types())
2598
- flat_results = flatten_types(ft.result_types ())
2598
+ flat_results = flatten_types(ft.result_type ())
2599
2599
if opts.sync:
2600
2600
if len (flat_params) > MAX_FLAT_PARAMS :
2601
2601
flat_params = [' i32' ]
@@ -3067,7 +3067,7 @@ validation is performed:
3067
3067
* requires options based on [ ` lift(param) ` ] ( #canonopt-validation ) for all parameters in ` ft `
3068
3068
* requires options based on [ ` lower(result) ` ] ( #canonopt-validation ) if ` ft ` has a result
3069
3069
* if ` len(flatten_types(ft.param_types())) > MAX_FLAT_PARAMS ` , ` realloc ` is required
3070
- * if ` len(flatten_types(ft.result_types ())) > MAX_FLAT_RESULTS ` , ` memory ` is required
3070
+ * if ` len(flatten_types(ft.result_type ())) > MAX_FLAT_RESULTS ` , ` memory ` is required
3071
3071
3072
3072
When instantiating component instance ` $inst ` :
3073
3073
* Define ` $f ` to be the partially-bound closure ` canon_lift($opts, $inst, $ft, $callee) `
@@ -3114,8 +3114,8 @@ with compound return values.
3114
3114
if opts.sync:
3115
3115
flat_results = await call_and_trap_on_throw(callee, task, flat_args)
3116
3116
assert (types_match_values(flat_ft.results, flat_results))
3117
- results = lift_flat_values(cx, MAX_FLAT_RESULTS , CoreValueIter(flat_results), ft.result_types ())
3118
- task.return_(results )
3117
+ result = lift_flat_values(cx, MAX_FLAT_RESULTS , CoreValueIter(flat_results), ft.result_type ())
3118
+ task.return_(result )
3119
3119
if opts.post_return is not None :
3120
3120
task.inst.may_leave = False
3121
3121
[] = await call_and_trap_on_throw(opts.post_return, task, flat_results)
@@ -3218,7 +3218,7 @@ validation is performed where `$callee` has type `$ft`:
3218
3218
* requires options [ based on ` lower(param) ` ] ( #canonopt-validation ) for all parameters in ` ft `
3219
3219
* requires options [ based on ` lift(result) ` ] ( #canonopt-validation ) if ` ft ` has a result
3220
3220
* if ` len(flatten_types(ft.param_types())) > max_flat_params ` , ` memory ` is required
3221
- * if ` len(flatten_types(ft.result_types ())) > max_flat_results ` , ` realloc ` is required
3221
+ * if ` len(flatten_types(ft.result_type ())) > max_flat_results ` , ` realloc ` is required
3222
3222
* 🔀 if ` async ` is specified, ` memory ` must be present
3223
3223
3224
3224
When instantiating component instance ` $inst ` :
@@ -3252,9 +3252,9 @@ In the synchronous case, `Subtask.call_sync` ensures a fully-synchronous call to
3252
3252
return lift_flat_values(cx, MAX_FLAT_PARAMS , flat_args, ft.param_types())
3253
3253
3254
3254
flat_results = None
3255
- def on_resolve (results ):
3255
+ def on_resolve (result ):
3256
3256
nonlocal flat_results
3257
- flat_results = lower_flat_values(cx, MAX_FLAT_RESULTS , results , ft.result_types (), flat_args)
3257
+ flat_results = lower_flat_values(cx, MAX_FLAT_RESULTS , result , ft.result_type (), flat_args)
3258
3258
3259
3259
await subtask.call_sync(callee, on_start, on_resolve)
3260
3260
assert (types_match_values(flat_ft.results, flat_results))
@@ -3269,10 +3269,10 @@ always returns control flow back to the caller without blocking:
3269
3269
on_progress()
3270
3270
return lift_flat_values(cx, MAX_FLAT_ASYNC_PARAMS , flat_args, ft.param_types())
3271
3271
3272
- def on_resolve (results ):
3272
+ def on_resolve (result ):
3273
3273
on_progress()
3274
- if results is not None :
3275
- [] = lower_flat_values(cx, 0 , results , ft.result_types (), flat_args)
3274
+ if result is not None :
3275
+ [] = lower_flat_values(cx, 0 , result , ft.result_type (), flat_args)
3276
3276
3277
3277
subtaski = None
3278
3278
def on_progress ():
@@ -3494,8 +3494,8 @@ async def canon_task_return(task, result_type, opts: LiftOptions, flat_args):
3494
3494
trap_if(result_type != task.ft.results)
3495
3495
trap_if(not LiftOptions.equal(opts, task.opts))
3496
3496
cx = LiftLowerContext(opts, task.inst, task)
3497
- results = lift_flat_values(cx, MAX_FLAT_PARAMS , CoreValueIter(flat_args), task.ft.result_types ())
3498
- task.return_(results )
3497
+ result = lift_flat_values(cx, MAX_FLAT_PARAMS , CoreValueIter(flat_args), task.ft.result_type ())
3498
+ task.return_(result )
3499
3499
return []
3500
3500
```
3501
3501
The ` trap_if(task.opts.sync) ` prevents ` task.return ` from being called by
0 commit comments