Skip to content

Commit

Permalink
Add $*INSIDE-EVAL dynamic variable
Browse files Browse the repository at this point in the history
So that code can figure out it is running inside an EVAL.  Which can
be useful when e.g. determining whether a MAIN should be run or not.
Not sure whether this should be considered public or not.
  • Loading branch information
lizmat committed Oct 11, 2018
1 parent 8cc3d5d commit 73b7c60
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/core/ForeignCode.pm6
Expand Up @@ -52,6 +52,7 @@ proto sub EVAL($code is copy where Blob|Cool|Callable, Str() :$lang = 'perl6', P
# currently compiling compilation unit

my $LANG := $context<%?LANG> || CALLERS::<%?LANG>;
my $*INSIDE-EVAL = 1;
my $compiled := $compiler.compile:
$code,
:outer_ctx($eval_ctx),
Expand Down

0 comments on commit 73b7c60

Please sign in to comment.