private TypeInfo getTypeInfo(AsmType type)
        {
            switch (type.getSort())
            {
            case AsmType.ARRAY:
                var elt = getTypeInfo(type.getElementType());
                for (int i = type.getDimensions(); i > 0; --i)
                {
                    elt = elt.ArrayType;
                }
                return(elt);

            case AsmType.BOOLEAN:
                return(this.Library.BooleanType);

            case AsmType.BYTE:
                return(this.Library.ByteType);

            case AsmType.CHAR:
                return(this.Library.CharType);

            case AsmType.DOUBLE:
                return(this.Library.DoubleType);

            case AsmType.FLOAT:
                return(this.Library.FloatType);

            case AsmType.INT:
                return(this.Library.IntType);

            case AsmType.LONG:
                return(this.Library.LongType);

            case AsmType.SHORT:
                return(this.Library.ShortType);

            case AsmType.VOID:
                return(this.Library.VoidType);

            default:
                var result = typeSystem.getType(type.getInternalName());
                if (hasGenericArguments(result))
                {
                    result = result.RawType;
                }
                return(result);
            }
        }
        private TypeInfo getTypeInfo(AsmType type) {
            switch (type.getSort()) {
            case AsmType.ARRAY:
                var elt = getTypeInfo(type.getElementType());
                for (int i = type.getDimensions(); i > 0; --i) {
                    elt = elt.ArrayType;
                }
                return elt;
                
            case AsmType.BOOLEAN:
                return this.Library.BooleanType;
                
            case AsmType.BYTE:
                return this.Library.ByteType;

            case AsmType.CHAR:
                return this.Library.CharType;
                
            case AsmType.DOUBLE:
                return this.Library.DoubleType;
                
            case AsmType.FLOAT:
                return this.Library.FloatType;
                
            case AsmType.INT:
                return this.Library.IntType;
                
            case AsmType.LONG:
                return this.Library.LongType;
                
            case AsmType.SHORT:
                return this.Library.ShortType;
                
            case AsmType.VOID:
                return this.Library.VoidType;

            default:
                var result = typeSystem.getType(type.getInternalName());
				if (hasGenericArguments(result)) {
					result = result.RawType;
				}
                return result;
            }
        }
Beispiel #3
0
 internal virtual Item newConstItem(Object cst)
 {
     if (cst is int)
     {
         int val = (int)cst;
         return(newInteger(val));
     }
     else if (cst is byte)
     {
         int val = (byte)cst;
         return(newInteger(val));
     }
     else if (cst is char)
     {
         int val = (char)cst;
         return(newInteger(val));
     }
     else if (cst is short)
     {
         int val = (short)cst;
         return(newInteger(val));
     }
     else if (cst is bool)
     {
         int val = (bool)cst ? 1 : 0;
         return(newInteger(val));
     }
     else if (cst is float)
     {
         float val = (float)cst;
         return(newFloat(val));
     }
     else if (cst is long)
     {
         long val = (long)cst;
         return(newLong(val));
     }
     else if (cst is double)
     {
         double val = (double)cst;
         return(newDouble(val));
     }
     else if (cst is String)
     {
         return(newString((String)cst));
     }
     else if (cst is Type)
     {
         Type t = (Type)cst;
         int  s = t.getSort();
         if (s == Type.OBJECT)
         {
             return(newClassItem(t.getInternalName()));
         }
         else if (s == Type.METHOD)
         {
             return(newMethodTypeItem(t.getDescriptor()));
         }
         else
         {
             return(newClassItem(t.getDescriptor()));
         }
     }
     else if (cst is Handle)
     {
         Handle h = (Handle)cst;
         return(newHandleItem(h.tag, h.owner, h.name, h.desc, h.itf));
     }
     else
     {
         throw new IllegalArgumentException("value " + cst);
     }
 }