src/sys/dotnet/fanx/emit/Emitter.cs
/// <summary>
/// Find the Type instance for this fully qualified type name.
/// </summary>
Find the Type instance for this fully qualified type name.
Find the Type instance for this fully qualified type name .
internal PERWAPI.Type findType(string qname)
    {
      if (qname == "Fan.Sys.Void") qname = "System.Void";
      PERWAPI.Type type = (PERWAPI.Type)types[qname];
      if (type == null)
      {
        string aname = FanUtil.getPodName(qname);
        if (aname == null) aname = "mscorlib";
        if (qname.StartsWith("Fanx.")) aname = "sys";    
        if (qname.EndsWith("Peer")) aname += "Native_";  
        if (aname == assemblyName)
        {
          string[] sn = FanUtil.splitQName(qname);
          ClassDef stub = null;
          if (qname.IndexOf("/") != -1)
          {
            PERWAPI.ClassDef cdef = (PERWAPI.ClassDef)findType(sn[0]);
            stub = cdef.AddNestedClass(PERWAPI.TypeAttr.NestedPublic, sn[1]);
          }
          else
          {
            stub = peFile.AddClass(PERWAPI.TypeAttr.Public, sn[0], sn[1]);
          }
          types[qname] = stub;
          return stub;
        }
        AssemblyRef aref = (AssemblyRef)assemblies[aname];
        if (aref == null)
        {
          aref = peFile.MakeExternAssembly(aname);
          assemblies[aname] = aref;
        }
        string[] s = FanUtil.splitQName(qname);
        if (qname.IndexOf("/") != -1)
        {
          PERWAPI.ClassRef cref = (PERWAPI.ClassRef)findType(s[0]);
          type = cref.AddNestedClass(s[1]);
        }
        else
        {
          , get/add type
          type = aref.GetClass(s[0], s[1]);
          if (type == null) type = aref.AddClass(s[0], s[1]);
        }
        types[qname] = type;
      }
      return type;
    }
internal PERWAPI . Type findType ( string qname ) { if ( qname == " " ) qname = " " ; PERWAPI . Type type = ( PERWAPI . Type ) types [ qname ] ; if ( type == null ) { string aname = FanUtil . getPodName ( qname ) ; if ( aname == null ) aname = " " ; if ( qname . StartsWith ( " " ) ) aname = " " ; if ( qname . EndsWith ( " " ) ) aname += " " ; if ( aname == assemblyName ) { string [ ] sn = FanUtil . splitQName ( qname ) ; ClassDef stub = null ; if ( qname . IndexOf ( " " ) != - 1 ) { PERWAPI . ClassDef cdef = ( PERWAPI . ClassDef ) findType ( sn [ 0 ] ) ; stub = cdef . AddNestedClass ( PERWAPI . TypeAttr . NestedPublic , sn [ 1 ] ) ; } else { stub = peFile . AddClass ( PERWAPI . TypeAttr . Public , sn [ 0 ] , sn [ 1 ] ) ; } types [ qname ] = stub ; return stub ; } AssemblyRef aref = ( AssemblyRef ) assemblies [ aname ] ; if ( aref == null ) { aref = peFile . MakeExternAssembly ( aname ) ; assemblies [ aname ] = aref ; } string [ ] s = FanUtil . splitQName ( qname ) ; if ( qname . IndexOf ( " " ) != - 1 ) { PERWAPI . ClassRef cref = ( PERWAPI . ClassRef ) findType ( s [ 0 ] ) ; type = cref . AddNestedClass ( s [ 1 ] ) ; } else { type = aref . GetClass ( s [ 0 ] , s [ 1 ] ) ; if ( type == null ) type = aref . AddClass ( s [ 0 ] , s [ 1 ] ) ; } types [ qname ] = type ; } return type ; }
Find the Type instance for this fully qualified type name.
Find the Type instance for this fully qualified type name .
// Always convert voids to native // hack for support classes // TODO // first check if this is a type in this pod that // hasn't been defined yet // stub out type - fill get filled in later (we hope) // Nested class // Normal class // Nested class /*
        else if (qname.IndexOf("<") != -1)
        {
          // Generic type
          //if (type == null) type = aref.AddClass(s[0], s[1]);
          PERWAPI.ClassRef cref = (PERWAPI.ClassRef)findType(s[0]);
          cref.SetGenericParams(new GenericParam[] { cref.GetGenericParam(0) });
          type = cref;
        }
        */ // Normal class, get/add type
qname
string