Skip to content

Commit

Permalink
Inline helper function for getCoercion()
Browse files Browse the repository at this point in the history
  • Loading branch information
cberner committed Jan 13, 2015
1 parent a5752c6 commit 0a20886
Showing 1 changed file with 3 additions and 8 deletions.
Expand Up @@ -471,16 +471,11 @@ public FunctionInfo resolveOperator(OperatorType operatorType, List<? extends Ty

public FunctionInfo getCoercion(Type fromType, Type toType)
{
return getExactOperator(OperatorType.CAST, ImmutableList.of(fromType), toType);
}

private FunctionInfo getExactOperator(OperatorType operatorType, List<? extends Type> argumentTypes, Type returnType)
throws OperatorNotFoundException
{
FunctionInfo functionInfo = getExactFunction(Signature.internalOperator(operatorType.name(), returnType.getTypeSignature(), Lists.transform(argumentTypes, Type::getTypeSignature)));
List<? extends Type> argumentTypes = ImmutableList.of(fromType);
FunctionInfo functionInfo = getExactFunction(Signature.internalOperator(OperatorType.CAST.name(), toType.getTypeSignature(), Lists.transform(argumentTypes, Type::getTypeSignature)));

if (functionInfo == null) {
throw new OperatorNotFoundException(operatorType, argumentTypes, returnType);
throw new OperatorNotFoundException(OperatorType.CAST, argumentTypes, toType);
}
return functionInfo;
}
Expand Down

0 comments on commit 0a20886

Please sign in to comment.