Ejemplo n.º 1
0
            public Type GetBestType(OverloadResolver resolver, Dictionary <Type, Type> prevConstraints, Dictionary <DynamicMetaObject, BindingRestrictions> restrictions)
            {
                Type curType = null;

                for (int i = 0; i < _mappings.Count; i++)
                {
                    ParameterInferer  inpMapping = _mappings[i];
                    DynamicMetaObject input      = _inputs[i];
                    Type nextType = inpMapping.GetInferedType(resolver, _genericParam, input, prevConstraints, restrictions);

                    if (nextType == null)
                    {
                        // no mapping available
                        return(null);
                    }
                    else if (curType == null || curType.IsAssignableFrom(nextType))
                    {
                        curType = nextType;
                    }
                    else if (!nextType.IsAssignableFrom(curType))
                    {
                        // inconsistent constraint.
                        return(null);
                    }
                    else
                    {
                        curType = nextType;
                    }
                }

                return(curType);
            }
Ejemplo n.º 2
0
 public void AddInput(DynamicMetaObject value, ParameterInferer inferer)
 {
     _mappings.Add(inferer);
     _inputs.Add(value);
 }
Ejemplo n.º 3
0
 public void AddInput(DynamicMetaObject value, ParameterInferer inferer) {
     _mappings.Add(inferer);
     _inputs.Add(value);
 }