Skip to content

Commit

Permalink
[js] Hacks to allow more code to run with a partial setting which has…
Browse files Browse the repository at this point in the history
… nqp::null() being passed around.
  • Loading branch information
pmurias committed Apr 28, 2016
1 parent 293a3bd commit cf606ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Perl6/Optimizer.nqp
Expand Up @@ -614,6 +614,9 @@ my class BlockVarOptimizer {
}

method lexical_vars_to_locals($block) {
#if js
return 0;
#endif
return 0 if $!poisoned || $!uses_bindsig;
return 0 unless nqp::istype($block[0], QAST::Stmts);
for %!decls {
Expand Down
9 changes: 7 additions & 2 deletions src/Perl6/World.nqp
Expand Up @@ -2481,8 +2481,13 @@ class Perl6::World is HLL::World {
# Adds the result of a constant folding operation to the SC and
# returns a reference to it.
method add_constant_folded_result($r) {
self.add_object_if_no_sc($r);
QAST::WVal.new( :value($r) )
if nqp::isnull($r) {
QAST::Op.new( :op<null> )
}
else {
self.add_object_if_no_sc($r);
QAST::WVal.new( :value($r) )
}
}

# Takes a data structure of non-Perl 6 objects and wraps them up
Expand Down

0 comments on commit cf606ff

Please sign in to comment.