Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DEPRECATE use MONKEY_TYPING
  • Loading branch information
lizmat committed May 19, 2015
1 parent 29a4089 commit c53b603
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/Perl6/World.nqp
Expand Up @@ -689,7 +689,7 @@ class Perl6::World is HLL::World {
$DEBUG("Attempting '$name' as a pragma") if $DEBUG;

# XXX maybe we need a hash with code to execute
if $name eq 'MONKEY-TYPING' || $name eq 'MONKEY_TYPING' {
if $name eq 'MONKEY-TYPING' {
if $arglist { self.throw($/, 'X::Pragma::NoArgs', :$name) }
%*PRAGMAS<MONKEY-TYPING> := $on;
}
Expand All @@ -713,6 +713,19 @@ class Perl6::World is HLL::World {
# argument list really.
%*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))),
);
}
if $arglist { self.throw($/, 'X::Pragma::NoArgs', :$name) }
%*PRAGMAS<MONKEY-TYPING> := $on;
}
else {
$DEBUG("'$name' is not a valid pragma") if $DEBUG;
return 0; # go try module
Expand All @@ -722,6 +735,17 @@ class Perl6::World is HLL::World {
1;
}

method current_file() {
my $file := nqp::getlexdyn('$?FILES');
if nqp::isnull($file) {
$file := '<unknown file>';
}
elsif !nqp::eqat($file,'/',0) && !nqp::eqat($file,'-',0) {
$file := nqp::cwd ~ '/' ~ $file;
}
$file;
}

method arglist($/) {
my $arglist;
if $<arglist><EXPR> -> $expr {
Expand Down

0 comments on commit c53b603

Please sign in to comment.