public override FullNamedExpression LookupNamespaceOrType (string name, int arity, LookupMode mode, Location loc)
{
FullNamedExpression e;
if (arity == 0 && Cache.TryGetValue (name, out e) && mode != LookupMode.IgnoreAccessibility)
return e;
e = null;
if (arity == 0) {
var tp = CurrentTypeParameters;
if (tp != null) {
TypeParameter tparam = tp.Find (name);
if (tparam != null)
e = new TypeParameterExpr (tparam, Location.Null);
}
}
if (e == null) {
TypeSpec t = LookupNestedTypeInHierarchy (name, arity);
if (t != null && (t.IsAccessible (this) || mode == LookupMode.IgnoreAccessibility))
e = new TypeExpression (t, Location.Null);
else {
var errors = Compiler.Report.Errors;
e = Parent.LookupNamespaceOrType (name, arity, mode, loc);
// TODO: LookupNamespaceOrType does more than just lookup. The result
// cannot be cached or the error reporting won't happen
if (errors != Compiler.Report.Errors)
return e;
}
}
// TODO MemberCache: How to cache arity stuff ?
if (arity == 0 && mode == LookupMode.Normal)
Cache[name] = e;
return e;
}