File tree Expand file tree Collapse file tree 6 files changed +28
-2
lines changed Expand file tree Collapse file tree 6 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ under the licensing terms detailed in LICENSE:
1717* Bowen Wang <bowen@nearprotocol.com>
1818* Emil Laine <laine.emil@gmail.com>
1919* Stephen Paul Weber <stephen.weber@shopify.com>
20+ * Jay Phelps <hello@jayphelps.com>
2021
2122Portions of this software are derived from third-party works licensed under
2223the following terms:
Original file line number Diff line number Diff line change @@ -324,6 +324,7 @@ export class Flow {
324324 case NativeType . F32 : { temps = parentFunction . tempF32s ; break ; }
325325 case NativeType . F64 : { temps = parentFunction . tempF64s ; break ; }
326326 case NativeType . V128 : { temps = parentFunction . tempV128s ; break ; }
327+ case NativeType . Anyref : { temps = parentFunction . tempAnyrefs ; break ; }
327328 default : throw new Error ( "concrete type expected" ) ;
328329 }
329330 var local : Local ;
@@ -395,6 +396,10 @@ export class Flow {
395396 temps = parentFunction . tempV128s || ( parentFunction . tempV128s = [ ] ) ;
396397 break ;
397398 }
399+ case NativeType . Anyref : {
400+ temps = parentFunction . tempAnyrefs || ( parentFunction . tempAnyrefs = [ ] ) ;
401+ break ;
402+ }
398403 default : throw new Error ( "concrete type expected" ) ;
399404 }
400405 assert ( local . index >= 0 ) ;
Original file line number Diff line number Diff line change @@ -1423,6 +1423,10 @@ export class Module {
14231423 // TODO
14241424 return 0 ;
14251425 }
1426+ // Not possible to clone an anyref as it is opaque
1427+ case NativeType . Anyref : {
1428+ return 0 ;
1429+ }
14261430 default : {
14271431 throw new Error ( "concrete type expected" ) ;
14281432 }
Original file line number Diff line number Diff line change @@ -2900,6 +2900,7 @@ export class Function extends TypedElement {
29002900 tempF32s : Local [ ] | null = null ;
29012901 tempF64s : Local [ ] | null = null ;
29022902 tempV128s : Local [ ] | null = null ;
2903+ tempAnyrefs : Local [ ] | null = null ;
29032904
29042905 // used by flows to keep track of break labels
29052906 nextBreakId : i32 = 0 ;
Original file line number Diff line number Diff line change 33export declare function external ( a : anyref ) : anyref ;
44
55export function internal ( a : anyref ) : anyref {
6- return a ;
6+ const b = external ( a ) ;
7+ let c = external ( b ) ;
8+ var d = external ( c ) ;
9+ return d ;
710}
811
912// can use reflection to work with anyref values
Original file line number Diff line number Diff line change 3030 if
3131 i32.const 0
3232 i32.const 24
33- i32.const 16
33+ i32.const 19
3434 i32.const 0
3535 call $~lib/builtins/abort
3636 unreachable
4545 call $~lib/bindings/console/log
4646 )
4747 (func $features/reference-types/internal (; 6 ;) (type $FUNCSIG$aa ) (param $0 anyref ) (result anyref )
48+ (local $1 anyref )
49+ (local $2 anyref )
50+ (local $3 anyref )
4851 local.get $0
52+ call $features/reference-types/external
53+ local.set $1
54+ local.get $1
55+ call $features/reference-types/external
56+ local.set $2
57+ local.get $2
58+ call $features/reference-types/external
59+ local.set $3
60+ local.get $3
4961 )
5062 (func $start (; 7 ;) (type $FUNCSIG$v )
5163 call $start:features/reference-types
You can’t perform that action at this time.
0 commit comments