Example #1
0
        public ValueModel GetValueModelFor(Type mixinType, Visibility visibility)
        {
            ValueModel foundModel = null;

            foreach (ValueModel composite in this.valueModels)
            {
                if (typeof(ValueComposite).IsAssignableFrom(mixinType))
                {
                    if (mixinType == composite.CompositeType && composite.Visibility == visibility)
                    {
                        if (foundModel != null)
                        {
                            throw new AmbiguousTypeException(mixinType, foundModel.CompositeType, composite.CompositeType);
                        }

                        foundModel = composite;
                    }
                }
                else
                {
                    if (mixinType.IsAssignableFrom(composite.CompositeType) && composite.Visibility == visibility)
                    {
                        if (foundModel != null)
                        {
                            throw new AmbiguousTypeException(mixinType, foundModel.CompositeType, composite.CompositeType);
                        }
                        foundModel = composite;
                    }
                }
            }

            return(foundModel);
        }
Example #2
0
 public void AddValues(List <ValueModel> values, PropertyDeclarations propertyDecs)
 {
     foreach (Type compositeType in this.CompositeTypes)
     {
         ValueModel valueModel = ValueModel.NewModel(compositeType,
                                                     this.visibility,
                                                     new MetaInfo(this.metaInfo).WithAnnotations(compositeType),
                                                     propertyDecs,
                                                     this.concerns,
                                                     this.sideEffects,
                                                     this.mixins);
         values.Add(valueModel);
     }
 }
Example #3
0
 public ValueInstance(ValueModel valueModel, ModuleInstance moduleInstance, object[] mixins, StateHolder state)
     : base(valueModel, moduleInstance, mixins, state)
 {
 }
Example #4
0
 public ValueInstance(ValueModel valueModel, ModuleInstance moduleInstance, object[] mixins, StateHolder state)
         : base(valueModel, moduleInstance, mixins, state)
 {
 }
Example #5
0
 public ValueBuilderInstance(ModuleInstance moduleInstance, ValueModel model)
 {
     this.moduleInstance = moduleInstance;
     this.valueModel     = model;
 }
Example #6
0
 public ValueBuilderInstance(ModuleInstance moduleInstance, ValueModel model, UsesInstance uses)
     : this(moduleInstance, model)
 {
     this.uses = uses;
 }