Skip to content

Commit

Permalink
Merge pull request #893 from drgrice1/warning-line-numbers
Browse files Browse the repository at this point in the history
Fix line numbers in warnings from problems and macros.
  • Loading branch information
pstaabp authored Aug 3, 2023
2 parents c1003fe + 19f9549 commit 0429231
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/WeBWorK/PG/Translator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ sub translate {
# PG preprocessing code
$evalString =
'BEGIN { my $eval = __FILE__; $main::envir{__files__}{$eval} = "'
. $self->{envir}{probFileName} . '" };' . "\n"
. $self->{envir}{probFileName} . '" };'
. &{ $self->{preprocess_code} }($evalString);

my ($PG_PROBLEM_TEXT_REF, $PG_HEADER_TEXT_REF, $PG_POST_HEADER_TEXT_REF, $PG_ANSWER_HASH_REF, $PG_FLAGS_REF,
Expand Down Expand Up @@ -1243,7 +1243,7 @@ sub PG_restricted_eval_helper {
# Many macros redefine methods using PG_restricted_eval. This hides those warnings.
no warnings 'redefine';

return eval("package main;\n$code");
return eval("package main; $code");
}

sub PG_macro_file_eval {
Expand All @@ -1258,7 +1258,7 @@ sub PG_macro_file_eval {
my ($out, $errors) =
PG_macro_file_eval_helper('package main; be_strict();'
. 'BEGIN { my $eval = __FILE__; $main::envir{__files__}{$eval} = "'
. $filePath . '" };' . "\n"
. $filePath . '" };'
. $string);

if ($warnings) {
Expand Down

0 comments on commit 0429231

Please sign in to comment.