////////////////////////////////////////////////////////////////////////// // Load ////////////////////////////////////////////////////////////////////////// internal void load(FPod fpod) { this.fpod = fpod; this.typesByName = new Hashtable(); // create a hollow Type for each FType (this requires two steps, // because we don't necessary have all the Types created for // superclasses until this loop completes) m_types = new ClassType[fpod.m_types.Length]; for (int i=0; i<fpod.m_types.Length; i++) { // create type instance ClassType type = new ClassType(this, fpod.m_types[i]); // add to my data structures m_types[i] = type; if (typesByName[type.m_name] != null) throw Err.make("Invalid pod: " + m_name + " type already defined: " + type.m_name).val; typesByName[type.m_name] = type; } // get TypeType to use for mixin List (we need to handle case // when loading sys itself - and lookup within my own pod) Type typeType = Sys.TypeType; if (typeType == null) typeType = (Type)typesByName["Type"]; // now that everthing is mapped, we can fill in the super // class fields (unless something is wacked, this will only // use Types in my pod or in pods already loaded) for (int i=0; i<fpod.m_types.Length; i++) { FType ftype = fpod.m_types[i]; ClassType type = m_types[i]; type.m_base = findType(ftype.m_base); List mixins = new List(typeType, ftype.m_mixins.Length); for (int j=0; j<ftype.m_mixins.Length; j++) mixins.add(findType(ftype.m_mixins[j])); type.m_mixins = mixins.ro(); } }
private static ClassType initGeneric(int ch) { string name = ""+(char)ch; try { return m_genericParamTypes[ch] = new ClassType(m_sysPod, name, 0, null); } catch (Exception e) { throw initFail("generic " + name, e); } }