Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Introduce "no worries" pragma
Worries (usually Perl 5 lookalike warnings) will not be emitted
when a "no worries" pragma is used in that lexical scope.

Inspired by discussion at
  http://irclog.perlgeek.de/perl6/2015-07-05#i_10852580

timotimo++ skids++ ShimmerFairy++ for inspiration
  • Loading branch information
lizmat committed Jul 6, 2015
1 parent e3d6b7d commit cf65f54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Perl6/Grammar.nqp
Expand Up @@ -236,7 +236,9 @@ role STD {
self
}
method typed_worry($type_str, *%opts) {
@*WORRIES.push($*W.typed_exception(self.MATCH(), nqp::split('::', $type_str), |%opts));
unless %*PRAGMAS<no-worries> {
@*WORRIES.push($*W.typed_exception(self.MATCH(), nqp::split('::', $type_str), |%opts));
}
self
}

Expand Down
4 changes: 4 additions & 0 deletions src/Perl6/World.nqp
Expand Up @@ -719,6 +719,10 @@ class Perl6::World is HLL::World {
if $arglist { self.throw($/, 'X::Pragma::NoArgs', :$name) }
%*PRAGMAS<internals> := $on;
}
elsif $name eq 'worries' {
if $arglist { self.throw($/, 'X::Pragma::NoArgs', :$name) }
%*PRAGMAS<no-worries> := !$on;
}
elsif $name eq 'soft' {
# This is an approximation; need to pay attention to
# argument list really.
Expand Down

0 comments on commit cf65f54

Please sign in to comment.