예제 #1
0
        public override VarType GetExprType()
        {
            VarType exprType = array.GetExprType();

            if (exprType.Equals(VarType.Vartype_Null))
            {
                return(hardType.Copy());
            }
            else
            {
                return(exprType.DecreaseArrayDim());
            }
        }
예제 #2
0
 private static VarType GuessType(int val, bool boolPermitted)
 {
     if (boolPermitted)
     {
         VarType constType = VarType.Vartype_Boolean;
         if (val != 0 && val != 1)
         {
             constType = constType.Copy(true);
         }
         return(constType);
     }
     else if (0 <= val && val <= 127)
     {
         return(VarType.Vartype_Bytechar);
     }
     else if (-128 <= val && val <= 127)
     {
         return(VarType.Vartype_Byte);
     }
     else if (0 <= val && val <= 32767)
     {
         return(VarType.Vartype_Shortchar);
     }
     else if (-32768 <= val && val <= 32767)
     {
         return(VarType.Vartype_Short);
     }
     else if (0 <= val && val <= unchecked ((int)(0xFFFF)))
     {
         return(VarType.Vartype_Char);
     }
     else
     {
         return(VarType.Vartype_Int);
     }
 }