Permalink
Browse files

crude implementation of "require ::($modulename) <importlist>

only works for a single chunk, e.g. "require Test::($name) <&symbols>" does not work
  • Loading branch information...
1 parent a930588 commit 60c572c3f5b06d48ca18ee7041bbd67d9b1fd873 @moritz moritz committed Jan 6, 2013
Showing with 19 additions and 1 deletion.
  1. +1 −1 src/Perl6/Actions.pm
  2. +18 −0 src/Perl6/World.pm
View
@@ -960,7 +960,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
method statement_control:sym<require>($/) {
my $past := QAST::Stmts.new(:node($/));
my $name_past := $<module_name>
- ?? QAST::SVal.new(:value($<module_name><longname><name>.Str))
+ ?? $*W.disect_longname($<module_name><longname>).name_past()
!! $<EXPR>[0].ast;
$past.push(QAST::Op.new(
View
@@ -1544,6 +1544,24 @@ class Perl6::World is HLL::World {
nqp::join('::', @parts)
~ ($with_adverbs ?? nqp::join('', @!colonpairs) !! '');
}
+
+ # returns a QAST tree that represents the name
+ # currently needed for 'require ::($modulename) <importlist>'
+ # ignore adverbs for now
+ method name_past() {
+ if self.contains_indirect_lookup() {
+ if @!components == 1 {
+ return @!components[0];
+ }
+ else {
+ nqp::die("Not yet implemented :(");
+ }
+ }
+ else {
+ my $value := nqp::join('::', @!components);
+ QAST::SVal.new(:$value);
+ }
+ }
# Gets the individual components, which may be PAST nodes for
# unknown pieces.

0 comments on commit 60c572c

Please sign in to comment.