/// <summary> /// Registers an assembly, allowing all classes in this assembly to be /// used from Iodine. /// </summary> /// <param name="assembly">The assembly.</param> public void RegisterAssembly(Assembly assembly) { var classes = assembly.GetExportedTypes().Where(p => p.IsClass || p.IsValueType || p.IsInterface); foreach (Type type in classes) { if (type.Namespace != "") { string moduleName = type.Namespace.Contains(".") ? type.Namespace.Substring(type.Namespace.LastIndexOf(".") + 1) : type.Namespace; IodineModule module = null; if (!modules.ContainsKey(type.Namespace)) { #warning This needs fixed //module = new IodineModule (moduleName); modules [type.Namespace] = module; } else { module = modules [type.Namespace]; } ClassWrapper wrapper = ClassWrapper.CreateFromType(typeRegistry, type, type.Name); module.SetAttribute(type.Name, wrapper); typeRegistry.AddTypeMapping(type, wrapper, null); } } }
public override void Accept(ClassDeclaration classDecl) { module.SetAttribute(classDecl.Name, CompileClass(classDecl)); }