SHARE
TWEET

Untitled

a guest Jan 11th, 2017 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public Void Visit(IfStatement s, CompilerContext env)
  2.         {
  3.             s.condition.Accept(compileExpr, env);
  4.             var brfPosition = env.Allocate();
  5.  
  6.             s.consequent.Accept(this, env);
  7.  
  8.             var braPosition = env.Allocate();
  9.  
  10.             var elsePosition = env.Line();
  11.  
  12.             s.consequent.Accept(this, env);
  13.  
  14.             var fiPosition = env.Line();
  15.  
  16.             env.EmitAt(brfPosition, new Instruction(Instruction.OPCODE.BRF, elsePosition));
  17.             env.EmitAt(braPosition, new Instruction(Instruction.OPCODE.BRA, fiPosition));
  18.  
  19.             return Void.Instance;
  20.         }
RAW Paste Data
Top