示例#1
0
        private TypeCode GetTypeCodeImpl()
        {
            switch (this.Name)
            {
            case "bool":
            case "boolean": return(TypeCode.Boolean);

            case "number": return(TypeCode.Double);

            case "i8": return(TypeCode.SByte);

            case "i16": return(TypeCode.Int16);

            case "i32": return(TypeCode.Int32);

            case "i64": return(TypeCode.Int64);

            case "u8": return(TypeCode.Byte);

            case "u16": return(TypeCode.UInt16);

            case "u32": return(TypeCode.UInt32);

            case "u64": return(TypeCode.UInt64);

            case "f32": return(TypeCode.Single);

            case "f64": return(TypeCode.Double);

            case "str": return(TypeCode.String);

            case "string": return(TypeCode.String);

            case "object":
            case "any": return(TypeCode.Any);

            case "datetime": return(TypeCode.Date);
            }
            if (this != UnderlyingSystemType && UnderlyingSystemType != null)
            {
                return(XzaarType.GetTypeCode(UnderlyingSystemType));
            }
            return(TypeCode.Any);
        }
示例#2
0
 public void AddField(XzaarType type, string name)
 {
     this.fields.Add(new XzaarFieldBuilder(name, type, this));
 }
示例#3
0
 public XzaarTypeBuilder(string name, XzaarType declaringType, XzaarType underlyingSystemType, XzaarType baseType, XzaarType elementType = null)
 {
     Name                 = name;
     MemberType           = XzaarMemberTypes.TypeInfo;
     DeclaringType        = declaringType;
     UnderlyingSystemType = underlyingSystemType;
     BaseType             = baseType;
     if (elementType != null)
     {
         isArray          = true;
         arrayElementType = elementType;
     }
 }
示例#4
0
        public static bool TryGetType(string typeName, StructExpression typeExpression, out XzaarType newType)
        {
            var a = GetType(typeName);

            if (a == null || Equals(a, XzaarBaseTypes.Void) || Equals(a, XzaarBaseTypes.Any))
            {
                newType = XzaarBaseTypes.CreateTypeFromStructExpression(typeExpression);
                XzaarBaseTypes.AddTypeToCache(newType);
            }
            else
            {
                newType = a;
            }
            return(true);
        }
示例#5
0
 public bool IsEquivalentTo(XzaarType other)
 {
     return(this == other);
 }
示例#6
0
 public XzaarFieldBuilder(string name, XzaarType fieldType, XzaarType declaringType)
 {
     this.name          = name;
     this.fieldType     = fieldType;
     this.declaringType = declaringType;
 }
示例#7
0
 internal static void AddTypeToCache(XzaarType type)
 {
     BaseTypes.Add(type);
 }
示例#8
0
 public XzaarParameterInfo(string name, XzaarType parameterType, object defautlValue)
 {
     Name          = name;
     ParameterType = parameterType;
     DefautlValue  = defautlValue;
 }