Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Stub in use. Will eventually be where GLOBAL merging and stuff gets d…
…one.
  • Loading branch information
jnthn committed Mar 13, 2011
1 parent 5d47501 commit d0337bd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/HLL/SerializationContextBuilder.pm
Expand Up @@ -169,6 +169,22 @@ class HLL::Compiler::SerializationContextBuilder {
}
}

# Loads a module immediately, and also makes sure we load it
# during the deserialization.
method load_module($module_name) {
# Immediate loading.
my $*LOAD_UNIT;
my $path := pir::join('/', pir::split('::', $module_name)) ~ '.pbc';
pir::load_bytecode($path);

# Make sure we do the loading during deserialization.
self.add_event(:deserialize_past(
PAST::Op.new( :pirop('load_bytecode vs'), $path )));

# Return UNIT of the loaded module.
$*LOAD_UNIT
}

# Installs a symbol into the package. Does so immediately, and
# makes sure this happens on deserialization also.
method install_package_symbol(@sym, $obj) {
Expand Down
5 changes: 5 additions & 0 deletions src/NQP/Actions.pm
Expand Up @@ -185,6 +185,11 @@ method you_are_here($/) {

## Statement control

method statement_control:sym<use>($/) {
$*SC.load_module(~$<name>);
make PAST::Stmts.new();
}

method statement_control:sym<if>($/) {
my $count := +$<xblock> - 1;
my $past := xblock_immediate( $<xblock>[$count].ast );
Expand Down
4 changes: 4 additions & 0 deletions src/NQP/Grammar.pm
Expand Up @@ -185,6 +185,10 @@ token terminator:sym<}> { <?[}]> }

proto token statement_control { <...> }

token statement_control:sym<use> {
<sym> \s :s <name>
}

token statement_control:sym<if> {
<sym> \s :s
<xblock>
Expand Down

0 comments on commit d0337bd

Please sign in to comment.