Equals() public method

public Equals ( MemberName other ) : bool
other MemberName
return bool
Ejemplo n.º 1
0
        public bool Equals(MemberName other)
        {
            if (this == other)
            {
                return(true);
            }
            if (other == null || Name != other.Name)
            {
                return(false);
            }

            if ((TypeParameters != null) &&
                (other.TypeParameters == null || TypeParameters.Count != other.TypeParameters.Count))
            {
                return(false);
            }

            if ((TypeParameters == null) && (other.TypeParameters != null))
            {
                return(false);
            }

            if (Left == null)
            {
                return(other.Left == null);
            }

            return(Left.Equals(other.Left));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Records a new namespace for resolving name references
        /// </summary>
        public void AddUsing(MemberName name, Location loc)
        {
            if (DeclarationFound)
            {
                Compiler.Report.Error(1529, loc, "A using clause must precede all other namespace elements except extern alias declarations");
            }

            if (using_clauses == null)
            {
                using_clauses = new List <NamespaceUsing> ();
            }
            else
            {
                foreach (NamespaceUsing old_entry in using_clauses)
                {
                    if (name.Equals(old_entry.MemberName))
                    {
                        Compiler.Report.SymbolRelatedToPreviousError(old_entry.Location, old_entry.GetSignatureForError());
                        Compiler.Report.Warning(105, 3, loc, "The using directive for `{0}' appeared previously in this namespace", name.GetSignatureForError());
                        return;
                    }
                }
            }

            using_clauses.Add(new NamespaceUsing(name));
        }
Ejemplo n.º 3
0
        public bool Equals(MemberName other)
        {
            if (this == other)
                return true;
            if (other == null || Name != other.Name)
                return false;

            if ((TypeParameters != null) &&
                (other.TypeParameters == null || TypeParameters.Count != other.TypeParameters.Count))
                return false;

            if ((TypeParameters == null) && (other.TypeParameters != null))
                return false;

            if (Left == null)
                return other.Left == null;

            return Left.Equals (other.Left);
        }
Ejemplo n.º 4
0
		/// <summary>
		///   Records a new namespace for resolving name references
		/// </summary>
		public void AddUsing (MemberName name, Location loc)
		{
			if (DeclarationFound){
				Compiler.Report.Error (1529, loc, "A using clause must precede all other namespace elements except extern alias declarations");
			}

			if (using_clauses == null) {
				using_clauses = new ArrayList ();
			} else {
				foreach (UsingEntry old_entry in using_clauses) {
					if (name.Equals (old_entry.MemberName)) {
						Compiler.Report.SymbolRelatedToPreviousError (old_entry.Location, old_entry.GetSignatureForError ());
						Compiler.Report.Warning (105, 3, loc, "The using directive for `{0}' appeared previously in this namespace", name.GetSignatureForError ());
						return;
					}
				}
			}

			using_clauses.Add (new UsingEntry (name));
		}