Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Generalize a World.DEPRECATED method, and use it
  • Loading branch information
lizmat committed May 19, 2015
1 parent a6e5e93 commit 56e4733
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/Perl6/World.nqp
Expand Up @@ -714,15 +714,9 @@ class Perl6::World is HLL::World {
%*PRAGMAS<soft> := $on;
}
elsif $name eq 'MONKEY_TYPING' {
my $DEPRECATED := self.find_symbol(['&DEPRECATED']);
unless nqp::isnull($DEPRECATED) {
$DEPRECATED(
'use MONKEY-TYPING', '2015.04', '2015.09',
:what('use MONKEY_TYPING'),
:file(self.current_file),
:line(HLL::Compiler.lineof($/.orig, $/.from, :cache(1))),
);
}
self.DEPRECATED($/,"'use MONKEY-TYPING'",'2015.04','2015.09',
:what("'use MONKEY_TYPING'"),
);
if $arglist { self.throw($/, 'X::Pragma::NoArgs', :$name) }
%*PRAGMAS<MONKEY-TYPING> := $on;
}
Expand All @@ -735,6 +729,17 @@ class Perl6::World is HLL::World {
1;
}

method DEPRECATED($/,$alternative,$from,$removed,:$what) {
my $DEPRECATED := self.find_symbol(['&DEPRECATED']);
unless nqp::isnull($DEPRECATED) {
$DEPRECATED($alternative,$from,$removed,
:$what,
:file(self.current_file),
:line(HLL::Compiler.lineof($/.orig, $/.from, :cache(1))),
);
}
}

method current_file() {
my $file := nqp::getlexdyn('$?FILES');
if nqp::isnull($file) {
Expand Down

0 comments on commit 56e4733

Please sign in to comment.