Fan.Sys.Pod.findType C# (CSharp) Method

findType() private method

private findType ( int qname ) : Type
qname int
return Type
        internal Type findType(int qname)
        {
            if (qname == 0xFFFF || qname == -1) return null;

              // lookup type with typeRef index
              FTypeRef reference = fpod.typeRef(qname);

              // if generic instance, then this type must be used in a method
              // signature, not type meta-data (b/c I can't subclass generic types),
              // so it's safe that my pod has been loaded and is now registered (in
              // case the generic type is parameterized via types in my pod)
              if (reference.isGenericInstance())
            return TypeParser.load(reference.signature, true, this);

              // otherwise I need to handle if I am loading my own pod, because
              // I might not yet be added to the system namespace if I'm just
              // loading my own hollow types
              string podName  = reference.podName;
              string typeName = reference.typeName;
              Pod pod = podName == m_name ? this : doFind(podName, true, null);
              Type type = pod.type(typeName, false);
              if (type != null)
              {
            if (reference.isNullable()) type = type.toNullable();
            return type;
              }

               // handle generic parameter types (for sys pod only)
               if (m_name == "sys")
               {
             type = Sys.genericParamType(typeName);
            if (type != null)
            {
              if (reference.isNullable()) type = type.toNullable();
              return type;
            }
              }

              // lost cause
              throw UnknownTypeErr.make(podName + "::" + typeName).val;
        }

Usage Example

Example #1
0
 public static Facets mapFacets(Pod pod, FAttrs.FFacet[] ffacets)
 {
     if (ffacets == null || ffacets.Length == 0) return empty();
       Hashtable map = new Hashtable();
       for (int i=0; i<ffacets.Length; ++i)
       {
     FAttrs.FFacet ff = ffacets[i];
     Type t = pod.findType(ff.type);
     map[t] = ff.val;
       }
       return new Facets(map);
 }
All Usage Examples Of Fan.Sys.Pod::findType