private IAstTypeReference GetTypeFromUsage(IAstElement parent, AstParameterReference parameter) { if (parent is AstReturnStatement || parent is AstLambdaExpression) { return(null); } var binary = parent as BinaryExpression; if (binary != null) { var argumentIndex = binary.Left == parameter ? 0 : 1; return(binary.Operator.ParameterTypes.ElementAt(argumentIndex)); } var call = parent as CallExpression; if (call != null) { var argumentIndex = call.Arguments.IndexOf(parameter); return(call.Callee.ParameterTypes.ElementAt(argumentIndex)); } throw new NotImplementedException("InferParameterTypes: Can not collect parameter type from usage in " + parent); }
protected override void AppendParameterReference(StringBuilder builder, AstParameterReference parameter) { builder.Append("(parameter) "); AppendParameterDefinition(builder, parameter.Parameter); }
protected virtual void AppendParameterReference(StringBuilder builder, AstParameterReference parameterReference) { builder.Append(parameterReference); }