- Timestamp:
- 12/05/18 21:04:54 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/vm/framscript.y
r652 r836 872 872 } 873 873 874 874 | expr '?' 875 { 876 trctx.emitLine(); 877 // trctx.out->printf("\n####### conditional operator\n"); 878 $$.counter=trctx.labelcounter++; 879 warnTruthValue($1); 880 if ($1.constant) 881 { 882 ExtValue::CompareResult cond=$1.compare(ExtValue::zero()); 883 $1.counter=0; 884 if (resultIsRelaxedEqual(cond)) 885 trctx.out->printf("jump :_cond_false_%d\n",$$.counter); 886 } 887 else 888 { 889 trstack.adjust(+1); 890 trctx.out->printf("if ~=,m[m0++],:_cond_false_%d\n",$$.counter); 891 } 892 $$.stack=trstack.currentPos(); 893 // trctx.out->printf("\n####### conditional - true\n"); 894 } 895 stackexpr ':' 896 { 897 trctx.emitLine(); 898 trctx.out->printf("jump :_cond_end_%d\n",$3.counter); 899 trctx.out->printf(":_cond_false_%d\n",$3.counter); 900 // trctx.out->printf("\n####### conditional - false\n"); 901 trstack.adjust($3.stack-trstack.currentPos()); 902 } 903 stackexpr 904 { 905 trctx.emitLine(); 906 trctx.out->printf(":_cond_end_%d\n",$3.counter); 907 // trctx.out->printf("\n####### conditional - end\n"); 908 $$.ident=false; $$.constant=0; $$.parens=0; $$.assign=0; 909 } 910 875 911 | expr LSHIFT expr { handleTwoArg($$,$1,$3,LSHIFT,"shift",0,0); } 876 912 | expr RSHIFT expr { handleTwoArg($$,$1,$3,RSHIFT,"shift",1,0); }
Note: See TracChangeset
for help on using the changeset viewer.