Permalink
Browse files

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...
1 parent d703632 commit fc88876a1bc08eb6c5b39be4ae8b9f72d366c604 @masak masak committed Aug 30, 2012
Showing with 11 additions and 9 deletions.
  1. +5 −5 src/Perl6/Actions.pm
  2. +3 −2 src/core/AST.pm
  3. +3 −2 src/core/Exception.pm
View
@@ -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(
View
@@ -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'))
}
View
@@ -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}";
}
}

0 comments on commit fc88876

Please sign in to comment.