+ //
+ // Different context is needed when resolving type container base
+ // types. Type names come from the parent scope but type parameter
+ // names from the container scope.
+ //
+ struct BaseContext : IMemberContext
+ {
+ TypeContainer tc;
+
+ public BaseContext (TypeContainer tc)
+ {
+ this.tc = tc;
+ }
+
+ #region IMemberContext Members
+
+ public CompilerContext Compiler {
+ get { return tc.Compiler; }
+ }
+
+ public Type CurrentType {
+ get { return tc.Parent.CurrentType; }
+ }
+
+ public TypeParameter[] CurrentTypeParameters {
+ get { return tc.PartialContainer.CurrentTypeParameters; }
+ }
+
+ public TypeContainer CurrentTypeDefinition {
+ get { return tc.Parent.CurrentTypeDefinition; }
+ }
+
+ public bool IsObsolete {
+ get { return tc.IsObsolete; }
+ }
+
+ public bool IsUnsafe {
+ get { return tc.IsUnsafe; }
+ }
+
+ public bool IsStatic {
+ get { return tc.IsStatic; }
+ }
+
+ public string GetSignatureForError ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public ExtensionMethodGroupExpr LookupExtensionMethod (Type extensionType, string name, Location loc)
+ {
+ return null;
+ }
+
+ public FullNamedExpression LookupNamespaceAlias (string name)
+ {
+ return tc.Parent.LookupNamespaceAlias (name);
+ }
+
+ public FullNamedExpression LookupNamespaceOrType (string name, Location loc, bool ignore_cs0104)
+ {
+ TypeParameter[] tp = CurrentTypeParameters;
+ if (tp != null) {
+ TypeParameter t = TypeParameter.FindTypeParameter (tp, name);
+ if (t != null)
+ return new TypeParameterExpr (t, loc);
+ }
+
+ return tc.Parent.LookupNamespaceOrType (name, loc, ignore_cs0104);
+ }
+
+ #endregion
+ }
+