Skip to content

Commit

Permalink
[dotnet] Fix code-gen; don't use spurious $*LAST_TEMP values when we …
Browse files Browse the repository at this point in the history
…have empty if/else branches. Deals with the 03-if-else.t issues spotted by mberends++.
  • Loading branch information
jnthn committed Oct 28, 2010
1 parent 4af6edd commit 08272ff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dotnet/compiler/DNST2CSharp.pm
Expand Up @@ -200,10 +200,12 @@ our multi sub cs_for(DNST::If $if) {
" if ($*LAST_TEMP != 0) \{\n";

# Compile branch(es).
$*LAST_TEMP := 'null';
$code := $code ~ cs_for((@($if))[1]);
$code := $code ~ " $if_result = $*LAST_TEMP;\n" ~
" }\n";
if +@($if) == 3 {
$*LAST_TEMP := 'null';
$code := $code ~ " else \{\n";
$code := $code ~ cs_for((@($if))[2]);
$code := $code ~ " $if_result = $*LAST_TEMP;\n" ~
Expand Down

0 comments on commit 08272ff

Please sign in to comment.