File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,22 @@ class HLL::Compiler::SerializationContextBuilder {
169
169
}
170
170
}
171
171
172
+ # Loads a module immediately, and also makes sure we load it
173
+ # during the deserialization.
174
+ method load_module ($ module_name ) {
175
+ # Immediate loading.
176
+ my $ * LOAD_UNIT ;
177
+ my $ path := pir:: join (' /' , pir:: split (' ::' , $ module_name )) ~ ' .pbc' ;
178
+ pir::load_bytecode($ path );
179
+
180
+ # Make sure we do the loading during deserialization.
181
+ self . add_event(: deserialize_past(
182
+ PAST::Op. new ( : pirop(' load_bytecode vs' ), $ path )));
183
+
184
+ # Return UNIT of the loaded module.
185
+ $ * LOAD_UNIT
186
+ }
187
+
172
188
# Installs a symbol into the package. Does so immediately, and
173
189
# makes sure this happens on deserialization also.
174
190
method install_package_symbol (@ sym , $ obj ) {
Original file line number Diff line number Diff line change @@ -185,6 +185,11 @@ method you_are_here($/) {
185
185
186
186
# # Statement control
187
187
188
+ method statement_control :sym <use >($/ ) {
189
+ $ * SC . load_module(~ $ < name > );
190
+ make PAST::Stmts. new ();
191
+ }
192
+
188
193
method statement_control :sym <if >($/ ) {
189
194
my $ count := + $ < xblock > - 1 ;
190
195
my $ past := xblock_immediate( $ < xblock > [$ count ]. ast );
Original file line number Diff line number Diff line change @@ -185,6 +185,10 @@ token terminator:sym<}> { <?[}]> }
185
185
186
186
proto token statement_control { <...> }
187
187
188
+ token statement_control :sym <use > {
189
+ <sym > \s :s <name >
190
+ }
191
+
188
192
token statement_control :sym <if > {
189
193
<sym > \s :s
190
194
<xblock >
You can’t perform that action at this time.
0 commit comments