private static Expression TryParseBinary(Method context, string[] parts) { var left = MethodExpressionParser.TryParse(context, parts[0]) ?? throw new MethodExpressionParser.UnknownExpression(context, parts[0]); var binaryOperator = parts[1]; var right = MethodExpressionParser.TryParse(context, parts[2]) ?? throw new MethodExpressionParser.UnknownExpression(context, parts[2]); return(new Binary(left, left.ReturnType.Methods.First(m => m.Name == binaryOperator), right)); }
private static Expression[] GetArguments(Method context, string[] parts, string methodName) { var arguments = new Expression[parts.Length - 1]; for (int i = 0; i < parts.Length - 1; i++) { arguments[i] = MethodExpressionParser.TryParse(context, parts[i + 1]) ?? throw new MethodExpressionParser.UnknownExpression(context, parts[i] + " for " + methodName); } return(arguments); }