@@ -149,7 +149,7 @@ class HLL::Compiler::SerializationContextBuilder {
149
149
# Once it's loaded, set it as the outer context of the code
150
150
# being compiled.
151
151
my $ path := % * COMPILING <%?OPTIONS ><setting-path >;
152
- % * COMPILING <%?OPTIONS ><outer_ctx > := HLL::SettingManager . load_setting(
152
+ % * COMPILING <%?OPTIONS ><outer_ctx > := ModuleLoader . load_setting(
153
153
$ path ?? " $ path /$ setting_name" !! $ setting_name );
154
154
155
155
# Do load for pre-compiled situation.
@@ -162,7 +162,7 @@ class HLL::Compiler::SerializationContextBuilder {
162
162
PAST::Var. new ( : name(' block' ), : scope(' register' ) ),
163
163
PAST::Op. new (
164
164
: pasttype(' callmethod' ), : name(' load_setting' ),
165
- PAST::Var. new ( : name(' SettingManager ' ), : namespace(' HLL ' ), : scope(' package' ) ),
165
+ PAST::Var. new ( : name(' ModuleLoader ' ), : namespace([] ), : scope(' package' ) ),
166
166
$ setting_name
167
167
)
168
168
)
@@ -174,17 +174,18 @@ class HLL::Compiler::SerializationContextBuilder {
174
174
# during the deserialization.
175
175
method load_module ($ module_name ) {
176
176
# Immediate loading.
177
- my $ * MAIN_CTX ;
178
- my $ * CTXSAVE := HLL::Compiler;
179
- my $ path := pir:: join (' /' , pir:: split (' ::' , $ module_name )) ~ ' .pbc' ;
180
- pir::load_bytecode($ path );
177
+ ModuleLoader. load_module($ module_name );
181
178
182
179
# Make sure we do the loading during deserialization.
183
- self . add_event(: deserialize_past(
184
- PAST::Op. new ( : pirop(' load_bytecode vs' ), $ path )));
185
-
186
- # Return UNIT of the loaded module.
187
- $ * MAIN_CTX
180
+ self . add_event(: deserialize_past(PAST::Stmts. new (
181
+ PAST::Op. new (
182
+ : pirop(' load_bytecode vs' ), ' SettingManager.pbc'
183
+ ),
184
+ PAST::Op. new (
185
+ : pasttype(' callmethod' ), : name(' load_module' ),
186
+ PAST::Var. new ( : name(' ModuleLoader' ), : namespace([]), : scope(' package' ) ),
187
+ $ module_name
188
+ ))));
188
189
}
189
190
190
191
# Installs a symbol into the package. Does so immediately, and
0 commit comments