Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Redo @*INC handling in a slightly more sane way that is compatible wi…
…th parse tree pruning
  • Loading branch information
sorear committed Feb 20, 2012
1 parent 94ee991 commit 3474558
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/CodeGen.cs
Expand Up @@ -3686,6 +3686,12 @@ public class DowncallReceiver : CallReceiver {
}
return new Handle(ru);
}
public static object unit_get_incs(object[] args) {
StashEnt bv;
if (!Kernel.currentGlobals.TryGetValue("\u0008::GLOBAL@INC", out bv))
return new string[0];
return Builtins.UnboxLoS(bv.v);
}
public static object unit_need_unit(object[] args) {
// LinkUnit state is owned by the root
RuntimeUnit ru = (RuntimeUnit)Handle.Unbox(args[1]);
Expand Down
2 changes: 1 addition & 1 deletion src/NieczaPathSearch.pm6
Expand Up @@ -6,7 +6,7 @@ has @.path;
method load_module($name) {
my $sub = "".IO.combine($name.split('::'));

my @path = @*INC, @!path;
my @path = ($*unit ?? $*unit.get_incs !! ()), @!path;

for @path -> $pe {
for <pm6 pm setting> -> $ext {
Expand Down
7 changes: 7 additions & 0 deletions src/niecza
Expand Up @@ -319,6 +319,13 @@ method statement_prefix:LEAVE ($/) { phaser($/, 'LEAVE', :topic) }
method statement_prefix:CHECK ($/) { phaser($/, 'CHECK', :csp) }
method statement_prefix:END ($/) { phaser($/, 'END', :csp) }
method statement_prefix:INIT ($/) { phaser($/, 'INIT', :csp) }
method statement_prefix:BEGIN ($/) {
$*CURLEX<!sub>.create_static_pad;
my $con = self.make_constant($/, 'anon', 'BEGIN');
$<blast>.ast.run_BEGIN($con.name);
$con.init = True;
make $con;
}
}

my $usage = q:to/EOM/;
Expand Down

0 comments on commit 3474558

Please sign in to comment.