src/sys/dotnet/fan/sys/GenericType.cs
/// <summary>
/// Parameterize the specified method (reuse if generic
/// parameterization isn't necessary).
/// </summary>
Parameterize the specified method (reuse if generic
parameterization isn't necessary).
Parameterize the specified method ( reuse if generic parameterization isn ' t necessary ) .
internal Method parameterize(Method m)
    {
      if (!m.isGenericMethod()) return m;
      Func func = m.m_func;
      Type ret;
      List pars = new List(Sys.ParamType, m.m_params.sz());
      if (func.returns().isGenericParameter())
        ret = parameterize(func.returns());
      else
        ret = func.returns();
      for (int i=0; i<m.m_params.sz(); i++)
      {
        Param p = (Param)m.m_params.get(i);
        if (p.m_type.isGenericParameter())
        {
          pars.add(new Param(p.m_name, parameterize(p.m_type), p.m_mask));
        }
        else
        {
          pars.add(p);
        }
      }
      Method pm = new Method(this, m.m_name, m.m_flags, m.m_facets, m.m_lineNum, ret, m.m_inheritedReturns, pars, m);
      pm.m_reflect = m.m_reflect;
      return pm;
    }
internal Method parameterize ( Method m ) { if ( ! m . isGenericMethod ( ) ) return m ; Func func = m . m_func ; Type ret ; List pars = new List ( Sys . ParamType , m . m_params . sz ( ) ) ; if ( func . returns ( ) . isGenericParameter ( ) ) ret = parameterize ( func . returns ( ) ) ; else ret = func . returns ( ) ; for ( int i = 0 ; i < m . m_params . sz ( ) ; i ++ ) { Param p = ( Param ) m . m_params . get ( i ) ; if ( p . m_type . isGenericParameter ( ) ) { pars . add ( new Param ( p . m_name , parameterize ( p . m_type ) , p . m_mask ) ) ; } else { pars . add ( p ) ; } } Method pm = new Method ( this , m . m_name , m . m_flags , m . m_facets , m . m_lineNum , ret , m . m_inheritedReturns , pars , m ) ; pm . m_reflect = m . m_reflect ; return pm ; }
Parameterize the specified method (reuse if generic
parameterization isn't necessary).
Parameterize the specified method ( reuse if generic parameterization isn ' t necessary ) .
// if not generic, short circuit and reuse original // new signature // parameterize return type // narrow pars (or just reuse if not parameterized)
m
Method