File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ pub struct WastContext {
1919 /// recently defined.
2020 current : Option < InstanceKind > ,
2121 core_linker : Linker < ( ) > ,
22- modules : HashMap < String , ModuleKind > ,
22+ modules : HashMap < Option < String > , ModuleKind > ,
2323 #[ cfg( feature = "component-model" ) ]
2424 component_linker : component:: Linker < ( ) > ,
2525
@@ -645,18 +645,16 @@ impl WastContext {
645645 line : _,
646646 } => {
647647 let module = self . module_definition ( & file) ?;
648- if let Some ( name) = name {
649- self . modules . insert ( name. to_string ( ) , module) ;
650- }
648+ self . modules . insert ( name. map ( |s| s. to_string ( ) ) , module) ;
651649 }
652650 ModuleInstance {
653651 instance,
654652 module,
655653 line : _,
656654 } => {
657- let module = module
658- . as_deref ( )
659- . and_then ( |n| self . modules . get ( n ) )
655+ let module = self
656+ . modules
657+ . get ( & module . as_ref ( ) . map ( |s| s . to_string ( ) ) )
660658 . cloned ( )
661659 . ok_or_else ( || format_err ! ( "no module named {module:?}" ) ) ?;
662660 self . module ( instance. as_deref ( ) , & module) ?;
Original file line number Diff line number Diff line change 1+ (module definition (func (export " f" )))
2+ (module instance)
3+
4+ (invoke " f" )
5+ (assert_return (invoke " f" ))
You can’t perform that action at this time.
0 commit comments