Skip to content

Commit 6d00d6b

Browse files
committed
Tidy up canon_lift CABI code
1 parent 6a1667f commit 6d00d6b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

design/mvp/CanonicalABI.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,17 +2042,17 @@ The resulting function `$f` takes 2 runtime arguments:
20422042
Given this, `canon_lower` is defined:
20432043
```python
20442044
async def canon_lower(opts, callee, ft, task, flat_args):
2045-
inst = task.inst
2046-
trap_if(not inst.may_leave)
2045+
trap_if(not task.inst.may_leave)
2046+
20472047
flat_args = CoreValueIter(flat_args)
2048+
flat_results = None
20482049

20492050
if opts.sync:
2050-
subtask = Subtask(opts, inst)
2051+
subtask = Subtask(opts, task.inst)
20512052

20522053
def start_thunk():
20532054
return lift_sync_values(subtask, MAX_FLAT_PARAMS, flat_args, ft.param_types())
20542055

2055-
flat_results = None
20562056
def return_thunk(results):
20572057
nonlocal flat_results
20582058
flat_results = lower_sync_values(subtask, MAX_FLAT_RESULTS, results, ft.result_types(), flat_args)
@@ -2061,7 +2061,7 @@ async def canon_lower(opts, callee, ft, task, flat_args):
20612061

20622062
subtask.finish()
20632063
else:
2064-
subtask = AsyncSubtask(opts, inst)
2064+
subtask = AsyncSubtask(opts, task.inst)
20652065

20662066
async def do_call():
20672067
def start_thunk():

design/mvp/canonical-abi/definitions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,17 +1400,17 @@ async def call_and_trap_on_throw(callee, task, args):
14001400
### `canon lower`
14011401

14021402
async def canon_lower(opts, callee, ft, task, flat_args):
1403-
inst = task.inst
1404-
trap_if(not inst.may_leave)
1403+
trap_if(not task.inst.may_leave)
1404+
14051405
flat_args = CoreValueIter(flat_args)
1406+
flat_results = None
14061407

14071408
if opts.sync:
1408-
subtask = Subtask(opts, inst)
1409+
subtask = Subtask(opts, task.inst)
14091410

14101411
def start_thunk():
14111412
return lift_sync_values(subtask, MAX_FLAT_PARAMS, flat_args, ft.param_types())
14121413

1413-
flat_results = None
14141414
def return_thunk(results):
14151415
nonlocal flat_results
14161416
flat_results = lower_sync_values(subtask, MAX_FLAT_RESULTS, results, ft.result_types(), flat_args)
@@ -1419,7 +1419,7 @@ def return_thunk(results):
14191419

14201420
subtask.finish()
14211421
else:
1422-
subtask = AsyncSubtask(opts, inst)
1422+
subtask = AsyncSubtask(opts, task.inst)
14231423

14241424
async def do_call():
14251425
def start_thunk():

0 commit comments

Comments
 (0)