@@ -384,9 +384,10 @@ def dtor(x):
384
384
nonlocal dtor_value
385
385
dtor_value = x
386
386
387
- rt = ResourceType (ComponentInstance (), dtor )
387
+ rt = ResourceType (ComponentInstance (), dtor ) # usable in imports and exports
388
388
389
389
inst = ComponentInstance ()
390
+ rt2 = ResourceType (inst , dtor ) # only usable in exports
390
391
opts = mk_opts ()
391
392
392
393
def host_import (args ):
@@ -400,10 +401,11 @@ def host_import(args):
400
401
def core_wasm (args ):
401
402
nonlocal dtor_value
402
403
403
- assert (len (args ) == 3 )
404
+ assert (len (args ) == 4 )
404
405
assert (args [0 ].t == 'i32' and args [0 ].v == 0 )
405
406
assert (args [1 ].t == 'i32' and args [1 ].v == 1 )
406
407
assert (args [2 ].t == 'i32' and args [2 ].v == 2 )
408
+ assert (args [3 ].t == 'i32' and args [3 ].v == 13 )
407
409
assert (canon_resource_rep (inst , rt , 0 ) == 42 )
408
410
assert (canon_resource_rep (inst , rt , 1 ) == 43 )
409
411
assert (canon_resource_rep (inst , rt , 2 ) == 44 )
@@ -436,8 +438,8 @@ def core_wasm(args):
436
438
437
439
return [Value ('i32' , 0 ), Value ('i32' , 1 ), Value ('i32' , 3 )]
438
440
439
- ft = FuncType ([Own (rt ),Own (rt ),Borrow (rt )],[Own (rt ),Own (rt ),Own (rt )])
440
- args = [OwnHandle (42 , rt , 0 ), OwnHandle (43 , rt , 0 ), OwnHandle (44 , rt , 0 )]
441
+ ft = FuncType ([Own (rt ),Own (rt ),Borrow (rt ), Borrow ( rt2 ) ],[Own (rt ),Own (rt ),Own (rt )])
442
+ args = [OwnHandle (42 , rt , 0 ), OwnHandle (43 , rt , 0 ), OwnHandle (44 , rt , 0 ), OwnHandle ( 13 , rt2 , 0 ) ]
441
443
got ,post_return = canon_lift (opts , inst , core_wasm , ft , args )
442
444
443
445
assert (len (got ) == 3 )
0 commit comments