// // Returns full member name for error message // public virtual string GetSignatureForError() { var parent = Parent.GetSignatureForError (); if (parent == null) return member_name.GetSignatureForError (); return parent + "." + member_name.GetSignatureForError (); }
public string GetSignatureForError() { string s = TypeParameters == null ? null : "<" + TypeParameters.GetSignatureForError () + ">"; s = Name + s; if (ExplicitInterface != null) s = ExplicitInterface.GetSignatureForError () + "." + s; if (Left == null) return s; return Left.GetSignatureForError () + "." + s; }
public bool AddTypesContainer(ITypesContainer container) { var mn = container.MemberName; ITypesContainer found; if (!defined_type_containers.TryGetValue(mn, out found)) { defined_type_containers.Add(mn, container); return(true); } if (container is NamespaceContainer && found is NamespaceContainer) { return(true); } var container_tc = container as TypeContainer; var found_tc = found as TypeContainer; if (container_tc != null && found_tc != null && container_tc.Kind == found_tc.Kind) { if ((found_tc.ModFlags & container_tc.ModFlags & Modifiers.PARTIAL) != 0) { return(false); } if (((found_tc.ModFlags | container_tc.ModFlags) & Modifiers.PARTIAL) != 0) { Report.SymbolRelatedToPreviousError(found_tc); Error_MissingPartialModifier(container_tc); return(false); } } string ns = mn.Left != null?mn.Left.GetSignatureForError() : Module.GlobalRootNamespace.GetSignatureForError(); mn = new MemberName(mn.Name, mn.TypeArguments, mn.Location); Report.SymbolRelatedToPreviousError(found.Location, ""); Report.Error(101, container.Location, "The namespace `{0}' already contains a definition for `{1}'", ns, mn.GetSignatureForError()); return(false); }
/// <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)); }
/// <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)); }
public string GetSignatureForError() { return(name.GetSignatureForError()); }
public override string ToString() { return(String.Format("{0} = {1}", Alias, value.GetSignatureForError())); }
public bool AddTypesContainer (ITypesContainer container) { var mn = container.MemberName; ITypesContainer found; if (!defined_type_containers.TryGetValue (mn, out found)) { defined_type_containers.Add (mn, container); return true; } if (container is NamespaceContainer && found is NamespaceContainer) return true; var container_tc = container as TypeContainer; var found_tc = found as TypeContainer; if (container_tc != null && found_tc != null && container_tc.Kind == found_tc.Kind) { if ((found_tc.ModFlags & container_tc.ModFlags & Modifiers.PARTIAL) != 0) { return false; } if (((found_tc.ModFlags | container_tc.ModFlags) & Modifiers.PARTIAL) != 0) { Report.SymbolRelatedToPreviousError (found_tc); Error_MissingPartialModifier (container_tc); return false; } } string ns = mn.Left != null ? mn.Left.GetSignatureForError () : Module.GlobalRootNamespace.GetSignatureForError (); mn = new MemberName (mn.Name, mn.TypeArguments, mn.Location); Report.SymbolRelatedToPreviousError (found.Location, ""); Report.Error (101, container.Location, "The namespace `{0}' already contains a definition for `{1}'", ns, mn.GetSignatureForError ()); return false; }