TypeExpr CreateStoreyTypeExpression (EmitContext ec)
{
//
// Create an instance of storey type
//
TypeExpr storey_type_expr;
if (CurrentTypeParameters != null) {
//
// Use current method type parameter (MVAR) for top level storey only. All
// nested storeys use class type parameter (VAR)
//
TypeParameter[] tparams = ec.CurrentAnonymousMethod != null && ec.CurrentAnonymousMethod.Storey != null ?
ec.CurrentAnonymousMethod.Storey.TypeParameters :
ec.CurrentTypeParameters;
TypeArguments targs = new TypeArguments ();
//
// Use type parameter name instead of resolved type parameter
// specification to resolve to correctly nested type parameters
//
for (int i = 0; i < tparams.Length; ++i)
targs.Add (new SimpleName (tparams [i].Name, Location)); // new TypeParameterExpr (tparams[i], Location));
storey_type_expr = new GenericTypeExpr (Definition, targs, Location);
} else {
storey_type_expr = new TypeExpression (CurrentType, Location);
}
return storey_type_expr;
}