public override MethodGenerator CreateGenerator(
     FieldMetadataFieldBuilderMap instanceFieldBuilders, 
     MethodMetadataFieldBuilderMap methodMetadataFieldBuilders, 
     FieldBuilder dispatcherField)
 {
     return new DuckTypeMethodGenerator(this);
 }
        public override MethodGenerator CreateGenerator(
            FieldMetadataFieldBuilderMap instanceFieldBuilders, 
            MethodMetadataFieldBuilderMap methodMetadataFieldBuilders,
            FieldBuilder dispatcherField)
        {
            var methodInfoField = methodMetadataFieldBuilders[this];

            return new ClassMethodGenerator(this, dispatcherField, methodInfoField);
        }
        public static MethodMetadataFieldBuilderMap Generate(TypeBuilder typeBuilder, TypeMetadata metadata)
        {
            var methodCount = metadata.Methods.Length;

            var methodMetadataFields = new MethodMetadataFieldBuilderMap(methodCount);

            for (var i = 0; i < methodCount; i++)
            {
                var method = metadata.Methods[i];
                var metadataField = method.MetadataField;

                var field = typeBuilder.DefineField(
                    metadataField.Name,
                    metadataField.FieldType,
                    Type.EmptyTypes,
                    Type.EmptyTypes,
                    metadataField.FieldAttributes);

                methodMetadataFields.Add(method, field);
            }

            return methodMetadataFields;
        }
Esempio n. 4
0
 public abstract MethodGenerator CreateGenerator(
     FieldMetadataFieldBuilderMap instanceFieldBuilders, 
     MethodMetadataFieldBuilderMap methodMetadataFieldBuilders,
     FieldBuilder dispatcherField);