Skip to content

Commit

Permalink
Simplify code-gen with QAST::Var changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed May 9, 2013
1 parent b6921f3 commit e36459c
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/NQP/World.nqp
Expand Up @@ -171,22 +171,12 @@ class NQP::World is HLL::World {
}

# Installs a lexical symbol. Takes a QAST::Block object, name and
# the object to install. Does an immediate installation in the
# compile-time block symbol table, and ensures that the installation
# gets fixed up at runtime too.
# the object to install.
method install_lexical_symbol($block, $name, $obj) {
# Install the object directly as a block symbol.
$block.symbol($name, :scope('lexical'), :value($obj));
$block[0].push(QAST::Var.new( :scope('lexical'), :name($name), :decl('var') ));

# Fixup and deserialization task is the same.
my $fixup := QAST::Op.new(
:op('setstaticlex'),
$block,
QAST::SVal.new( :value($name) ),
QAST::WVal.new( :value($obj) )
);
self.add_fixup_task(:deserialize_past($fixup), :fixup_past($fixup));
$block[0].push(QAST::Var.new(
:scope('lexical'), :name($name), :decl('static'), :value($obj)
));
}

# Adds a fixup to install a specified QAST::Block in a package under the
Expand Down

0 comments on commit e36459c

Please sign in to comment.