Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
always do the dedenting at compile-time
  • Loading branch information
timo committed Jul 11, 2013
1 parent 7157e1e commit 3f1c71d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Perl6/Actions.nqp
Expand Up @@ -30,18 +30,17 @@ role STDActions {
sub descend($node) {
if nqp::istype($node, QAST::Want) {
if +@($node) == 3 && $node[1] eq "Ss" {
my $strval := nqp::unbox_s($node[0].compile_time_value);
my $strval := $node[0].compile_time_value;
if !$in-fresh-line {
if $strval ~~ /\n/ {
$strval := nqp::box_s(nqp::x(" ", -$indent) ~ $strval, $*W.find_symbol(["Str"]));
my $strbox := nqp::box_s(nqp::x(" ", -$indent) ~ nqp::unbox_s($strval), $*W.find_symbol(["Str"]));
$strval := nqp::unbox_s($strbox.indent($indent));
$in-fresh-line := 1;
return $*W.add_string_constant($strval);
}
}
if $in-fresh-line {
return QAST::Op.new(
:op('callmethod'), :name('indent'),
$*W.add_string_constant($strval),
QAST::IVal.new( :value($indent) ));
} else {
$strval := nqp::unbox_s($strval.indent($indent));
return $*W.add_string_constant($strval);
}
}
} elsif nqp::istype($node, QAST::Op) && $node.op eq 'call' && $node.name eq '&infix:<~>' {
Expand Down

0 comments on commit 3f1c71d

Please sign in to comment.