Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
X::TypeCheck::MacroUnquote -> X::TypeCheck::Splice
Also added an $.action attribute, because splicing takes place both during
quasi-block incarnation and during macro application.
  • Loading branch information
Carl Masak committed Aug 30, 2012
1 parent d703632 commit fc88876
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/Perl6/Actions.pm
Expand Up @@ -3419,11 +3419,11 @@ class Perl6::Actions is HLL::Actions {
return 1;
}
unless istype($quasi_ast, $ast_class) {
# XXX: Need to awesomeize with which type it got
$*W.throw('X::TypeCheck::MacroUnquote',
got => $quasi_ast,
expected => $ast_class,
symbol => ~$<identifier>,
$*W.throw('X::TypeCheck::Splice',
got => $quasi_ast,
expected => $ast_class,
symbol => ~$<identifier>,
action => 'macro application',
);
}
my $past := QAST::Block.new(
Expand Down
5 changes: 3 additions & 2 deletions src/core/AST.pm
Expand Up @@ -19,9 +19,10 @@ my class AST {
my $pasts := nqp::list();
for @unquote_asts {
# TODO: find and report macro name
X::TypeCheck::MacroUnquote.new(
got => $_,
X::TypeCheck::Splice.new(
got => $_,
expected => AST,
action => 'unquote evaluation',
).throw unless $_ ~~ AST;
nqp::push($pasts, nqp::getattr(nqp::p6decont($_), AST, '$!past'))
}
Expand Down
5 changes: 3 additions & 2 deletions src/core/Exception.pm
Expand Up @@ -819,9 +819,10 @@ my class X::TypeCheck::Assignment is X::TypeCheck {
}
}

my class X::TypeCheck::MacroUnquote is X::TypeCheck does X::Comp {
my class X::TypeCheck::Splice is X::TypeCheck does X::Comp {
has $.action;
method message {
"Type check failed in macro application; expected {$.expected.^name} but got {$.got.^name}";
"Type check failed in {$.action}; expected {$.expected.^name} but got {$.got.^name}";
}

}
Expand Down

0 comments on commit fc88876

Please sign in to comment.