Skip to content

Commit

Permalink
Add a "load_module" method to Perl6::Compiler for HLL interop
Browse files Browse the repository at this point in the history
  • Loading branch information
tene committed Dec 27, 2009
1 parent 06c9474 commit daa5600
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Perl6/Compiler.pir
Expand Up @@ -92,6 +92,26 @@ Perl6::Compiler - Perl6 compiler
setattribute nqpproto, '@cmdoptions', $P0
.end

.sub load_module :method
.param string name
.local string base, filename
.local pmc namelist, module
namelist = self.'parse_name'(name)
base = join '/', namelist
push_eh no_precompiled
filename = concat base, '.pir'
load_bytecode filename
pop_eh
goto done
no_precompiled:
pop_eh
filename = concat base, '.pm'
self.'evalfiles'(filename)
done:
module = self.'get_module'(name)
.return (module)
.end

.sub 'main' :main
.param pmc args_str
$P0 = compreg 'Perl6'
Expand Down

0 comments on commit daa5600

Please sign in to comment.