+ //
+ // We also perform the permission checking here, as the PropertyInfo does not
+ // hold the information for the accessibility of its setter/getter
+ //
+ void ResolveAccessors (EmitContext ec)
+ {
+ BindingFlags flags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;
+ MemberInfo [] group;
+
+ group = TypeManager.MemberLookup (ec.ContainerType, PropertyInfo.DeclaringType,
+ MemberTypes.Method, flags, "get_" + PropertyInfo.Name);
+
+ //
+ // The first method is the closest to us
+ //
+ if (group != null && group.Length > 0){
+ getter = (MethodInfo) group [0];
+
+ if (getter.IsStatic)
+ is_static = true;
+ }
+
+ //
+ // The first method is the closest to us
+ //
+ group = TypeManager.MemberLookup (ec.ContainerType, PropertyInfo.DeclaringType,
+ MemberTypes.Method, flags, "set_" + PropertyInfo.Name);
+ if (group != null && group.Length > 0){
+ setter = (MethodInfo) group [0];
+ if (setter.IsStatic)
+ is_static = true;
+ }
+
+ if (setter == null && getter == null){
+ Error (122, "`" + PropertyInfo.Name + "' " +
+ "is inaccessible because of its protection level");
+
+ }
+ }
+
+ bool InstanceResolve (EmitContext ec)
+ {
+ if ((instance_expr == null) && ec.IsStatic && !is_static) {
+ SimpleName.Error_ObjectRefRequired (ec, loc, PropertyInfo.Name);
+ return false;
+ }
+
+ if (instance_expr != null) {
+ instance_expr = instance_expr.DoResolve (ec);
+ if (instance_expr == null)
+ return false;
+ }
+
+ return true;
+ }
+