Exemplo n.º 1
0
        public override MemberExpr ResolveMemberAccess(ResolveContext ec, Expression left, Location loc,
            SimpleName original)
        {
            if (!(left is TypeExpr) &&
                original != null && original.IdenticalNameAndTypeName (ec, left, loc))
                identical_type_name = true;

            return base.ResolveMemberAccess (ec, left, loc, original);
        }
Exemplo n.º 2
0
        public virtual MemberExpr ResolveMemberAccess(ResolveContext ec, Expression left, Location loc,
            SimpleName original)
        {
            //
            // Precondition:
            //   original == null || original.Resolve (...) ==> left
            //

            if (left is TypeExpr) {
                left = ((TypeExpr) left).ResolveAsTypeTerminal (ec, false);
                if (left == null)
                    return null;

                // TODO: Same problem as in class.cs, TypeTerminal does not
                // always do all necessary checks
                ObsoleteAttribute oa = left.Type.GetAttributeObsolete ();
                if (oa != null && !ec.IsObsolete) {
                    AttributeTester.Report_ObsoleteMessage (oa, left.GetSignatureForError (), loc, ec.Report);
                }

            //				GenericTypeExpr ct = left as GenericTypeExpr;
            //				if (ct != null && !ct.CheckConstraints (ec))
            //					return null;
                //

                if (!IsStatic) {
                    SimpleName.Error_ObjectRefRequired (ec, loc, GetSignatureForError ());
                    return null;
                }

                return this;
            }

            if (!IsInstance) {
                if (original != null && original.IdenticalNameAndTypeName (ec, left, loc))
                    return this;

                return ResolveExtensionMemberAccess (ec, left);
            }

            InstanceExpression = left;
            return this;
        }