Skip to content

Commit

Permalink
[dotnet] Implement viviself for PAST::Var scope attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Nov 27, 2010
1 parent f1d5648 commit 40db931
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dotnet/compiler/PAST2DNSTCompiler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,19 @@ our multi sub dnst_for(PAST::Var $var) {
if $*BIND_CONTEXT {
$lookup.push($*BIND_VALUE);
}
elsif pir::defined($var.viviself) {
# May need to auto-vivify.
my $viv_name := get_unique_id('viv_attr_');
my $temp := DNST::Temp.new( :name($viv_name), :type('RakudoObject'), $lookup );
$lookup := DNST::Stmts.new(
$temp,
DNST::If.new( :bool(1),
eq(DNST::Local.new( :name($viv_name) ), DNST::Literal.new( :value('null') )),
dnst_for($var.viviself),
DNST::Local.new( :name($viv_name) )
)
);
}
return $lookup;
}
elsif $scope eq 'keyed_int' {
Expand Down

0 comments on commit 40db931

Please sign in to comment.