Skip to content

Commit

Permalink
Remove nqp deprecation
Browse files Browse the repository at this point in the history
MUST now specify "use nqp" in scope to be allowed to use nqp:: functions
  • Loading branch information
lizmat committed Dec 17, 2015
1 parent 6b5e9f5 commit 6b1b3ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 37 deletions.
38 changes: 1 addition & 37 deletions src/Perl6/Actions.nqp
Expand Up @@ -660,40 +660,6 @@ class Perl6::Actions is HLL::Actions does STDActions {
$compunit.annotate('UNIT', $unit);
$compunit.annotate('GLOBALish', $*GLOBALish);
$compunit.annotate('W', $*W);

my @violations := @*NQP_VIOLATIONS;
if @violations &&
!+nqp::ifnull(nqp::atkey(nqp::getenvhash,'RAKUDO_NO_DEPRECATIONS'),0) {

my $file := nqp::getlexdyn('$?FILES');
my $bar := nqp::gethostname() eq 'ns1'
?? ""
!! '===============================================================================
';
my $text := $bar ~ "The use of nqp::operations has been deprecated for non-CORE code. Please
change your code to not use these non-portable functions. If you really want
to keep using nqp::operations in your Perl6 code, you must add a:
use nqp;
to the outer scope of any code that uses nqp::operations.
Compilation unit '$file' contained the following violations:
";

my $line := -1;
my $lines := nqp::elems(@violations);
while ++$line < $lines {
my @ops := @violations[$line];
next unless nqp::isconcrete(@ops);

my $oplist := nqp::join(' nqp::',@ops);
$text := $text
~ " Line $line:\n"
~ " nqp::$oplist\n";
}
nqp::printfh(nqp::getstderr(),$text ~ $bar);
}
make $compunit;
}

Expand Down Expand Up @@ -5494,9 +5460,7 @@ Compilation unit '$file' contained the following violations:

# using nqp::op outside of setting
unless %*PRAGMAS<nqp> || $*COMPILING_CORE_SETTING {
my $line := $*W.current_line($/);
@*NQP_VIOLATIONS[$line] := @*NQP_VIOLATIONS[$line] // [];
@*NQP_VIOLATIONS[$line].push($op);
$/.CURSOR.typed_panic('X::NQP::NotFound', op => $op);
}

my $past := QAST::Op.new( :$op, |@args );
Expand Down
6 changes: 6 additions & 0 deletions src/core/Exception.pm
Expand Up @@ -110,6 +110,12 @@ my class X::AdHoc is Exception {
}
}

my class X::NQP::NotFound is Exception {
has $.op;
method message() {
"Could not find nqp::$.op, did you forget 'use nqp;' ?"
}
}
my class X::Dynamic::NotFound is Exception {
has $.name;
method message() {
Expand Down

0 comments on commit 6b1b3ef

Please sign in to comment.