Exemplo n.º 1
0
 /// <summary>
 /// Equivalent to <code>luaK_exp2val</code>. </summary>
 internal void kExp2val(Expdesc e)
 {
     if (e.hasjumps())
     {
         kExp2anyreg(e);
     }
     else
     {
         kDischargevars(e);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Equivalent to luaK_exp2anyreg. </summary>
 internal int kExp2anyreg(Expdesc e)
 {
     kDischargevars(e);
     if (e.k == Expdesc.VNONRELOC)
     {
         if (!e.hasjumps())
         {
             return(e.info_Renamed);
         }
         if (e.info_Renamed >= nactvar)   // reg is not a local?
         {
             exp2reg(e, e.info_Renamed);  // put value on it
             return(e.info_Renamed);
         }
     }
     kExp2nextreg(e);     // default
     return(e.info_Renamed);
 }
Exemplo n.º 3
0
 private void exp2reg(Expdesc e, int reg)
 {
     discharge2reg(e, reg);
     if (e.k == Expdesc.VJMP)
     {
         e.t = kConcat(e.t, e.info_Renamed);   // put this jump in `t' list
     }
     if (e.hasjumps())
     {
         int p_f = NO_JUMP;   // position of an eventual LOAD false
         int p_t = NO_JUMP;   // position of an eventual LOAD true
         if (need_value(e.t) || need_value(e.f))
         {
             int fj = (e.k == Expdesc.VJMP) ? NO_JUMP : kJump();
             p_f = code_label(reg, 0, 1);
             p_t = code_label(reg, 1, 0);
             kPatchtohere(fj);
         }
         int finalpos = kGetlabel();   // position after whole expression
         patchlistaux(e.f, finalpos, reg, p_f);
         patchlistaux(e.t, finalpos, reg, p_t);
     }
     e.init(Expdesc.VNONRELOC, reg);
 }