예제 #1
0
        public System.Type Compile(AssemblyGen assembly, ITypeContext context)
        {
            System.Type baseType;
            if (BaseType != null)
            {
                baseType = BaseType.ResolveType(context);
            }
            else
            {
                baseType = typeof(FSObject);
            }
            var generator = assembly.DefineType(Name, baseType, System.Reflection.TypeAttributes.Public, context);

            System.Type[] types = null;
            if (Implements != null)
            {
                types = Implements.Map(impl => impl.ResolveType(context)).AddLast(typeof(IFSObject));
            }
            else
            {
                types = new System.Type[1] {
                    typeof(IFSObject)
                };
            }
            generator.SetInterfaces(types);
            generator.Source = Source;
            generator.SetCustomAttribute(typeof(Runtime.RegisterAttribute), Utils.ReflectionHelpers.Register_Attr_Ctor, new object[] { Name });
            foreach (var member in Members)
            {
                member.CreateMember(generator);
            }
            return(generator.CreateType());
        }
예제 #2
0
 internal AnyClass()
 {
     assembly = new AssemblyGen("FluidScript.Runtime", "1.0");
     typeGen  = assembly.DefineType("Any", typeof(ValueType), TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.AnsiClass | TypeAttributes.BeforeFieldInit, null);
 }