Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Perl6::Actions] wrap macro-arg ASTs in thunks
This causes the macro arguments to correctly carry
their lexical environment with them, and so everything
inside of them is now correctly, hygienically resolved.
  • Loading branch information
Carl Masak committed Nov 2, 2012
1 parent e7ab9ac commit 9bb7de6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Perl6/Actions.pm
Expand Up @@ -3487,7 +3487,8 @@ class Perl6::Actions is HLL::Actions does STDActions {
sub add_macro_arguments($expr, $ast_class, @argument_asts) {
sub wrap_and_add_expr($expr) {
my $quasi_ast := $ast_class.new();
nqp::bindattr($quasi_ast, $ast_class, '$!past', $expr);
my $wrapped := QAST::Op.new( :op('call'), make_thunk_ref($expr, $expr.node) );
nqp::bindattr($quasi_ast, $ast_class, '$!past', $wrapped);
@argument_asts.push($quasi_ast);
}

Expand Down

0 comments on commit 9bb7de6

Please sign in to comment.