예제 #1
0
        public static TypeDef Create(Generator gen, TypeDefinition t, AssemblyDefinition asm)
        {
            Assert(t.Attributes.HasFlag(TypeAttributes.WindowsRuntime));

            TypeDef result;

            if (t.IsEnum)
            {
                result = new EnumDef(t);
            }
            else if (t.IsInterface || TypeHelpers.IsDelegate(t))
            {
                result = new InterfaceDef(t);
            }
            else if (t.IsValueType)
            {
                result = new StructDef(t);
            }
            else if (t.IsClass)
            {
                result = new ClassDef(t);
            }
            else
            {
                throw new NotSupportedException();
            }

            result.Module = gen.GetModule(t.Namespace);
            result.Module.AssignAssembly(asm);
            result.Generator = gen; // TODO: get rid of this
            return(result);
        }
예제 #2
0
        public ClassMethodDef(MethodDef method, ClassDef containingClass, bool isFactory)
        {
            WrappedMethod   = method;
            ContainingClass = containingClass;
            Name            = WrappedMethod.Details.WrappedName;

            AddDependency(method.DeclaringType);
            inputParameters = WrappedMethod.Details.MakeInputParameters(Generator, this);
            outType         = WrappedMethod.Details.MakeOutType(Generator, this, isFactory);
        }