File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,16 @@ impl VM {
5555
5656 self . modules . push ( module. clone ( ) ) ;
5757
58+ for var in module. globals . iter ( ) {
59+ if self . global_scope . get ( var) . is_some ( ) {
60+ return Err ( format ! (
61+ "multiple definition of global {} (second definition in module {})" ,
62+ var, module. name
63+ ) ) ;
64+ }
65+ self . global_scope . create_if_doesnt_exist ( var) ;
66+ }
67+
5868 for func in module. functions . iter ( ) {
5969 if func. ctor {
6070 self . check_stack_overflow ( ) ;
@@ -78,16 +88,6 @@ impl VM {
7888 }
7989 }
8090
81- for var in module. globals . iter ( ) {
82- if self . global_scope . get ( var) . is_some ( ) {
83- return Err ( format ! (
84- "multiple definition of global {} (second definition in module {})" ,
85- var, module. name
86- ) ) ;
87- }
88- self . global_scope . create_if_doesnt_exist ( var) ;
89- }
90-
9191 for dependency in module. dependencies . iter ( ) {
9292 let name = dependency. to_string ( ) ;
9393
You can’t perform that action at this time.
0 commit comments