Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Trim trailing whitespace from Regex source
  • Loading branch information
hoelzro committed Jul 10, 2015
1 parent bd0401b commit 26bc4d5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Perl6/Actions.nqp
Expand Up @@ -3519,8 +3519,14 @@ Compilation unit '$file' contained the following violations:
install_method($/, $name, $scope, $code, $outer) if $name ne '';

# Bind original source to $!source
my $Regex := $*W.find_symbol(['Regex']);
nqp::bindattr($code, $Regex, '$!source', ($*METHODTYPE ?? $*METHODTYPE ~ ' ' !! '') ~ $/);
my $Regex := $*W.find_symbol(['Regex']);
my $source := ($*METHODTYPE ?? $*METHODTYPE ~ ' ' !! '') ~ $/;
my $match := $source ~~ /\s+$/;

if $match {
$source := nqp::substr($source, 0, $match.from());
}
nqp::bindattr($code, $Regex, '$!source', $source);

# Return a reference to the code object
reference_to_code_object($code, $past);
Expand Down

0 comments on commit 26bc4d5

Please sign in to comment.