Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
eval() is no more, long live EVAL()
  • Loading branch information
lizmat committed Jul 9, 2014
1 parent 31404a4 commit 3bd00dd
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/core/control.pm
Expand Up @@ -160,22 +160,10 @@ multi sub warn(*@msg) is hidden_from_backtrace {
0;
}

proto sub eval($, *%) {*} # is DEPRECATED doesn't work in settings
multi sub eval(Str $code, :$lang = 'perl6', PseudoStash :$context) {
DEPRECATED("'EVAL'");
my $eval_ctx := nqp::getattr(nqp::decont($context // CALLER::), PseudoStash, '$!ctx');
my $?FILES := 'eval_' ~ (state $no)++;
my $compiler := nqp::getcomp($lang);
X::Eval::NoSuchLang.new(:$lang).throw
if nqp::isnull($compiler);
my $compiled := $compiler.compile($code, :outer_ctx($eval_ctx), :global(GLOBAL));
nqp::forceouterctx(nqp::getattr($compiled, ForeignCode, '$!do'), $eval_ctx);
$compiled();
}
proto sub EVAL($, *%) {*}
multi sub EVAL(Str $code, :$lang = 'perl6', PseudoStash :$context) {
my $eval_ctx := nqp::getattr(nqp::decont($context // CALLER::), PseudoStash, '$!ctx');
my $?FILES := 'eval_' ~ (state $no)++;
my $?FILES := 'EVAL_' ~ (state $no)++;
my $compiler := nqp::getcomp($lang);
X::Eval::NoSuchLang.new(:$lang).throw
if nqp::isnull($compiler);
Expand All @@ -184,7 +172,6 @@ multi sub EVAL(Str $code, :$lang = 'perl6', PseudoStash :$context) {
$compiled();
}


sub exit($status = 0) {
$_() for nqp::hllize(nqp::getcurhllsym('@END_PHASERS'));
nqp::exit(nqp::unbox_i($status.Int));
Expand Down

0 comments on commit 3bd00dd

Please sign in to comment.