X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fmcs%2Fdecl.cs;h=413b1e7ccfa3bd810521f74555fc1828b1042cc1;hb=f282c09a4f474c0994bf739e0b300043fd342b80;hp=83de6262d0330aacdbec3a8e379bfd5e362d6cc4;hpb=8e90ead2207b76f0e41b29d5594dd559ded82532;p=mono.git diff --git a/mcs/mcs/decl.cs b/mcs/mcs/decl.cs index 83de6262d03..413b1e7ccfa 100755 --- a/mcs/mcs/decl.cs +++ b/mcs/mcs/decl.cs @@ -260,6 +260,9 @@ namespace Mono.CSharp { return AdditionResult.Success; } + public static int length; + public static int small; + /// /// Introduce @name into this declaration space and /// associates it with the object @o. Note that for @@ -268,6 +271,13 @@ namespace Mono.CSharp { protected void DefineName (string name, object o) { defined_names.Add (name, o); + +#if DEBUGME + int p = name.LastIndexOf ("."); + int l = name.Length; + length += l; + small += l -p; +#endif } /// @@ -399,6 +409,7 @@ namespace Mono.CSharp { int errors = Report.Errors; Expression d = e.Resolve (type_resolve_ec, ResolveFlags.Type); + if (d == null || d.eclass != ExprClass.Type){ if (!silent && errors == Report.Errors){ Report.Error (246, loc, "Cannot find type `"+ e.ToString () +"'"); @@ -419,6 +430,7 @@ namespace Mono.CSharp { type_resolve_ec = GetTypeResolveEmitContext (parent, loc); Expression d = e.Resolve (type_resolve_ec, ResolveFlags.Type); + if (d == null || d.eclass != ExprClass.Type){ if (!silent){ Report.Error (246, loc, "Cannot find type `"+ e +"'"); @@ -453,7 +465,14 @@ namespace Mono.CSharp { } return t; } - + + public static void Error_AmbiguousTypeReference (Location loc, string name, Type t1, Type t2) + { + Report.Error (104, loc, + String.Format ("`{0}' is an ambiguous reference ({1} or {2}) ", name, + t1.FullName, t2.FullName)); + } + /// /// GetType is used to resolve type names at the DeclSpace level. /// Use this to lookup class/struct bases, interface bases or @@ -466,7 +485,7 @@ namespace Mono.CSharp { /// during the tree resolution process and potentially define /// recursively the type /// - public Type FindType (string name) + public Type FindType (Location loc, string name) { Type t; bool error; @@ -482,7 +501,7 @@ namespace Mono.CSharp { while (current_type != null) { string pre = current_type.FullName; - + t = LookupInterfaceOrClass (pre, name, out error); if (error) return null; @@ -548,7 +567,7 @@ namespace Mono.CSharp { if (match != null){ if (t != null){ - Report.Error (104, Location, "`" + name + "' is an ambiguous reference"); + Error_AmbiguousTypeReference (loc, name, t, match); return null; } @@ -970,8 +989,10 @@ namespace Mono.CSharp { /// void AddMethods (Type type) { - AddMethods (BindingFlags.Static | BindingFlags.Public, type); - AddMethods (BindingFlags.Static | BindingFlags.NonPublic, type); + AddMethods (BindingFlags.Static | BindingFlags.Public | + BindingFlags.FlattenHierarchy, type); + AddMethods (BindingFlags.Static | BindingFlags.NonPublic | + BindingFlags.FlattenHierarchy, type); AddMethods (BindingFlags.Instance | BindingFlags.Public, type); AddMethods (BindingFlags.Instance | BindingFlags.NonPublic, type); }