Skip to content

Commit 03189be

Browse files
committed
ParseXS: refactor: INPUT_line::parse(): remove var
This is #6 of a small series of commits to refactor INPUT keyword handling. There's no need any more to save the original line in $orig_line, as $self->{line} now holds that value. Also, wrap ... or blurt(...), return; in a do block for clarity:
1 parent 5bc73a0 commit 03189be

File tree

1 file changed

+4
-2
lines changed
  • dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS

1 file changed

+4
-2
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,6 @@ sub parse {
23122312
return unless $line =~ /\S/; # skip blank lines
23132313

23142314
ExtUtils::ParseXS::Utilities::trim_whitespace($line);
2315-
my $orig_line = $line; # keep original line for error messages
23162315

23172316
# remove any trailing semicolon, except for initialisations
23182317
$line =~ s/\s*;$//g unless $line =~ /[=;+].*\S/;
@@ -2351,7 +2350,10 @@ sub parse {
23512350
(\w+ | length\(\w+\)) # name or length(name)
23522351
$
23532352
/xs
2354-
or $pxs->blurt("Error: invalid parameter declaration '$orig_line'"), return;
2353+
or do {
2354+
$pxs->blurt("Error: invalid parameter declaration '$self->{line}'");
2355+
return;
2356+
};
23552357

23562358
# length(s) is only allowed in the XSUB's signature.
23572359
if ($var_name =~ /^length\((\w+)\)$/) {

0 commit comments

Comments
 (0)