Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add some more nibble_to_str logic.
This lets us distinguish a few more valid-at-compile-time values for &foofix
declarations.
  • Loading branch information
peschwa committed Oct 8, 2015
1 parent 6f31121 commit 6f65c36
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/Perl6/World.nqp
Expand Up @@ -2456,7 +2456,34 @@ class Perl6::World is HLL::World {
# single thing or a list of things, as done above)
self.nibble_to_str($/, $ast[0], $mkerr);
} else {
$/.CURSOR.panic($mkerr());
# check if there's something in $ast that probably wont work
# as a compile time value
my $inspect := $ast;
while nqp::istype($inspect, QAST::Op) {
$inspect := $inspect[0];
}
if nqp::istype($inspect, QAST::WVal) {
$/.CURSOR.panic($mkerr());
}
else {
my $result;
$result := self.compile_time_evaluate($/, $ast);
# if we have something here, it's probably a Slip,
# which stringifies fine but has to be split at ','
# and potentially whitespace-corrected
$result := join(' ', nqp::split(',', ~$result));
while nqp::eqat($result, " ", 2) {
$result := nqp::replace($result, 2, nqp::chars($result) - 2, nqp::substr($result, 3));
}
if nqp::chars($result) > 3 {
# there's no foofix that allows more than two parts
$/.CURSOR.panic($mkerr());
}
return $result;
CATCH {
$/.CURSOR.panic($mkerr());
}
}
}
} elsif nqp::istype($ast, QAST::Var) {
my $result;
Expand Down

0 comments on commit 6f65c36

Please sign in to comment.