Changeset 22943 for v6

Show
Ignore:
Timestamp:
11/09/08 21:55:00 (2 months ago)
Author:
pmurias
Message:

[mildew] if works

Location:
v6
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • v6/mildew/mildew

    r22933 r22943  
    325325        my $stm = $m->{statement_control}; 
    326326        if ($stm->{sym} eq 'if') { 
     327            my $then = AST::Call->new(identifier=>string 'postcircumfix:( )',capture => AST::Capture->new( 
     328                invocant => AST::Call->new(identifier=>string 'new', 
     329                    capture => AST::Capture->new( 
     330                        invocant => FETCH(lookup('Code')), 
     331                        positional => [], 
     332                        named => [ 
     333                            string 'mold' => $stm->{xblock}{pblock}{block}->emit_m0ld, 
     334                            string 'outer' => reg '$scope' 
     335                    ]) 
     336                ), 
     337                positional => [AST::Call->new( 
     338                    identifier => string "capturize", 
     339                    capture => AST::Capture->new( 
     340                        invocant => reg '¢SMOP__S1P__Capturize', 
     341                        positional => [] 
     342                    ) 
     343                )] 
     344            )); 
    327345            AST::If->new( 
    328                          cond => $stm->{xblock}{EXPR}->emit_m0ld, 
    329                          then => $stm->{xblock}{pblock}{block}->emit_m0ld 
    330                         ); 
     346                cond => $stm->{xblock}{EXPR}->emit_m0ld, 
     347                then => $then 
     348            ); 
    331349        } else { 
    332350            XXX('unkown sym in statement_control') 
  • v6/mildew/src/AST.pm

    r22936 r22943  
    5454    $cond.$/. 
    5555    'my '.$id_cond.'_val = '.$id_cond.'."FETCH"();'.$/. 
    56     'my '.$id_cond.'_bool = '.$id_cond.'_val."bool"();'.$/. 
     56    'my '.$id_cond.'_bool = '.$id_cond.'_val."true"();'.$/. 
    5757    'if '.$id_cond.'_bool { goto '.$label_then.' } else { goto '.$label_else.' };'.$/. 
    5858    $label_then.':'.$/. 
    5959    $then.$/. 
    6060    $label_else.': noop;'.$/; 
     61} 
     62sub pretty { 
     63    my ($self) = @_; 
     64    'if ' . $self->cond->pretty . " {\n" 
     65        . AST::indent($self->then->pretty) . "\n" 
     66    . "}\n" 
    6167} 
    6268 
  • v6/mildew/t/if.t

    r22860 r22943  
    11$OUT.print("1..1\n"); 
    2 if True { 
     2if 0 { 
     3    $OUT.print("not ok 1\n"); 
     4} 
     5if 1 { 
    36    $OUT.print("ok 1\n"); 
    47} 
  • v6/smop/src/native_int.ri

    r22940 r22943  
    2929%method defined 
    3030    ret = SMOP__NATIVE__bool_true; 
     31%method true 
     32    smop_lowlevel_wrlock(invocant); 
     33    ret = ((smop_native_int_struct*)invocant)->intvalue ? SMOP__NATIVE__bool_true : SMOP__NATIVE__bool_false; 
     34    smop_lowlevel_unlock(invocant); 
    3135%method FETCH 
    3236    ___VALUE_FETCH___;