public override void Compile(ByteCode bc) { m_Exp1.Compile(bc); if (m_Operator == Operator.Or) { var i = bc.Emit_Jump(OpCode.JtOrPop, -1); m_Exp2.Compile(bc); i.NumVal = bc.GetJumpPointForNextInstruction(); return; } if (m_Operator == Operator.And) { var i = bc.Emit_Jump(OpCode.JfOrPop, -1); m_Exp2.Compile(bc); i.NumVal = bc.GetJumpPointForNextInstruction(); return; } if (m_Exp2 != null) { m_Exp2.Compile(bc); } bc.Emit_Operator(OperatorToOpCode(m_Operator)); if (ShouldInvertBoolean(m_Operator)) { bc.Emit_Operator(OpCode.Not); } }
public override void Compile(ByteCode bc) { m_Exp.Compile(bc); switch (m_OpText) { case "not": bc.Emit_Operator(OpCode.Not); break; case "#": bc.Emit_Operator(OpCode.Len); break; case "-": bc.Emit_Operator(OpCode.Neg); break; default: throw new InternalErrorException("Unexpected unary operator '{0}'", m_OpText); } }
public override void Compile(ByteCode bc) { m_Exp1.Compile(bc); m_Exp2.Compile(bc); bc.Emit_Operator(OpCode.Power); }