2 // namespace.cs: Tracks namespaces
5 // Miguel de Icaza (miguel@ximian.com)
6 // Marek Safar (marek.safar@seznam.cz)
8 // Copyright 2001 Ximian, Inc.
9 // Copyright 2003-2008 Novell, Inc.
12 using System.Collections;
13 using System.Collections.Specialized;
14 using System.Reflection;
16 namespace Mono.CSharp {
18 public class RootNamespace : Namespace {
19 static MethodInfo get_namespaces_method;
22 Assembly referenced_assembly;
24 Hashtable all_namespaces;
26 static Hashtable root_namespaces;
27 public static GlobalRootNamespace Global;
29 static RootNamespace ()
31 get_namespaces_method = typeof (Assembly).GetMethod ("GetNamespaces", BindingFlags.Instance | BindingFlags.NonPublic);
36 public static void Reset ()
38 root_namespaces = new Hashtable ();
39 Global = new GlobalRootNamespace ();
40 root_namespaces ["global"] = Global;
43 protected RootNamespace (string alias_name, Assembly assembly)
44 : base (null, String.Empty)
46 this.alias_name = alias_name;
47 referenced_assembly = assembly;
49 all_namespaces = new Hashtable ();
50 all_namespaces.Add ("", this);
52 if (referenced_assembly != null)
53 ComputeNamespaces (this.referenced_assembly);
56 public static void DefineRootNamespace (string name, Assembly assembly)
58 if (name == "global") {
59 NamespaceEntry.Error_GlobalNamespaceRedefined (Location.Null);
62 RootNamespace retval = GetRootNamespace (name);
63 if (retval == null || retval.referenced_assembly != assembly)
64 root_namespaces [name] = new RootNamespace (name, assembly);
67 public static RootNamespace GetRootNamespace (string name)
69 return (RootNamespace) root_namespaces [name];
72 public virtual Type LookupTypeReflection (string name, Location loc)
74 return GetTypeInAssembly (referenced_assembly, name);
77 public void RegisterNamespace (Namespace child)
80 all_namespaces.Add (child.Name, child);
83 public bool IsNamespace (string name)
85 return all_namespaces.Contains (name);
88 protected void RegisterNamespace (string dotted_name)
90 if (dotted_name != null && dotted_name.Length != 0 && ! IsNamespace (dotted_name))
91 GetNamespace (dotted_name, true);
94 void RegisterExtensionMethodClass (Type t)
96 string n = t.Namespace;
97 Namespace ns = n == null ? Global : (Namespace)all_namespaces [n];
99 ns = GetNamespace (n, true);
101 ns.RegisterExternalExtensionMethodClass (t);
104 protected void ComputeNamespaces (Assembly assembly)
106 // How to test whether attribute exists without loading the assembly :-(
108 const string SystemCore = "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
110 const string SystemCore = "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
112 if (TypeManager.extension_attribute_type == null &&
113 assembly.FullName == SystemCore) {
114 TypeManager.extension_attribute_type = assembly.GetType("System.Runtime.CompilerServices.ExtensionAttribute");
117 bool contains_extension_methods = TypeManager.extension_attribute_type != null &&
118 assembly.IsDefined(TypeManager.extension_attribute_type, false);
120 if (get_namespaces_method != null && !contains_extension_methods) {
121 string [] namespaces = (string []) get_namespaces_method.Invoke (assembly, null);
122 foreach (string ns in namespaces)
123 RegisterNamespace (ns);
127 foreach (Type t in assembly.GetExportedTypes ()) {
128 if ((t.Attributes & Class.StaticClassAttribute) == Class.StaticClassAttribute &&
129 contains_extension_methods && t.IsDefined (TypeManager.extension_attribute_type, false))
130 RegisterExtensionMethodClass (t);
132 RegisterNamespace (t.Namespace);
136 protected static Type GetTypeInAssembly (Assembly assembly, string name)
138 Type t = assembly.GetType (name);
143 throw new InternalErrorException ("Use GetPointerType() to get a pointer");
145 TypeAttributes ta = t.Attributes & TypeAttributes.VisibilityMask;
146 if (ta == TypeAttributes.NestedPrivate)
149 if ((ta == TypeAttributes.NotPublic ||
150 ta == TypeAttributes.NestedAssembly ||
151 ta == TypeAttributes.NestedFamANDAssem) &&
152 !TypeManager.IsThisOrFriendAssembly (t.Assembly))
158 public override string ToString ()
160 return String.Format ("RootNamespace ({0}::)", alias_name);
163 public override string GetSignatureForError ()
165 return alias_name + "::";
169 public class GlobalRootNamespace : RootNamespace {
170 Assembly [] assemblies;
173 public GlobalRootNamespace ()
174 : base ("global", null)
176 assemblies = new Assembly [0];
179 public Assembly [] Assemblies {
180 get { return assemblies; }
183 public Module [] Modules {
184 get { return modules; }
187 public void AddAssemblyReference (Assembly a)
189 foreach (Assembly assembly in assemblies) {
194 int top = assemblies.Length;
195 Assembly [] n = new Assembly [top + 1];
196 assemblies.CopyTo (n, 0);
200 ComputeNamespaces (a);
203 public void AddModuleReference (Module m)
205 int top = modules != null ? modules.Length : 0;
206 Module [] n = new Module [top + 1];
208 modules.CopyTo (n, 0);
212 if (m == CodeGen.Module.Builder)
215 foreach (Type t in m.GetTypes ())
216 RegisterNamespace (t.Namespace);
219 public override void Error_NamespaceDoesNotExist(DeclSpace ds, Location loc, string name)
221 Report.Error (400, loc, "The type or namespace name `{0}' could not be found in the global namespace (are you missing an assembly reference?)",
225 public override Type LookupTypeReflection (string name, Location loc)
227 Type found_type = null;
229 foreach (Assembly a in assemblies) {
230 Type t = GetTypeInAssembly (a, name);
234 if (found_type == null) {
239 Report.SymbolRelatedToPreviousError (found_type);
240 Report.SymbolRelatedToPreviousError (t);
241 Report.Error (433, loc, "The imported type `{0}' is defined multiple times", name);
246 if (modules != null) {
247 foreach (Module module in modules) {
248 Type t = module.GetType (name);
252 if (found_type == null) {
257 Report.SymbolRelatedToPreviousError (found_type);
259 DeclSpace ds = TypeManager.LookupDeclSpace (t);
260 Report.Warning (1685, 1, ds.Location, "The type `{0}' conflicts with the predefined type `{1}' and will be ignored",
261 ds.GetSignatureForError (), TypeManager.CSharpName (found_type));
264 Report.SymbolRelatedToPreviousError (t);
265 Report.Warning (436, 2, loc, "The type `{0}' conflicts with the imported type `{1}'. Ignoring the imported type definition",
266 TypeManager.CSharpName (t), TypeManager.CSharpName (found_type));
276 /// Keeps track of the namespaces defined in the C# code.
278 /// This is an Expression to allow it to be referenced in the
279 /// compiler parse/intermediate tree during name resolution.
281 public class Namespace : FullNamedExpression {
285 IDictionary namespaces;
286 IDictionary declspaces;
287 Hashtable cached_types;
289 ArrayList external_exmethod_classes;
291 public readonly MemberName MemberName;
294 /// Constructor Takes the current namespace and the
295 /// name. This is bootstrapped with parent == null
298 public Namespace (Namespace parent, string name)
300 // Expression members.
301 this.eclass = ExprClass.Namespace;
302 this.Type = typeof (Namespace);
303 this.loc = Location.Null;
305 this.parent = parent;
308 this.root = parent.root;
310 this.root = this as RootNamespace;
312 if (this.root == null)
313 throw new InternalErrorException ("Root namespaces must be created using RootNamespace");
315 string pname = parent != null ? parent.Name : "";
320 fullname = parent.Name + "." + name;
322 if (fullname == null)
323 throw new InternalErrorException ("Namespace has a null fullname");
325 if (parent != null && parent.MemberName != MemberName.Null)
326 MemberName = new MemberName (parent.MemberName, name);
327 else if (name.Length == 0)
328 MemberName = MemberName.Null;
330 MemberName = new MemberName (name);
332 namespaces = new HybridDictionary ();
333 cached_types = new Hashtable ();
335 root.RegisterNamespace (this);
338 public override Expression DoResolve (EmitContext ec)
343 public virtual void Error_NamespaceDoesNotExist (DeclSpace ds, Location loc, string name)
345 if (name.IndexOf ('`') > 0) {
346 FullNamedExpression retval = Lookup (ds, SimpleName.RemoveGenericArity (name), loc);
347 if (retval != null) {
348 Error_TypeArgumentsCannotBeUsed (retval.Type, loc);
352 Type t = LookForAnyGenericType (name);
354 Error_InvalidNumberOfTypeArguments (t, loc);
359 Report.Error (234, loc, "The type or namespace name `{0}' does not exist in the namespace `{1}'. Are you missing an assembly reference?",
363 public static void Error_InvalidNumberOfTypeArguments (Type t, Location loc)
365 Report.SymbolRelatedToPreviousError (t);
366 Report.Error (305, loc, "Using the generic type `{0}' requires `{1}' type argument(s)",
367 TypeManager.CSharpName(t), TypeManager.GetNumberOfTypeArguments(t).ToString());
370 public static void Error_TypeArgumentsCannotBeUsed (Type t, Location loc)
372 Report.SymbolRelatedToPreviousError (t);
373 Error_TypeArgumentsCannotBeUsed (loc, "type", TypeManager.CSharpName (t));
376 public static void Error_TypeArgumentsCannotBeUsed (MethodBase mi, Location loc)
378 Report.SymbolRelatedToPreviousError (mi);
379 Error_TypeArgumentsCannotBeUsed (loc, "method", TypeManager.CSharpSignature (mi));
382 static void Error_TypeArgumentsCannotBeUsed (Location loc, string type, string name)
384 Report.Error(308, loc, "The non-generic {0} `{1}' cannot be used with the type arguments",
388 public override void Emit (EmitContext ec)
390 throw new InternalErrorException ("Expression tree referenced namespace " + fullname + " during Emit ()");
393 public override string GetSignatureForError ()
398 public Namespace GetNamespace (string name, bool create)
400 int pos = name.IndexOf ('.');
405 first = name.Substring (0, pos);
409 ns = (Namespace) namespaces [first];
414 ns = new Namespace (this, first);
415 namespaces.Add (first, ns);
419 ns = ns.GetNamespace (name.Substring (pos + 1), create);
424 TypeExpr LookupType (string name, Location loc)
426 if (cached_types.Contains (name))
427 return cached_types [name] as TypeExpr;
430 if (declspaces != null) {
431 DeclSpace tdecl = declspaces [name] as DeclSpace;
434 // Note that this is not:
436 // t = tdecl.DefineType ()
438 // This is to make it somewhat more useful when a DefineType
439 // fails due to problems in nested types (more useful in the sense
440 // of fewer misleading error messages)
443 t = tdecl.TypeBuilder;
446 string lookup = t != null ? t.FullName : (fullname.Length == 0 ? name : fullname + "." + name);
447 Type rt = root.LookupTypeReflection (lookup, loc);
449 // HACK: loc.IsNull when the type is core type
450 if (t == null || (rt != null && loc.IsNull))
453 TypeExpr te = t == null ? null : new TypeExpression (t, Location.Null);
454 cached_types [name] = te;
459 /// Used for better error reporting only
461 public Type LookForAnyGenericType (string typeName)
463 if (declspaces == null)
466 typeName = SimpleName.RemoveGenericArity (typeName);
468 foreach (DictionaryEntry de in declspaces) {
469 string type_item = (string) de.Key;
470 int pos = type_item.LastIndexOf ('`');
471 if (pos == typeName.Length && String.Compare (typeName, 0, type_item, 0, pos) == 0)
472 return ((DeclSpace) de.Value).TypeBuilder;
477 public FullNamedExpression Lookup (DeclSpace ds, string name, Location loc)
479 if (namespaces.Contains (name))
480 return (Namespace) namespaces [name];
482 return LookupType (name, loc);
485 public void RegisterExternalExtensionMethodClass (Type type)
487 if (external_exmethod_classes == null)
488 external_exmethod_classes = new ArrayList ();
490 external_exmethod_classes.Add (type);
494 /// Looks for extension method in this namespace
496 public ArrayList LookupExtensionMethod (Type extensionType, ClassOrStruct currentClass, string name, NamespaceEntry ns)
498 ArrayList found = null;
500 if (declspaces != null) {
501 IEnumerator e = declspaces.Values.GetEnumerator ();
503 while (e.MoveNext ()) {
504 Class c = e.Current as Class;
508 if (!c.IsStaticClass)
511 ArrayList res = c.MemberCache.FindExtensionMethods (extensionType, name, c != currentClass);
518 found.AddRange (res);
522 if (external_exmethod_classes == null)
525 foreach (Type t in external_exmethod_classes) {
526 MemberCache m = TypeHandle.GetMemberCache (t);
527 ArrayList res = m.FindExtensionMethods (extensionType, name, true);
534 found.AddRange (res);
540 public void AddDeclSpace (string name, DeclSpace ds)
542 if (declspaces == null)
543 declspaces = new HybridDictionary ();
544 declspaces.Add (name, ds);
548 /// The qualified name of the current namespace
551 get { return fullname; }
554 public override string FullName {
555 get { return fullname; }
559 /// The parent of this namespace, used by the parser to "Pop"
560 /// the current namespace declaration
562 public Namespace Parent {
563 get { return parent; }
566 public override string ToString ()
568 return String.Format ("Namespace ({0})", Name);
573 // Namespace container as created by the parser
575 public class NamespaceEntry : IResolveContext {
578 readonly MemberName name;
581 public UsingEntry (MemberName name)
586 public string GetSignatureForError ()
588 return name.GetSignatureForError ();
591 public Location Location {
592 get { return name.Location; }
595 public MemberName MemberName {
600 get { return GetSignatureForError (); }
603 public Namespace Resolve (IResolveContext rc)
605 if (resolved != null)
608 FullNamedExpression fne = name.GetTypeExpression ().ResolveAsTypeStep (rc, false);
612 resolved = fne as Namespace;
613 if (resolved == null) {
614 Report.SymbolRelatedToPreviousError (fne.Type);
615 Report.Error (138, Location,
616 "`{0}' is a type not a namespace. A using namespace directive can only be applied to namespaces",
617 GetSignatureForError ());
623 class UsingAliasEntry {
624 public readonly string Alias;
625 public Location Location;
627 public UsingAliasEntry (string alias, Location loc)
633 public virtual FullNamedExpression Resolve (IResolveContext rc)
635 FullNamedExpression fne = RootNamespace.GetRootNamespace (Alias);
637 Report.Error (430, Location,
638 "The extern alias `{0}' was not specified in -reference option",
646 class LocalUsingAliasEntry : UsingAliasEntry {
650 public LocalUsingAliasEntry (string alias, MemberName name, Location loc)
656 public override FullNamedExpression Resolve (IResolveContext rc)
658 if (resolved != null)
659 return (FullNamedExpression)resolved;
661 resolved = value.GetTypeExpression ().ResolveAsTypeStep (rc, false);
662 if (resolved == null)
665 // FIXME: This is quite wrong, the accessibility is not global
666 if (resolved.Type != null) {
667 TypeAttributes attr = resolved.Type.Attributes & TypeAttributes.VisibilityMask;
668 if (attr == TypeAttributes.NestedPrivate || attr == TypeAttributes.NestedFamily ||
669 ((attr == TypeAttributes.NestedFamORAssem || attr == TypeAttributes.NestedAssembly) &&
670 TypeManager.LookupDeclSpace (resolved.Type) == null)) {
671 Expression.ErrorIsInaccesible (resolved.Location, resolved.GetSignatureForError ());
676 return (FullNamedExpression)resolved;
681 NamespaceEntry parent, implicit_parent;
685 // Namespace using import block
686 ArrayList using_aliases;
687 ArrayList using_clauses;
688 public bool DeclarationFound = false;
691 public readonly bool IsImplicit;
692 public readonly DeclSpace SlaveDeclSpace;
693 static readonly Namespace [] empty_namespaces = new Namespace [0];
694 Namespace [] namespace_using_table;
696 static ArrayList entries = new ArrayList ();
698 public static void Reset ()
700 entries = new ArrayList ();
703 public NamespaceEntry (NamespaceEntry parent, SourceFile file, string name)
705 this.parent = parent;
710 ns = parent.NS.GetNamespace (name, true);
711 else if (name != null)
712 ns = RootNamespace.Global.GetNamespace (name, true);
714 ns = RootNamespace.Global;
715 SlaveDeclSpace = new RootDeclSpace (this);
718 private NamespaceEntry (NamespaceEntry parent, SourceFile file, Namespace ns, bool slave)
720 this.parent = parent;
722 this.IsImplicit = true;
724 this.SlaveDeclSpace = slave ? new RootDeclSpace (this) : null;
728 // According to section 16.3.1 (using-alias-directive), the namespace-or-type-name is
729 // resolved as if the immediately containing namespace body has no using-directives.
731 // Section 16.3.2 says that the same rule is applied when resolving the namespace-name
732 // in the using-namespace-directive.
734 // To implement these rules, the expressions in the using directives are resolved using
735 // the "doppelganger" (ghostly bodiless duplicate).
737 NamespaceEntry doppelganger;
738 NamespaceEntry Doppelganger {
740 if (!IsImplicit && doppelganger == null) {
741 doppelganger = new NamespaceEntry (ImplicitParent, file, ns, true);
742 doppelganger.using_aliases = using_aliases;
748 public Namespace NS {
752 public NamespaceEntry Parent {
753 get { return parent; }
756 public NamespaceEntry ImplicitParent {
760 if (implicit_parent == null) {
761 implicit_parent = (parent.NS == ns.Parent)
763 : new NamespaceEntry (parent, file, ns.Parent, false);
765 return implicit_parent;
770 /// Records a new namespace for resolving name references
772 public void AddUsing (MemberName name, Location loc)
774 if (DeclarationFound){
775 Report.Error (1529, loc, "A using clause must precede all other namespace elements except extern alias declarations");
778 if (using_clauses == null) {
779 using_clauses = new ArrayList ();
781 foreach (UsingEntry old_entry in using_clauses) {
782 if (name.Equals (old_entry.MemberName)) {
783 Report.SymbolRelatedToPreviousError (old_entry.Location, old_entry.GetSignatureForError ());
784 Report.Warning (105, 3, loc, "The using directive for `{0}' appeared previously in this namespace", name.GetSignatureForError ());
790 using_clauses.Add (new UsingEntry (name));
793 public void AddUsingAlias (string alias, MemberName name, Location loc)
795 // TODO: This is parser bussines
796 if (DeclarationFound){
797 Report.Error (1529, loc, "A using clause must precede all other namespace elements except extern alias declarations");
800 if (RootContext.Version != LanguageVersion.ISO_1 && alias == "global")
801 Report.Warning (440, 2, loc, "An alias named `global' will not be used when resolving 'global::';" +
802 " the global namespace will be used instead");
804 AddUsingAlias (new LocalUsingAliasEntry (alias, name, loc));
807 public void AddUsingExternalAlias (string alias, Location loc)
809 // TODO: Do this in parser
810 bool not_first = using_clauses != null || DeclarationFound;
811 if (using_aliases != null && !not_first) {
812 foreach (UsingAliasEntry uae in using_aliases) {
813 if (uae is LocalUsingAliasEntry) {
821 Report.Error (439, loc, "An extern alias declaration must precede all other elements");
823 if (alias == "global") {
824 Error_GlobalNamespaceRedefined (loc);
828 AddUsingAlias (new UsingAliasEntry (alias, loc));
831 void AddUsingAlias (UsingAliasEntry uae)
833 if (using_aliases == null) {
834 using_aliases = new ArrayList ();
836 foreach (UsingAliasEntry entry in using_aliases) {
837 if (uae.Alias == entry.Alias) {
838 Report.SymbolRelatedToPreviousError (uae.Location, uae.Alias);
839 Report.Error (1537, entry.Location, "The using alias `{0}' appeared previously in this namespace",
846 using_aliases.Add (uae);
850 /// Does extension methods look up to find a method which matches name and extensionType.
851 /// Search starts from this namespace and continues hierarchically up to top level.
853 public ExtensionMethodGroupExpr LookupExtensionMethod (Type extensionType, ClassOrStruct currentClass, string name, Location loc)
855 ArrayList candidates = null;
856 if (currentClass != null) {
857 candidates = ns.LookupExtensionMethod (extensionType, currentClass, name, this);
858 if (candidates != null)
859 return new ExtensionMethodGroupExpr (candidates, this, extensionType, loc);
862 foreach (Namespace n in GetUsingTable ()) {
863 ArrayList a = n.LookupExtensionMethod (extensionType, null, name, this);
867 if (candidates == null)
870 candidates.AddRange (a);
873 if (candidates != null)
874 return new ExtensionMethodGroupExpr (candidates, parent, extensionType, loc);
879 return parent.LookupExtensionMethod (extensionType, currentClass, name, loc);
882 public FullNamedExpression LookupNamespaceOrType (DeclSpace ds, string name, Location loc, bool ignore_cs0104)
884 // Precondition: Only simple names (no dots) will be looked up with this function.
885 FullNamedExpression resolved = null;
886 for (NamespaceEntry curr_ns = this; curr_ns != null; curr_ns = curr_ns.ImplicitParent) {
887 if ((resolved = curr_ns.Lookup (ds, name, loc, ignore_cs0104)) != null)
893 static void Error_AmbiguousTypeReference (Location loc, string name, FullNamedExpression t1, FullNamedExpression t2)
895 Report.SymbolRelatedToPreviousError (t1.Type);
896 Report.SymbolRelatedToPreviousError (t2.Type);
897 Report.Error (104, loc, "`{0}' is an ambiguous reference between `{1}' and `{2}'",
898 name, t1.FullName, t2.FullName);
901 // Looks-up a alias named @name in this and surrounding namespace declarations
902 public FullNamedExpression LookupAlias (string name)
904 for (NamespaceEntry n = this; n != null; n = n.ImplicitParent) {
905 if (n.using_aliases == null)
908 foreach (UsingAliasEntry ue in n.using_aliases) {
909 if (ue.Alias == name)
910 return ue.Resolve (Doppelganger);
917 private FullNamedExpression Lookup (DeclSpace ds, string name, Location loc, bool ignore_cs0104)
920 // Check whether it's in the namespace.
922 FullNamedExpression fne = ns.Lookup (ds, name, loc);
929 if (using_aliases != null) {
930 foreach (UsingAliasEntry ue in using_aliases) {
931 if (ue.Alias == name)
932 return ue.Resolve (Doppelganger);
940 // Check using entries.
942 FullNamedExpression match = null;
943 foreach (Namespace using_ns in GetUsingTable ()) {
944 match = using_ns.Lookup (ds, name, loc);
945 if (match == null || !(match is TypeExpr))
949 Error_AmbiguousTypeReference (loc, name, fne, match);
958 Namespace [] GetUsingTable ()
960 if (namespace_using_table != null)
961 return namespace_using_table;
963 if (using_clauses == null) {
964 namespace_using_table = empty_namespaces;
965 return namespace_using_table;
968 ArrayList list = new ArrayList (using_clauses.Count);
970 foreach (UsingEntry ue in using_clauses) {
971 Namespace using_ns = ue.Resolve (Doppelganger);
972 if (using_ns == null)
978 namespace_using_table = (Namespace[])list.ToArray (typeof (Namespace));
979 return namespace_using_table;
982 static readonly string [] empty_using_list = new string [0];
984 public int SymbolFileID {
986 if (symfile_id == 0 && file.SourceFileEntry != null) {
987 int parent_id = parent == null ? 0 : parent.SymbolFileID;
989 string [] using_list = empty_using_list;
990 if (using_clauses != null) {
991 using_list = new string [using_clauses.Count];
992 for (int i = 0; i < using_clauses.Count; i++)
993 using_list [i] = ((UsingEntry) using_clauses [i]).MemberName.GetTypeName ();
996 symfile_id = SymbolWriter.DefineNamespace (ns.Name, file.SourceFileEntry, using_list, parent_id);
1002 static void MsgtryRef (string s)
1004 Console.WriteLine (" Try using -r:" + s);
1007 static void MsgtryPkg (string s)
1009 Console.WriteLine (" Try using -pkg:" + s);
1012 public static void Error_GlobalNamespaceRedefined (Location loc)
1014 Report.Error (1681, loc, "You cannot redefine the global extern alias");
1017 public static void Error_NamespaceNotFound (Location loc, string name)
1019 Report.Error (246, loc, "The type or namespace name `{0}' could not be found. Are you missing a using directive or an assembly reference?",
1023 case "Gtk": case "GtkSharp":
1024 MsgtryPkg ("gtk-sharp");
1027 case "Gdk": case "GdkSharp":
1028 MsgtryPkg ("gdk-sharp");
1031 case "Glade": case "GladeSharp":
1032 MsgtryPkg ("glade-sharp");
1035 case "System.Drawing":
1036 case "System.Web.Services":
1039 case "System.Windows.Forms":
1046 /// Used to validate that all the using clauses are correct
1047 /// after we are finished parsing all the files.
1051 if (using_aliases != null) {
1052 foreach (UsingAliasEntry ue in using_aliases)
1053 ue.Resolve (Doppelganger);
1056 if (using_clauses != null) {
1057 foreach (UsingEntry ue in using_clauses)
1058 ue.Resolve (Doppelganger);
1063 /// Used to validate that all the using clauses are correct
1064 /// after we are finished parsing all the files.
1066 static public void VerifyAllUsing ()
1068 foreach (NamespaceEntry entry in entries)
1069 entry.VerifyUsing ();
1072 public string GetSignatureForError ()
1074 return ns.GetSignatureForError ();
1077 public override string ToString ()
1079 return ns.ToString ();
1082 #region IResolveContext Members
1084 public DeclSpace DeclContainer {
1085 get { return SlaveDeclSpace; }
1088 public bool IsInObsoleteScope {
1089 get { return SlaveDeclSpace.IsInObsoleteScope; }
1092 public bool IsInUnsafeScope {
1093 get { return SlaveDeclSpace.IsInUnsafeScope; }
1096 public DeclSpace GenericDeclContainer {
1097 get { return SlaveDeclSpace; }