Created
June 8, 2025 20:10
-
-
Save MasterDuke17/329ed72603eb4d5bc10ca701c3039b66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git lib/Test.rakumod lib/Test.rakumod | |
index 23520d83c..fd62c3983 100644 | |
--- lib/Test.rakumod | |
+++ lib/Test.rakumod | |
@@ -1,5 +1,12 @@ | |
use MONKEY-GUTS; # Allow NQP ops. | |
+sub eval_exception($code) { | |
+ try { | |
+ EVAL ($code); | |
+ } | |
+ $!; | |
+} | |
+ | |
unit module Test; | |
# Copyright (C) 2007 - 2025 Yet Another Society | |
@@ -705,13 +712,6 @@ sub die-on-fail { | |
False; | |
} | |
-sub eval_exception($code) { | |
- try { | |
- EVAL ($code); | |
- } | |
- $!; | |
-} | |
- | |
# Stringifies values passed to &cmp-ok. | |
sub stringify(Mu $obj is raw --> Str:D) { | |
(try $obj.raku if nqp::can($obj, 'raku')) | |
diff --git src/Raku/ast/package.rakumod src/Raku/ast/package.rakumod | |
index ab16d21d4..2baf0a6a7 100644 | |
--- src/Raku/ast/package.rakumod | |
+++ src/Raku/ast/package.rakumod | |
@@ -267,7 +267,7 @@ method install-extra-declarations(RakuAST::Resolver $resolver) { | |
# Need to install the package somewhere | |
method install-in-scope(RakuAST::Resolver $resolver, str $scope, RakuAST::Name $name, RakuAST::Name $full-name) { | |
self.IMPL-INSTALL-PACKAGE( | |
- $resolver, $scope, $name, $resolver.current-package, :meta-object(Mu) | |
+ $resolver, $scope, $full-name, $resolver.current-package, :meta-object(Mu) | |
) if $scope eq 'my' || $scope eq 'our'; | |
} | |
@@ -588,7 +588,7 @@ method install-in-scope(RakuAST::Resolver $resolver, str $scope, RakuAST::Na | |
:name($group-name), :repr(self.repr) | |
); | |
self.IMPL-INSTALL-PACKAGE( | |
- $resolver, $scope, $name, $resolver.current-package, | |
+ $resolver, $scope, $full-name, $resolver.current-package, | |
:meta-object($group), | |
); | |
} | |
diff --git src/Raku/ast/resolver.rakumod src/Raku/ast/resolver.rakumod | |
index 75c6090c2..7268386e1 100644 | |
--- src/Raku/ast/resolver.rakumod | |
+++ src/Raku/ast/resolver.rakumod | |
@@ -217,16 +217,31 @@ method IMPL-RESOLVE-NAME-IN-PACKAGES($Rname, :$sigil, Bool :$partial) { | |
# it being passed as an argument then??? XXX | |
# $name := $sigil ~ $name if $sigil; | |
- for $!packages { | |
- my $stash := self.IMPL-STASH-HASH($_.compile-time-value); | |
- return $partial | |
- ?? ($stash{$name}, List.new, 'global') | |
- !! self.external-constant($stash, $name) | |
- if nqp::existskey($stash,$name); | |
- } | |
+ my @parts := nqp::clone($Rname.IMPL-UNWRAP-LIST($Rname.parts)); | |
+ for @parts { | |
+ my $pname := nqp::istype($_,RakuAST::Name::Part::Simple) | |
+ ?? $_.name | |
+ !! ''; | |
+ for $!packages { | |
+ #my $f := nqp::open("rde.log", "wa"); | |
+ #my $buf := nqp::newtype(nqp::null(), 'VMArray'); | |
+ #nqp::composetype($buf, nqp::hash('array', nqp::hash('type', uint8))); | |
+ ##nqp::writefh($f, "dumping\n"); | |
+ #nqp::writefh($f, nqp::encode($_.lexical-name, 'utf8', $buf)); | |
+ #nqp::closefh($f); | |
+ if !$_.has-compile-time-value { | |
+ # XXX should throw | |
+ last; | |
+ } | |
+ my $stash := self.IMPL-STASH-HASH($_.compile-time-value); | |
+ return $partial | |
+ ?? ($stash{$pname}, List.new, 'global') | |
+ !! self.external-constant($stash, $pname) | |
+ if nqp::existskey($stash,$pname); | |
+ } | |
+ } | |
my $symbol := $!global; | |
- my @parts := nqp::clone($Rname.IMPL-UNWRAP-LIST($Rname.parts)); | |
while @parts { | |
my $part := @parts.shift; | |
$name := nqp::istype($part,RakuAST::Name::Part::Simple) | |
diff --git src/Raku/ast/scoping.rakumod src/Raku/ast/scoping.rakumod | |
index 7e1fc773d..6b3ff5392 100644 | |
--- src/Raku/ast/scoping.rakumod | |
+++ src/Raku/ast/scoping.rakumod | |
@@ -619,6 +619,14 @@ method generate-lookup() { | |
$lookup.set-resolution(self); | |
$lookup | |
} | |
+ | |
+ method has-compile-time-value() { | |
+ $!maybe-compile-time-value ?? True !! False | |
+ } | |
+ | |
+ method compile-time-value() { | |
+ $!maybe-compile-time-value | |
+ } | |
} | |
class RakuAST::Declaration::Mergeable { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment