// There will be a "finalize" pass over the completed expression tree to finish specifying any remaining "generics".
// DO use the type chosen by HSQL for the parameterized function as a specific type hint
// for numeric constant arguments that could either go decimal or float.
AbstractExpression param_arg = m_args.get(m_parameterArg);
VoltType param_type = param_arg.getValueType();
VoltType value_type = getValueType();
// The heuristic for which type to change is that any type (parameter type or return type) specified so far,
// including NUMERIC is better than nothing. And that anything else is better than NUMERIC.
if (value_type != param_type) {
if (value_type == null) {
value_type = param_type;
} else if (value_type == VoltType.NUMERIC) {
if (param_type != null) {
value_type = param_type;
}
// Pushing a type DOWN to the argument is a lot like work, and not worth it just to
// propagate down a known NUMERIC return type,
// since it will just have to be re-specialized when a more specific type is inferred from
// the context or finalized when the expression is complete.
} else if ((param_type == null) || (param_type == VoltType.NUMERIC)) {
// The only purpose of refining the parameter argument's type is to force a more specific
// refinement than NUMERIC as implied by HSQL, in case that might be more specific than
// what can be be inferred later from the function call context.
param_arg.refineValueType(value_type, value_type.getMaxLengthInBytes());
}
}
if (value_type != null) {
setValueType(value_type);
setValueSize(value_type.getMaxLengthInBytes());
}
}