return AdditionResult.Success;
}
+ public static int length;
+ public static int small;
+
/// <summary>
/// Introduce @name into this declaration space and
/// associates it with the object @o. Note that for
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
}
/// <summary>
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 () +"'");
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 +"'");
}
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));
+ }
+
/// <summary>
/// GetType is used to resolve type names at the DeclSpace level.
/// Use this to lookup class/struct bases, interface bases or
/// during the tree resolution process and potentially define
/// recursively the type
/// </remarks>
- public Type FindType (string name)
+ public Type FindType (Location loc, string name)
{
Type t;
bool error;
while (current_type != null) {
string pre = current_type.FullName;
-
+
t = LookupInterfaceOrClass (pre, name, out error);
if (error)
return null;
if (match != null){
if (t != null){
- Report.Error (104, Location, "`" + name + "' is an ambiguous reference");
+ Error_AmbiguousTypeReference (loc, name, t, match);
return null;
}
/// </summary>
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);
}