Skip to content

Commit

Permalink
Add file/line + cleanup to "use trace" output
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed May 23, 2015
1 parent 2a81b40 commit 7261d4b
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/Perl6/Actions.nqp
Expand Up @@ -862,14 +862,20 @@ Compilation unit '$file' contained the following violations:
if $past {
my $id := $*STATEMENT_ID;
if %*PRAGMAS<trace> {
$past := QAST::Stmts.new(:node($/),
QAST::Op.new(
:op<sayfh>,
QAST::Op.new(:op<getstderr>),
QAST::SVal.new(:value( $id ~ ": " ~ $/))
),
$past
);
my $code := ~$/;
if $code ne 'use trace' {
my $line := $*W.current_line($/);
my $file := $*W.current_file;
$code := subst($code, /\s+$/, ''); # chomp!
$past := QAST::Stmts.new(:node($/),
QAST::Op.new(
:op<sayfh>,
QAST::Op.new(:op<getstderr>),
QAST::SVal.new(:value("$id ($file:$line)\n$code"))
),
$past
);
}
}
$past.annotate('statement_id', $id);
}
Expand Down Expand Up @@ -1919,8 +1925,7 @@ Compilation unit '$file' contained the following violations:
);
}
if $past.name() eq '$?LINE' {
$past := $*W.add_constant('Int', 'int',
HLL::Compiler.lineof($/.orig, $/.from, :cache(1)));
$past := $*W.add_constant('Int', 'int', $*W.current_line($/));
}
else {
$past := $*W.add_string_constant($*W.current_file);
Expand Down Expand Up @@ -4662,7 +4667,7 @@ Compilation unit '$file' contained the following violations:

# using nqp::op outside of setting
if $*SETTING && !%*PRAGMAS<nqp> {
my $line := HLL::Compiler.lineof($/.orig, $/.from, :cache(1));
my $line := $*W.current_line($/);
@*NQP_VIOLATIONS[$line] := @*NQP_VIOLATIONS[$line] // [];
@*NQP_VIOLATIONS[$line].push($op);
}
Expand Down

0 comments on commit 7261d4b

Please sign in to comment.