private void ImplementMixinMethods()
        {
            IEnumerable <Type> mixinTypes = this.mixinsModel.GetMixinTypes();

            foreach (Type mixinType in mixinTypes)
            {
                foreach (MethodInfo method in mixinType.GetMethods())
                {
                    MixinModel mixinModel = this.mixinsModel.ImplementMethod(method);

                    MethodConcernsModel methodConcernsModel      = this.concernsModel.ConcernsFor(method, mixinType);
                    MethodConcernsModel mixinMethodConcernsModel = mixinModel.ConcernsFor(method, mixinType);
                    methodConcernsModel = methodConcernsModel.CombineWith(mixinMethodConcernsModel);

                    MethodSideEffectsModel methodSideEffectsModel      = this.sideEffectsModel.SideEffectsFor(method, mixinType);
                    MethodSideEffectsModel mixinMethodSideEffectsModel = mixinModel.SideEffectsFor(method, mixinType);
                    methodSideEffectsModel = methodSideEffectsModel.CombineWith(mixinMethodSideEffectsModel);

                    var methodConstraintsModel = new MethodConstraintsModel(method, this.constraintsModel);

                    var compositeMethodModel = new CompositeMethodModel(methodConstraintsModel, methodConcernsModel, methodSideEffectsModel, this.mixinsModel);
                    this.methods.Add(method, compositeMethodModel);
                }

                foreach (PropertyInfo property in mixinType.GetProperties())
                {
                    this.properties.Add(property);
                }
            }
        }
Example #2
0
        private MixinModel ImplementMethodWithType(MethodInfo method, Type mixinType)
        {
            MixinModel foundMixinModel = null;

            foreach (MixinModel mixinModel in this.mixinModels)
            {
                if (mixinModel.MixinType.Equals(mixinType))
                {
                    foundMixinModel = mixinModel;
                    break;
                }
            }

            if (foundMixinModel == null)
            {
                foundMixinModel = new MixinModel(mixinType);
                this.mixinModels.Add(foundMixinModel);
            }

            this.methodImplementation.Add(method, foundMixinModel);
            this.MethodIndex.Add(method, this.mixinModels.IndexOf(foundMixinModel));

            return(foundMixinModel);
        }
Example #3
0
        private MixinModel ImplementMethodWithType(MethodInfo method, Type mixinType)
        {
            MixinModel foundMixinModel = null;

            foreach (MixinModel mixinModel in this.mixinModels)
            {
                if (mixinModel.MixinType.Equals(mixinType))
                {
                    foundMixinModel = mixinModel;
                    break;
                }
            }

            if (foundMixinModel == null)
            {
                foundMixinModel = new MixinModel(mixinType);
                this.mixinModels.Add(foundMixinModel);
            }

            this.methodImplementation.Add(method, foundMixinModel);
            this.MethodIndex.Add(method, this.mixinModels.IndexOf(foundMixinModel));

            return foundMixinModel;
        }