Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
intermediate commit
Pushed to help jnthn debug a hang.
  • Loading branch information
Carl Masak committed Aug 18, 2012
1 parent a908aa4 commit 0512eca
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Perl6/Actions.pm
Expand Up @@ -1063,6 +1063,10 @@ class Perl6::Actions is HLL::Actions {
method term:sym<statement_prefix>($/) { make $<statement_prefix>.ast; }
method term:sym<lambda>($/) { make block_closure($<pblock>.ast); }
method term:sym<sigterm>($/) { make $<sigterm>.ast; }
method term:sym<unquote>($/) {
make QAST::Unquote.new(:position(+@*UNQUOTE_ASTS));
@*UNQUOTE_ASTS.push($<statementlist>.ast);
}

method name($/) { }

Expand Down Expand Up @@ -4623,6 +4627,7 @@ class Perl6::Actions is HLL::Actions {
method quote:sym<quasi>($/) {
my $ast_class := $*W.find_symbol(['AST']);
my $quasi_ast := $ast_class.new();
$<block>.ast<uninstall_if_immediately_used>.shift;
nqp::bindattr($quasi_ast, $ast_class, '$!past', $<block>.ast<past_block>[1]);
$*W.add_object($quasi_ast);
my $throwaway_block := QAST::Block.new();
Expand All @@ -4633,7 +4638,8 @@ class Perl6::Actions is HLL::Actions {
));
make QAST::Op.new(:op<callmethod>, :name<incarnate>,
QAST::WVal.new( :value($quasi_ast) ),
$quasi_context);
$quasi_context,
QAST::Op.new( :op('list'), |@*UNQUOTE_ASTS ));
}

method quote_escape:sym<$>($/) {
Expand Down
1 change: 1 addition & 0 deletions src/Perl6/Grammar.pm
Expand Up @@ -2253,6 +2253,7 @@ grammar Perl6::Grammar is HLL::Grammar {
token quote:sym<quasi> {
<sym> <.ws> <!before '('>
:my $*IN_QUASI := 1;
:my @*UNQUOTE_ASTS := [];
<block>
}

Expand Down
9 changes: 8 additions & 1 deletion src/core/AST.pm
Expand Up @@ -8,12 +8,19 @@ my class AST {
$!past := $past;
}

method incarnate($quasi_context) {
method incarnate($quasi_context, @unquote_asts) {
my $incarnation = self.clone();
my $list := nqp::list();
for @unquote_asts { nqp::push($list, $_); }
$incarnation.evaluate_unquotes($list);
nqp::bindattr(nqp::p6decont($incarnation), AST, '$!quasi_context', $quasi_context);
return $incarnation;
}

method evaluate_unquotes(@unquote_asts) {
$!past.evaluate_unquotes(@unquote_asts);
}

method is_quasi_ast {
so $!quasi_context;
}
Expand Down

0 comments on commit 0512eca

Please sign in to comment.