private Type[] tests(Pod pod, string testName) { // named test if (testName != "*") { return new Type[] { pod.type(testName, true) } } ; // all types which subclass Test List all = pod.types(); ArrayList acc = new ArrayList(); for (int i = 0; i < all.sz(); i++) { Type x = (Type)all.get(i); if (x.@is(Sys.TestType) && !x.isAbstract()) { acc.Add(x); } } return((Type[])acc.ToArray(System.Type.GetType("Fan.Sys.Type"))); }
public static Assembly emitPod(FPod pod, bool load, string path) { string podName = pod.m_podName; Assembly assembly = (Assembly)assemblies[podName]; if (assembly == null) { Emitter emitter = new Emitter(podName, path); // unzip the native.dll if one exists unzipToTemp(pod, podName + "Native_.dll"); unzipToTemp(pod, podName + "Native_.pdb"); // emit the pod class itself (which declares all constants) //FPodEmit.EmitAndLoad(emitter, pod); FPodEmit.emit(emitter, pod); // the Emitter needs base types to be defined before // descendant types, so make sure everything gets stubbed // out in the correct order ahead of time for (int i = 0; i < pod.m_types.Length; i++) { emitter.findType(pod.nname(pod.m_types[i].m_self)); } // emit all the rest of the types in this pod for (int i = 0; i < pod.m_types.Length; i++) { FType ftype = pod.m_types[i]; FTypeRef tref = ftype.m_pod.typeRef(ftype.m_self); Type parent = Type.find(tref.podName + "::" + tref.typeName, true); // make sure we have reflected to setup slots parent.reflect(); // route based on type if ((ftype.m_flags & FConst.Mixin) != 0) { // interface FMixinInterfaceEmit iemit = new FMixinInterfaceEmit(emitter, parent, ftype); iemit.emit(); // body class FMixinBodyEmit bemit = new FMixinBodyEmit(emitter, parent, ftype); bemit.emit(); ftypes[ftype] = new FTypeEmit[] { iemit, bemit }; } else if (parent.@is(Sys.ErrType)) { // error FErrEmit emitErr = new FErrEmit(emitter, parent, ftype); emitErr.emit(); FErrValEmit emitErrVal = new FErrValEmit(emitter, parent, ftype); emitErrVal.emit(); ftypes[ftype] = new FTypeEmit[] { emitErr, emitErrVal }; } else { // class FClassEmit emit = new FClassEmit(emitter, parent, ftype); emit.emit(); ftypes[ftype] = new FTypeEmit[] { emit }; } } // commit assembly byte[] buf = emitter.commit(); if (load) { //long start = System.Environment.TickCount; // load assembly assembly = (buf == null) ? Assembly.LoadFile(emitter.fileName) : Assembly.Load(buf); assemblies[podName] = assembly; //long end = System.Environment.TickCount; //System.Console.WriteLine("load " + podName + " in " + (end-start) + " ms"); // load $Pod type FPodEmit.load(assembly, pod); } } return(assembly); }