Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Cheapen dynamic compilation somewhat.
  • Loading branch information
jnthn committed Aug 1, 2014
1 parent 5f7eaa6 commit 4d347fd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Perl6/World.nqp
Expand Up @@ -1292,13 +1292,8 @@ class Perl6::World is HLL::World {
# Add symbol.
my %sym := $_.value;
my $value := nqp::existskey(%sym, 'value') ?? %sym<value> !! $mu;
try {
if nqp::isnull(nqp::getobjsc($value)) {
self.add_object($value);
}
CATCH {
$value := $mu;
}
if nqp::isnull(nqp::getobjsc($value)) {
$value := self.try_add_to_sc($value, $mu);
}
$wrapper[0].push(QAST::Var.new(
:name($_.key), :scope('lexical'),
Expand Down Expand Up @@ -1364,6 +1359,11 @@ class Perl6::World is HLL::World {
# asked to compile.
$result
}
method try_add_to_sc($value, $fallback) {
self.add_object($value);
CATCH { $value := $fallback; }
$value
}

# Adds a constant value to the constants table. Returns PAST to do
# the lookup of the constant.
Expand Down

0 comments on commit 4d347fd

Please sign in to comment.