Skip to content

Commit

Permalink
Revive Devel::Trace as "trace"
Browse files Browse the repository at this point in the history
While cleaning up, I found some leftover Devel::Trace functionality that
seemed useful to reinstate now that we have lexical pragma's.
  • Loading branch information
lizmat committed May 23, 2015
1 parent 2e63ee4 commit d630193
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/Perl6/Actions.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ role STDActions {
class Perl6::Actions is HLL::Actions does STDActions {
our @MAX_PERL_VERSION;

our $STATEMENT_PRINT;

# Could add to this based on signatures.
our %commatrap := nqp::hash(
'&categorize', 1,
Expand All @@ -142,8 +140,6 @@ class Perl6::Actions is HLL::Actions does STDActions {
# If, e.g., we support Perl up to v6.1.2, set
# @MAX_PERL_VERSION to [6, 1, 2].
@MAX_PERL_VERSION[0] := 6;

$STATEMENT_PRINT := 0;
}

sub sink($past) {
Expand Down Expand Up @@ -862,16 +858,21 @@ Compilation unit '$file' contained the following violations:
elsif $<statement> { $past := $<statement>.ast; }
elsif $<statement_control> { $past := $<statement_control>.ast; }
else { $past := 0; }
if $STATEMENT_PRINT && $past {
$past := QAST::Stmts.new(:node($/),
QAST::Op.new(
:op<say>,
QAST::SVal.new(:value(~$/))
),
$past
);

if $past {
my $id := $*STATEMENT_ID;
if %*PRAGMAS<trace> {
$past := QAST::Stmts.new(:node($/),
QAST::Op.new(
:op<say>,
QAST::SVal.new(:value( $id ~ ": " ~ $/))
),
$past
);
}
$past.annotate('statement_id', $id);
}
$past.annotate('statement_id', $*STATEMENT_ID) if $past;

make $past;
}

Expand Down Expand Up @@ -1267,10 +1268,6 @@ Compilation unit '$file' contained the following violations:
# $/.CURSOR.panic("Perl $<version> required--this is only v$mpv")
# }
# }
} elsif $<module_name> {
if ~$<module_name> eq 'Devel::Trace' {
$STATEMENT_PRINT := 1;
}
}
make $past;
}
Expand Down
3 changes: 3 additions & 0 deletions src/Perl6/World.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,9 @@ class Perl6::World is HLL::World {
# argument list really.
%*PRAGMAS<soft> := $on;
}
elsif $name eq 'trace' {
%*PRAGMAS<trace> := $on;
}
elsif $name eq 'MONKEY_TYPING' {
self.DEPRECATED($/,"'use MONKEY-TYPING'",'2015.04','2015.09',
:what("'use MONKEY_TYPING'"),
Expand Down

0 comments on commit d630193

Please sign in to comment.