Mono.CSharp.TypeContainer.LookupNamespaceOrType C# (CSharp) Method

LookupNamespaceOrType() public method

public LookupNamespaceOrType ( string name, int arity, Location loc, bool ignore_cs0104 ) : FullNamedExpression
name string
arity int
loc Location
ignore_cs0104 bool
return FullNamedExpression
		public override FullNamedExpression LookupNamespaceOrType (string name, int arity, Location loc, bool ignore_cs0104)
		{
			FullNamedExpression e;
			if (arity == 0 && Cache.TryGetValue (name, out e))
				return e;

			e = null;
			int errors = Report.Errors;

			if (arity == 0) {
				TypeParameter[] tp = CurrentTypeParameters;
				if (tp != null) {
					TypeParameter tparam = TypeParameter.FindTypeParameter (tp, name);
					if (tparam != null)
						e = new TypeParameterExpr (tparam, Location.Null);
				}
			}

			if (e == null) {
				TypeSpec t = LookupNestedTypeInHierarchy (name, arity);

				if (t != null)
					e = new TypeExpression (t, Location.Null);
				else if (Parent != null) {
					e = Parent.LookupNamespaceOrType (name, arity, loc, ignore_cs0104);
				} else
					e = NamespaceEntry.LookupNamespaceOrType (name, arity, loc, ignore_cs0104);
			}

			// TODO MemberCache: How to cache arity stuff ?
			if (errors == Report.Errors && arity == 0)
				Cache[name] = e;

			return e;
		}

Usage Example

Example #1
0
 public virtual FullNamedExpression LookupNamespaceOrType(string name, int arity, LookupMode mode, Location loc)
 {
     if (Parent != null) {
         return Parent.LookupNamespaceOrType (name, arity, mode, loc);
     } else {
         return null;
     }
 }
All Usage Examples Of Mono.CSharp.TypeContainer::LookupNamespaceOrType