Exemplo n.º 1
0
        /*
         * Construct a normal object from the value, so accessing the cattr doesn't
         * require remoting calls.
         */
        static CustomAttributeTypedArgumentMirror CreateArg(VirtualMachine vm, ValueImpl vi)
        {
            object val;

            /* Instead of receiving a mirror of the Type object, we receive the id of the type */
            if (vi.Type == (ElementType)ValueTypeId.VALUE_TYPE_ID_TYPE)
            {
                val = vm.GetType(vi.Id);
            }
            else
            {
                Value v = vm.DecodeValue(vi);
                if (v is PrimitiveValue)
                {
                    val = (v as PrimitiveValue).Value;
                }
                else if (v is StringMirror)
                {
                    val = (v as StringMirror).Value;
                }
                else
                {
                    // FIXME:
                    val = v;
                }
            }
            return(new CustomAttributeTypedArgumentMirror(null, val));
        }