private void InitializeClosureDependencies() { foreach (TypedArgument argument in Arguments) { BlockExpression closure = argument.Expression as BlockExpression; if (closure == null) { continue; } // ICallableType callableType = closure.ExpressionType as ICallableType; ICallableType callableType = argument.FormalType as ICallableType; if (callableType == null) { continue; } TypeCollector collector = new TypeCollector(delegate(IType t) { IGenericParameter gp = t as IGenericParameter; return(gp != null && InferredTypes.ContainsKey(gp)); }); foreach (IType inputType in GetParameterTypes(callableType.GetSignature())) { collector.Visit(inputType); } foreach (IGenericParameter gp in collector.Matches) { RecordClosureDependency(closure, gp); } } }
private IEnumerable <IGenericParameter> FindGenericParameters(IType type) { foreach (IGenericParameter gp in GenericsServices.FindGenericParameters(type)) { if (!InferredTypes.ContainsKey(gp)) { continue; } yield return(gp); } }