Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[dotnet] Eliminate DNST::Temp usage completely from PAST2DNST.
  • Loading branch information
jnthn committed Dec 4, 2010
1 parent a5467eb commit 45d5376
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions dotnet/compiler/PAST2DNSTCompiler.pm
Expand Up @@ -1180,17 +1180,17 @@ our multi sub dnst_for(PAST::Regex $r, :$rtype) {
$stmts.push(DNST::Bind.new($*re_jt.register, lit('0')));

# cursor register
my $re_cur_tmp := DNST::Temp.new(
:name(get_unique_id('re_cur')), :type('RakudoObject'),
my $re_cur_tmp := DNST::Local.new(
:name(get_unique_id('re_cur')), :isdecl(1), :type('RakudoObject'),
dnst_for(PAST::Var.new( :name('self'), :scope('lexical')))
);
my $*re_cur := DNST::Local.new( :name($re_cur_tmp.name) );
my $*re_cur_name := $re_cur_tmp.name;
$stmts.push($re_cur_tmp);

# cursor self register
my $re_cur_self_tmp := DNST::Temp.new(
:name(get_unique_id('re_cur_self')), :type('RakudoObject'),
my $re_cur_self_tmp := DNST::Local.new(
:name(get_unique_id('re_cur_self')), :isdecl(1), :type('RakudoObject'),
lit($*re_cur_name)
);
my $*re_cur_self := DNST::Local.new( :name($re_cur_self_tmp.name) );
Expand Down Expand Up @@ -1812,13 +1812,13 @@ sub not($operand) {
sub log_and($l, $r) {
my $temp;
DNST::Stmts.new(
($temp := DNST::Temp.new(
:name(get_unique_id('log_and')), :type('bool'), lit('false')
($temp := DNST::Local.new(
:name(get_unique_id('log_and')), :isdecl(1), :type('bool'), lit('false')
)),
if_then(DNST::Temp.new(
:name(get_unique_id('left_bool')), :type('bool'), dnst_for($l)
), if_then(DNST::Temp.new(
:name(get_unique_id('right_bool')), :type('bool'), dnst_for($r)
if_then(DNST::Local.new(
:name(get_unique_id('left_bool')), :isdecl(1), :type('bool'), dnst_for($l)
), if_then(DNST::Local.new(
:name(get_unique_id('right_bool')), :isdecl(1), :type('bool'), dnst_for($r)
), DNST::Bind.new(
### XXX The next line works only with the C# backend (so far)
### b/c the Bind causes the Temp to be redeclared without the lit(___.name)
Expand All @@ -1830,15 +1830,15 @@ sub log_and($l, $r) {
sub log_or($l, $r) {
my $temp;
DNST::Stmts.new(
($temp := DNST::Temp.new(
:name(get_unique_id('log_or')), :type('bool'), lit('false')
($temp := DNST::Local.new(
:name(get_unique_id('log_or')), :isdecl(1), :type('bool'), lit('false')
)),
if_then(DNST::Temp.new(
:name(get_unique_id('left_bool')), :type('bool'), dnst_for($l)
if_then(DNST::Local.new(
:name(get_unique_id('left_bool')), :isdecl(1), :type('bool'), dnst_for($l)
),
DNST::Bind.new(lit($temp.name), lit('true')),
if_then(DNST::Temp.new(
:name(get_unique_id('right_bool')), :type('bool'), dnst_for($r)
if_then(DNST::Local.new(
:name(get_unique_id('right_bool')), :isdecl(1), :type('bool'), dnst_for($r)
),
DNST::Bind.new(lit($temp.name), lit('true')),
)));
Expand Down Expand Up @@ -1927,9 +1927,10 @@ sub emit_call($on, $name, $type, *@args) {
sub returns_array($expr, *@result_slots) {
my $tmp;
my $stmts := DNST::Stmts.new(
$tmp := DNST::Temp.new(
$tmp := DNST::Local.new(
:type('RakudoObject'),
:name(get_unique_id('array_result')),
:isdecl(1),
$expr
)
);
Expand Down

0 comments on commit 45d5376

Please sign in to comment.