2 // namespace.cs: Tracks namespaces
5 // Miguel de Icaza (miguel@ximian.com)
6 // Marek Safar (marek.safar@seznam.cz)
8 // (C) 2001 Ximian, Inc.
11 using System.Collections;
12 using System.Collections.Specialized;
13 using System.Reflection;
15 namespace Mono.CSharp {
17 public class RootNamespace : Namespace {
18 static MethodInfo get_namespaces_method;
21 Assembly referenced_assembly;
23 Hashtable all_namespaces;
25 static Hashtable root_namespaces;
26 public static GlobalRootNamespace Global;
28 static RootNamespace ()
30 get_namespaces_method = typeof (Assembly).GetMethod ("GetNamespaces", BindingFlags.Instance | BindingFlags.NonPublic);
35 public static void Reset ()
37 root_namespaces = new Hashtable ();
38 Global = new GlobalRootNamespace ();
39 root_namespaces ["global"] = Global;
42 protected RootNamespace (string alias_name, Assembly assembly)
43 : base (null, String.Empty)
45 this.alias_name = alias_name;
46 referenced_assembly = assembly;
48 all_namespaces = new Hashtable ();
49 all_namespaces.Add ("", this);
51 if (referenced_assembly != null)
52 ComputeNamespaces (this.referenced_assembly);
55 public static void DefineRootNamespace (string name, Assembly assembly)
57 if (name == "global") {
58 NamespaceEntry.Error_GlobalNamespaceRedefined (Location.Null);
61 RootNamespace retval = GetRootNamespace (name);
62 if (retval == null || retval.referenced_assembly != assembly)
63 root_namespaces [name] = new RootNamespace (name, assembly);
66 public static RootNamespace GetRootNamespace (string name)
68 return (RootNamespace) root_namespaces [name];
71 public virtual Type LookupTypeReflection (string name, Location loc)
73 return GetTypeInAssembly (referenced_assembly, name);
76 public void RegisterNamespace (Namespace child)
79 all_namespaces.Add (child.Name, child);
82 public bool IsNamespace (string name)
84 return all_namespaces.Contains (name);
87 protected void RegisterNamespace (string dotted_name)
89 if (dotted_name != null && dotted_name.Length != 0 && ! IsNamespace (dotted_name))
90 GetNamespace (dotted_name, true);
93 void RegisterExtensionMethodClass (Type t)
95 string n = t.Namespace;
96 Namespace ns = n == null ? Global : (Namespace)all_namespaces [n];
98 ns = GetNamespace (n, true);
100 ns.RegisterExternalExtensionMethodClass (t);
103 protected void ComputeNamespaces (Assembly assembly)
105 // How to test whether attribute exists without loading the assembly :-(
107 const string SystemCore = "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
109 const string SystemCore = "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
111 if (TypeManager.extension_attribute_type == null &&
112 assembly.FullName == SystemCore) {
113 TypeManager.extension_attribute_type = assembly.GetType("System.Runtime.CompilerServices.ExtensionAttribute");
116 bool contains_extension_methods = TypeManager.extension_attribute_type != null &&
117 assembly.IsDefined(TypeManager.extension_attribute_type, false);
119 if (get_namespaces_method != null && !contains_extension_methods) {
120 string [] namespaces = (string []) get_namespaces_method.Invoke (assembly, null);
121 foreach (string ns in namespaces)
122 RegisterNamespace (ns);
126 foreach (Type t in assembly.GetExportedTypes ()) {
127 if ((t.Attributes & Class.StaticClassAttribute) == Class.StaticClassAttribute &&
128 contains_extension_methods && t.IsDefined (TypeManager.extension_attribute_type, false))
129 RegisterExtensionMethodClass (t);
131 RegisterNamespace (t.Namespace);
135 protected static Type GetTypeInAssembly (Assembly assembly, string name)
137 Type t = assembly.GetType (name);
142 throw new InternalErrorException ("Use GetPointerType() to get a pointer");
144 TypeAttributes ta = t.Attributes & TypeAttributes.VisibilityMask;
145 if (ta == TypeAttributes.NestedPrivate)
148 if ((ta == TypeAttributes.NotPublic ||
149 ta == TypeAttributes.NestedAssembly ||
150 ta == TypeAttributes.NestedFamANDAssem) &&
151 !TypeManager.IsThisOrFriendAssembly (t.Assembly))
157 public override string ToString ()
159 return String.Format ("RootNamespace ({0}::)", alias_name);
162 public override string GetSignatureForError ()
164 return alias_name + "::";
168 public class GlobalRootNamespace : RootNamespace {
169 Assembly [] assemblies;
172 public GlobalRootNamespace ()
173 : base ("global", null)
175 assemblies = new Assembly [0];
178 public Assembly [] Assemblies {
179 get { return assemblies; }
182 public Module [] Modules {
183 get { return modules; }
186 public void AddAssemblyReference (Assembly a)
188 foreach (Assembly assembly in assemblies) {
193 int top = assemblies.Length;
194 Assembly [] n = new Assembly [top + 1];
195 assemblies.CopyTo (n, 0);
199 ComputeNamespaces (a);
202 public void AddModuleReference (Module m)
204 int top = modules != null ? modules.Length : 0;
205 Module [] n = new Module [top + 1];
207 modules.CopyTo (n, 0);
211 if (m == CodeGen.Module.Builder)
214 foreach (Type t in m.GetTypes ())
215 RegisterNamespace (t.Namespace);
218 public override void Error_NamespaceDoesNotExist(DeclSpace ds, Location loc, string name)
220 Report.Error (400, loc, "The type or namespace name `{0}' could not be found in the global namespace (are you missing an assembly reference?)",
224 public override Type LookupTypeReflection (string name, Location loc)
226 Type found_type = null;
228 foreach (Assembly a in assemblies) {
229 Type t = GetTypeInAssembly (a, name);
233 if (found_type == null) {
238 Report.SymbolRelatedToPreviousError (found_type);
239 Report.SymbolRelatedToPreviousError (t);
240 Report.Error (433, loc, "The imported type `{0}' is defined multiple times", name);
245 if (modules != null) {
246 foreach (Module module in modules) {
247 Type t = module.GetType (name);
251 if (found_type == null) {
256 Report.SymbolRelatedToPreviousError (found_type);
258 DeclSpace ds = TypeManager.LookupDeclSpace (t);
259 Report.Warning (1685, 1, ds.Location, "The type `{0}' conflicts with the predefined type `{1}' and will be ignored",
260 ds.GetSignatureForError (), TypeManager.CSharpName (found_type));
263 Report.SymbolRelatedToPreviousError (t);
264 Report.Warning (436, 2, loc, "The type `{0}' conflicts with the imported type `{1}'. Ignoring the imported type definition",
265 TypeManager.CSharpName (t), TypeManager.CSharpName (found_type));
275 /// Keeps track of the namespaces defined in the C# code.
277 /// This is an Expression to allow it to be referenced in the
278 /// compiler parse/intermediate tree during name resolution.
280 public class Namespace : FullNamedExpression {
284 IDictionary namespaces;
285 IDictionary declspaces;
286 Hashtable cached_types;
288 ArrayList external_exmethod_classes;
290 public readonly MemberName MemberName;
293 /// Constructor Takes the current namespace and the
294 /// name. This is bootstrapped with parent == null
297 public Namespace (Namespace parent, string name)
299 // Expression members.
300 this.eclass = ExprClass.Namespace;
301 this.Type = typeof (Namespace);
302 this.loc = Location.Null;
304 this.parent = parent;
307 this.root = parent.root;
309 this.root = this as RootNamespace;
311 if (this.root == null)
312 throw new InternalErrorException ("Root namespaces must be created using RootNamespace");
314 string pname = parent != null ? parent.Name : "";
319 fullname = parent.Name + "." + name;
321 if (fullname == null)
322 throw new InternalErrorException ("Namespace has a null fullname");
324 if (parent != null && parent.MemberName != MemberName.Null)
325 MemberName = new MemberName (parent.MemberName, name);
326 else if (name.Length == 0)
327 MemberName = MemberName.Null;
329 MemberName = new MemberName (name);
331 namespaces = new HybridDictionary ();
332 cached_types = new Hashtable ();
334 root.RegisterNamespace (this);
337 public override Expression DoResolve (EmitContext ec)
342 public virtual void Error_NamespaceDoesNotExist (DeclSpace ds, Location loc, string name)
344 if (name.IndexOf ('`') > 0) {
345 FullNamedExpression retval = Lookup (ds, SimpleName.RemoveGenericArity (name), loc);
346 if (retval != null) {
347 Error_TypeArgumentsCannotBeUsed (retval.Type, loc);
351 Type t = LookForAnyGenericType (name);
353 Error_InvalidNumberOfTypeArguments (t, loc);
358 Report.Error (234, loc, "The type or namespace name `{0}' does not exist in the namespace `{1}'. Are you missing an assembly reference?",
362 public static void Error_InvalidNumberOfTypeArguments (Type t, Location loc)
364 Report.SymbolRelatedToPreviousError (t);
365 Report.Error (305, loc, "Using the generic type `{0}' requires `{1}' type argument(s)",
366 TypeManager.CSharpName(t), TypeManager.GetNumberOfTypeArguments(t).ToString());
369 public static void Error_TypeArgumentsCannotBeUsed (Type t, Location loc)
371 Report.SymbolRelatedToPreviousError (t);
372 Error_TypeArgumentsCannotBeUsed (loc, "type", TypeManager.CSharpName (t));
375 public static void Error_TypeArgumentsCannotBeUsed (MethodBase mi, Location loc)
377 Report.SymbolRelatedToPreviousError (mi);
378 Error_TypeArgumentsCannotBeUsed (loc, "method", TypeManager.CSharpSignature (mi));
381 static void Error_TypeArgumentsCannotBeUsed (Location loc, string type, string name)
383 Report.Error(308, loc, "The non-generic {0} `{1}' cannot be used with the type arguments",
387 public override void Emit (EmitContext ec)
389 throw new InternalErrorException ("Expression tree referenced namespace " + fullname + " during Emit ()");
392 public override string GetSignatureForError ()
397 public Namespace GetNamespace (string name, bool create)
399 int pos = name.IndexOf ('.');
404 first = name.Substring (0, pos);
408 ns = (Namespace) namespaces [first];
413 ns = new Namespace (this, first);
414 namespaces.Add (first, ns);
418 ns = ns.GetNamespace (name.Substring (pos + 1), create);
423 TypeExpr LookupType (string name, Location loc)
425 if (cached_types.Contains (name))
426 return cached_types [name] as TypeExpr;
429 if (declspaces != null) {
430 DeclSpace tdecl = declspaces [name] as DeclSpace;
433 // Note that this is not:
435 // t = tdecl.DefineType ()
437 // This is to make it somewhat more useful when a DefineType
438 // fails due to problems in nested types (more useful in the sense
439 // of fewer misleading error messages)
442 t = tdecl.TypeBuilder;
445 string lookup = t != null ? t.FullName : (fullname.Length == 0 ? name : fullname + "." + name);
446 Type rt = root.LookupTypeReflection (lookup, loc);
448 // HACK: loc.IsNull when the type is core type
449 if (t == null || (rt != null && loc.IsNull))
452 TypeExpr te = t == null ? null : new TypeExpression (t, Location.Null);
453 cached_types [name] = te;
458 /// Used for better error reporting only
460 public Type LookForAnyGenericType (string typeName)
462 if (declspaces == null)
465 typeName = SimpleName.RemoveGenericArity (typeName);
467 foreach (DictionaryEntry de in declspaces) {
468 string type_item = (string) de.Key;
469 int pos = type_item.LastIndexOf ('`');
470 if (pos == typeName.Length && String.Compare (typeName, 0, type_item, 0, pos) == 0)
471 return ((DeclSpace) de.Value).TypeBuilder;
476 public FullNamedExpression Lookup (DeclSpace ds, string name, Location loc)
478 if (namespaces.Contains (name))
479 return (Namespace) namespaces [name];
481 return LookupType (name, loc);
484 public void RegisterExternalExtensionMethodClass (Type type)
486 if (external_exmethod_classes == null)
487 external_exmethod_classes = new ArrayList ();
489 external_exmethod_classes.Add (type);
493 /// Looks for extension method in this namespace
495 public ArrayList LookupExtensionMethod (Type extensionType, ClassOrStruct currentClass, string name, NamespaceEntry ns)
497 ArrayList found = null;
499 if (declspaces != null) {
500 IEnumerator e = declspaces.Values.GetEnumerator ();
502 while (e.MoveNext ()) {
503 Class c = e.Current as Class;
507 if (!c.IsStaticClass)
510 ArrayList res = c.MemberCache.FindExtensionMethods (extensionType, name, c != currentClass);
517 found.AddRange (res);
521 if (external_exmethod_classes == null)
524 foreach (Type t in external_exmethod_classes) {
525 MemberCache m = TypeHandle.GetMemberCache (t);
526 ArrayList res = m.FindExtensionMethods (extensionType, name, true);
533 found.AddRange (res);
539 public void AddDeclSpace (string name, DeclSpace ds)
541 if (declspaces == null)
542 declspaces = new HybridDictionary ();
543 declspaces.Add (name, ds);
547 /// The qualified name of the current namespace
550 get { return fullname; }
553 public override string FullName {
554 get { return fullname; }
558 /// The parent of this namespace, used by the parser to "Pop"
559 /// the current namespace declaration
561 public Namespace Parent {
562 get { return parent; }
565 public override string ToString ()
567 return String.Format ("Namespace ({0})", Name);
572 // Namespace container as created by the parser
574 public class NamespaceEntry : IResolveContext {
577 readonly MemberName name;
580 public UsingEntry (MemberName name)
585 public string GetSignatureForError ()
587 return name.GetSignatureForError ();
590 public Location Location {
591 get { return name.Location; }
594 public MemberName MemberName {
599 get { return GetSignatureForError (); }
602 public Namespace Resolve (IResolveContext rc)
604 if (resolved != null)
607 FullNamedExpression fne = name.GetTypeExpression ().ResolveAsTypeStep (rc, false);
611 resolved = fne as Namespace;
612 if (resolved == null) {
613 Report.SymbolRelatedToPreviousError (fne.Type);
614 Report.Error (138, Location,
615 "`{0}' is a type not a namespace. A using namespace directive can only be applied to namespaces",
616 GetSignatureForError ());
622 class UsingAliasEntry {
623 public readonly string Alias;
624 public Location Location;
626 public UsingAliasEntry (string alias, Location loc)
632 public virtual FullNamedExpression Resolve (IResolveContext rc)
634 FullNamedExpression fne = RootNamespace.GetRootNamespace (Alias);
636 Report.Error (430, Location,
637 "The extern alias `{0}' was not specified in -reference option",
645 class LocalUsingAliasEntry : UsingAliasEntry {
649 public LocalUsingAliasEntry (string alias, MemberName name, Location loc)
655 public override FullNamedExpression Resolve (IResolveContext rc)
657 if (resolved != null)
658 return (FullNamedExpression)resolved;
660 resolved = value.GetTypeExpression ().ResolveAsTypeStep (rc, false);
661 if (resolved == null)
664 // FIXME: This is quite wrong, the accessibility is not global
665 if (resolved.Type != null) {
666 TypeAttributes attr = resolved.Type.Attributes & TypeAttributes.VisibilityMask;
667 if (attr == TypeAttributes.NestedPrivate || attr == TypeAttributes.NestedFamily ||
668 ((attr == TypeAttributes.NestedFamORAssem || attr == TypeAttributes.NestedAssembly) &&
669 TypeManager.LookupDeclSpace (resolved.Type) == null)) {
670 Expression.ErrorIsInaccesible (resolved.Location, resolved.GetSignatureForError ());
675 return (FullNamedExpression)resolved;
680 NamespaceEntry parent, implicit_parent;
684 // Namespace using import block
685 ArrayList using_aliases;
686 ArrayList using_clauses;
687 public bool DeclarationFound = false;
690 public readonly bool IsImplicit;
691 public readonly DeclSpace SlaveDeclSpace;
692 static readonly Namespace [] empty_namespaces = new Namespace [0];
693 Namespace [] namespace_using_table;
695 static ArrayList entries = new ArrayList ();
697 public static void Reset ()
699 entries = new ArrayList ();
702 public NamespaceEntry (NamespaceEntry parent, SourceFile file, string name)
704 this.parent = parent;
709 ns = parent.NS.GetNamespace (name, true);
710 else if (name != null)
711 ns = RootNamespace.Global.GetNamespace (name, true);
713 ns = RootNamespace.Global;
714 SlaveDeclSpace = new RootDeclSpace (this);
717 private NamespaceEntry (NamespaceEntry parent, SourceFile file, Namespace ns, bool slave)
719 this.parent = parent;
721 this.IsImplicit = true;
723 this.SlaveDeclSpace = slave ? new RootDeclSpace (this) : null;
727 // According to section 16.3.1 (using-alias-directive), the namespace-or-type-name is
728 // resolved as if the immediately containing namespace body has no using-directives.
730 // Section 16.3.2 says that the same rule is applied when resolving the namespace-name
731 // in the using-namespace-directive.
733 // To implement these rules, the expressions in the using directives are resolved using
734 // the "doppelganger" (ghostly bodiless duplicate).
736 NamespaceEntry doppelganger;
737 NamespaceEntry Doppelganger {
739 if (!IsImplicit && doppelganger == null) {
740 doppelganger = new NamespaceEntry (ImplicitParent, file, ns, true);
741 doppelganger.using_aliases = using_aliases;
747 public Namespace NS {
751 public NamespaceEntry Parent {
752 get { return parent; }
755 public NamespaceEntry ImplicitParent {
759 if (implicit_parent == null) {
760 implicit_parent = (parent.NS == ns.Parent)
762 : new NamespaceEntry (parent, file, ns.Parent, false);
764 return implicit_parent;
769 /// Records a new namespace for resolving name references
771 public void AddUsing (MemberName name, Location loc)
773 if (DeclarationFound){
774 Report.Error (1529, loc, "A using clause must precede all other namespace elements except extern alias declarations");
777 if (using_clauses == null) {
778 using_clauses = new ArrayList ();
780 foreach (UsingEntry old_entry in using_clauses) {
781 if (name.Equals (old_entry.MemberName)) {
782 Report.SymbolRelatedToPreviousError (old_entry.Location, old_entry.GetSignatureForError ());
783 Report.Warning (105, 3, loc, "The using directive for `{0}' appeared previously in this namespace", name.GetSignatureForError ());
789 using_clauses.Add (new UsingEntry (name));
792 public void AddUsingAlias (string alias, MemberName name, Location loc)
794 // TODO: This is parser bussines
795 if (DeclarationFound){
796 Report.Error (1529, loc, "A using clause must precede all other namespace elements except extern alias declarations");
799 if (RootContext.Version != LanguageVersion.ISO_1 && alias == "global")
800 Report.Warning (440, 2, loc, "An alias named `global' will not be used when resolving 'global::';" +
801 " the global namespace will be used instead");
803 AddUsingAlias (new LocalUsingAliasEntry (alias, name, loc));
806 public void AddUsingExternalAlias (string alias, Location loc)
808 // TODO: Do this in parser
809 bool not_first = using_clauses != null || DeclarationFound;
810 if (using_aliases != null && !not_first) {
811 foreach (UsingAliasEntry uae in using_aliases) {
812 if (uae is LocalUsingAliasEntry) {
820 Report.Error (439, loc, "An extern alias declaration must precede all other elements");
822 if (alias == "global") {
823 Error_GlobalNamespaceRedefined (loc);
827 AddUsingAlias (new UsingAliasEntry (alias, loc));
830 void AddUsingAlias (UsingAliasEntry uae)
832 if (using_aliases == null) {
833 using_aliases = new ArrayList ();
835 foreach (UsingAliasEntry entry in using_aliases) {
836 if (uae.Alias == entry.Alias) {
837 Report.SymbolRelatedToPreviousError (uae.Location, uae.Alias);
838 Report.Error (1537, entry.Location, "The using alias `{0}' appeared previously in this namespace",
845 using_aliases.Add (uae);
849 /// Does extension methods look up to find a method which matches name and extensionType.
850 /// Search starts from this namespace and continues hierarchically up to top level.
852 public ExtensionMethodGroupExpr LookupExtensionMethod (Type extensionType, ClassOrStruct currentClass, string name, Location loc)
854 ArrayList candidates = null;
855 if (currentClass != null) {
856 candidates = ns.LookupExtensionMethod (extensionType, currentClass, name, this);
857 if (candidates != null)
858 return new ExtensionMethodGroupExpr (candidates, this, extensionType, loc);
861 foreach (Namespace n in GetUsingTable ()) {
862 ArrayList a = n.LookupExtensionMethod (extensionType, null, name, this);
866 if (candidates == null)
869 candidates.AddRange (a);
872 if (candidates != null)
873 return new ExtensionMethodGroupExpr (candidates, parent, extensionType, loc);
878 return parent.LookupExtensionMethod (extensionType, currentClass, name, loc);
881 public FullNamedExpression LookupNamespaceOrType (DeclSpace ds, string name, Location loc, bool ignore_cs0104)
883 // Precondition: Only simple names (no dots) will be looked up with this function.
884 FullNamedExpression resolved = null;
885 for (NamespaceEntry curr_ns = this; curr_ns != null; curr_ns = curr_ns.ImplicitParent) {
886 if ((resolved = curr_ns.Lookup (ds, name, loc, ignore_cs0104)) != null)
892 static void Error_AmbiguousTypeReference (Location loc, string name, FullNamedExpression t1, FullNamedExpression t2)
894 Report.SymbolRelatedToPreviousError (t1.Type);
895 Report.SymbolRelatedToPreviousError (t2.Type);
896 Report.Error (104, loc, "`{0}' is an ambiguous reference between `{1}' and `{2}'",
897 name, t1.FullName, t2.FullName);
900 // Looks-up a alias named @name in this and surrounding namespace declarations
901 public FullNamedExpression LookupAlias (string name)
903 for (NamespaceEntry n = this; n != null; n = n.ImplicitParent) {
904 if (n.using_aliases == null)
907 foreach (UsingAliasEntry ue in n.using_aliases) {
908 if (ue.Alias == name)
909 return ue.Resolve (Doppelganger);
916 private FullNamedExpression Lookup (DeclSpace ds, string name, Location loc, bool ignore_cs0104)
919 // Check whether it's in the namespace.
921 FullNamedExpression fne = ns.Lookup (ds, name, loc);
928 if (using_aliases != null) {
929 foreach (UsingAliasEntry ue in using_aliases) {
930 if (ue.Alias == name)
931 return ue.Resolve (Doppelganger);
939 // Check using entries.
941 FullNamedExpression match = null;
942 foreach (Namespace using_ns in GetUsingTable ()) {
943 match = using_ns.Lookup (ds, name, loc);
944 if (match == null || !(match is TypeExpr))
948 Error_AmbiguousTypeReference (loc, name, fne, match);
957 Namespace [] GetUsingTable ()
959 if (namespace_using_table != null)
960 return namespace_using_table;
962 if (using_clauses == null) {
963 namespace_using_table = empty_namespaces;
964 return namespace_using_table;
967 ArrayList list = new ArrayList (using_clauses.Count);
969 foreach (UsingEntry ue in using_clauses) {
970 Namespace using_ns = ue.Resolve (Doppelganger);
971 if (using_ns == null)
977 namespace_using_table = (Namespace[])list.ToArray (typeof (Namespace));
978 return namespace_using_table;
981 static readonly string [] empty_using_list = new string [0];
983 public int SymbolFileID {
985 if (symfile_id == 0 && file.SourceFileEntry != null) {
986 int parent_id = parent == null ? 0 : parent.SymbolFileID;
988 string [] using_list = empty_using_list;
989 if (using_clauses != null) {
990 using_list = new string [using_clauses.Count];
991 for (int i = 0; i < using_clauses.Count; i++)
992 using_list [i] = ((UsingEntry) using_clauses [i]).MemberName.GetTypeName ();
995 symfile_id = SymbolWriter.DefineNamespace (ns.Name, file.SourceFileEntry, using_list, parent_id);
1001 static void MsgtryRef (string s)
1003 Console.WriteLine (" Try using -r:" + s);
1006 static void MsgtryPkg (string s)
1008 Console.WriteLine (" Try using -pkg:" + s);
1011 public static void Error_GlobalNamespaceRedefined (Location loc)
1013 Report.Error (1681, loc, "You cannot redefine the global extern alias");
1016 public static void Error_NamespaceNotFound (Location loc, string name)
1018 Report.Error (246, loc, "The type or namespace name `{0}' could not be found. Are you missing a using directive or an assembly reference?",
1022 case "Gtk": case "GtkSharp":
1023 MsgtryPkg ("gtk-sharp");
1026 case "Gdk": case "GdkSharp":
1027 MsgtryPkg ("gdk-sharp");
1030 case "Glade": case "GladeSharp":
1031 MsgtryPkg ("glade-sharp");
1034 case "System.Drawing":
1035 case "System.Web.Services":
1038 case "System.Windows.Forms":
1045 /// Used to validate that all the using clauses are correct
1046 /// after we are finished parsing all the files.
1050 if (using_aliases != null) {
1051 foreach (UsingAliasEntry ue in using_aliases)
1052 ue.Resolve (Doppelganger);
1055 if (using_clauses != null) {
1056 foreach (UsingEntry ue in using_clauses)
1057 ue.Resolve (Doppelganger);
1062 /// Used to validate that all the using clauses are correct
1063 /// after we are finished parsing all the files.
1065 static public void VerifyAllUsing ()
1067 foreach (NamespaceEntry entry in entries)
1068 entry.VerifyUsing ();
1071 public string GetSignatureForError ()
1073 return ns.GetSignatureForError ();
1076 public override string ToString ()
1078 return ns.ToString ();
1081 #region IResolveContext Members
1083 public DeclSpace DeclContainer {
1084 get { return SlaveDeclSpace; }
1087 public bool IsInObsoleteScope {
1088 get { return SlaveDeclSpace.IsInObsoleteScope; }
1091 public bool IsInUnsafeScope {
1092 get { return SlaveDeclSpace.IsInUnsafeScope; }
1095 public DeclSpace GenericDeclContainer {
1096 get { return SlaveDeclSpace; }