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); }
public void AddInput(DynamicMetaObject value, ParameterInferer inferer) { _mappings.Add(inferer); _inputs.Add(value); }