public PropertyValueReference (EvaluationContext ctx, PropertyInfoMirror property, object obj, TypeMirror declaringType, Value[] indexerArgs): base (ctx)
		{
			this.property = property;
			this.obj = obj;
			this.declaringType = declaringType;
			this.indexerArgs = indexerArgs;
			flags = ObjectValueFlags.Property;
			if (property.GetSetMethod (true) == null)
				flags |= ObjectValueFlags.ReadOnly;
			MethodMirror getter = property.GetGetMethod (true);
			if (getter.IsStatic)
				flags |= ObjectValueFlags.Global;
			if (getter.IsPublic)
				flags |= ObjectValueFlags.Public;
			else if (getter.IsPrivate)
				flags |= ObjectValueFlags.Private;
			else if (getter.IsFamily)
				flags |= ObjectValueFlags.Protected;
			else if (getter.IsFamilyAndAssembly)
				flags |= ObjectValueFlags.Internal;
			else if (getter.IsFamilyOrAssembly)
				flags |= ObjectValueFlags.InternalProtected;
			if (property.DeclaringType.IsValueType)
				flags |= ObjectValueFlags.ReadOnly; // Setting property values on structs is not supported by sdb
		}
		internal static ObjectValueFlags GetFlags (PropertyInfoMirror property, MethodMirror getter)
		{
			var flags = ObjectValueFlags.Property;

			if (property.GetSetMethod (true) == null)
				flags |= ObjectValueFlags.ReadOnly;

			if (getter.IsStatic)
				flags |= ObjectValueFlags.Global;

			if (getter.IsPublic)
				flags |= ObjectValueFlags.Public;
			else if (getter.IsPrivate)
				flags |= ObjectValueFlags.Private;
			else if (getter.IsFamily)
				flags |= ObjectValueFlags.Protected;
			else if (getter.IsFamilyAndAssembly)
				flags |= ObjectValueFlags.Internal;
			else if (getter.IsFamilyOrAssembly)
				flags |= ObjectValueFlags.InternalProtected;

			if (property.DeclaringType.IsValueType)
				flags |= ObjectValueFlags.ReadOnly; // Setting property values on structs is not supported by sdb

			return flags;
		}
		public PropertyValueReference (EvaluationContext ctx, PropertyInfoMirror property, object obj, TypeMirror declaringType, MethodMirror getter, Value[] indexerArgs): base (ctx)
		{
			this.property = property;
			this.obj = obj;
			this.declaringType = declaringType;
			this.indexerArgs = indexerArgs;
			
			flags = GetFlags (property, getter);
		}
		public PropertyValueReference (EvaluationContext ctx, PropertyInfoMirror property, object obj, TypeMirror declaringType, MethodMirror getter, Value[] indexerArgs): base (ctx)
		{
			this.declaringType = declaringType;
			this.indexerArgs = indexerArgs;
			this.property = property;
			this.getter = getter;
			this.obj = obj;

			var objectMirror = obj as ObjectMirror;
			if (objectMirror != null)
				EnsureContextHasDomain (objectMirror.Domain);

			flags = GetFlags (property, getter);
		}
        public PropertyInfoMirror[] GetProperties(BindingFlags bindingAttr)
        {
            if (properties != null)
            {
                return(properties);
            }

            PropInfo[] info = vm.conn.Type_GetProperties(id);

            PropertyInfoMirror[] res = new PropertyInfoMirror [info.Length];
            for (int i = 0; i < res.Length; ++i)
            {
                res [i] = new PropertyInfoMirror(this, info [i].id, info [i].name, vm.GetMethod(info [i].get_method), vm.GetMethod(info [i].set_method), (PropertyAttributes)info [i].attrs);
            }

            properties = res;
            return(properties);
        }
Exemple #6
0
		public PropertyInfoMirror[] GetProperties (BindingFlags bindingAttr) {
			if (properties != null)
				return properties;

			PropInfo[] info = vm.conn.Type_GetProperties (id);

			PropertyInfoMirror[] res = new PropertyInfoMirror [info.Length];
			for (int i = 0; i < res.Length; ++i)
				res [i] = new PropertyInfoMirror (this, info [i].id, info [i].name, vm.GetMethod (info [i].get_method), vm.GetMethod (info [i].set_method), (PropertyAttributes)info [i].attrs);

			properties = res;
			return properties;
		}
 public static TypeMirror GetType(object parent, PropertyInfoMirror key)
 {
     return key.PropertyType;
 }
        public static void Set(ThreadMirror thread, VariableItem item, ObjectMirror parent, PropertyInfoMirror key, Value newValue)
        {
            Contract.Assert(key.HasSimpleGetter());		// indexors aren't shown...

            MethodMirror method = key.GetSetMethod(true);
            if (method != null)
            {
                Unused.Value = parent.InvokeMethod(thread, method, new Value[]{newValue}, InvokeOptions.DisableBreakpoints | InvokeOptions.SingleThreaded);
            }
            else
            {
                throw new Exception("Property does not have a setter.");
            }
        }
		internal CustomAttributeNamedArgumentMirror (PropertyInfoMirror prop, FieldInfoMirror field, CustomAttributeTypedArgumentMirror arg)
		{
			this.arg = arg;
			this.prop = prop;
			this.field = field;
		}
 internal CustomAttributeNamedArgumentMirror(PropertyInfoMirror prop, FieldInfoMirror field, CustomAttributeTypedArgumentMirror arg)
 {
     this.arg   = arg;
     this.prop  = prop;
     this.field = field;
 }