示例#1
0
 public Constant(LObject constant)
 {
     if (constant is LNil)
     {
         m_type   = 0;
         m_bool   = false;
         m_number = null;
         m_string = null;
     }
     else if (constant is LBoolean)
     {
         m_type   = 1;
         m_bool   = (constant == LBoolean.LTRUE);
         m_number = null;
         m_string = null;
     }
     else if (constant is LNumber)
     {
         m_type   = 2;
         m_bool   = false;
         m_number = (LNumber)constant;
         m_string = null;
     }
     else if (constant is LString)
     {
         m_type   = 3;
         m_bool   = false;
         m_number = null;
         m_string = ((LString)constant).DeRef();
     }
     else
     {
         throw new ArgumentException("Illegal constant type: " + constant.ToString());
     }
 }
示例#2
0
 public Constant(int constant)
 {
     m_type   = 2;
     m_bool   = false;
     m_number = LNumber.MakeInteger(constant);
     m_string = null;
 }