(Node node)
| 179 | } |
| 180 | |
| 181 | @Override |
| 182 | public void visit(Node node) throws ELException { |
| 183 | if (node instanceof AstFunction funcNode) { |
| 184 | |
| 185 | Method m = null; |
| 186 | |
| 187 | if (this.fnMapper != null) { |
| 188 | m = fnMapper.resolveFunction(funcNode.getPrefix(), funcNode.getLocalName()); |
| 189 | } |
| 190 | |
| 191 | // References to variables that refer to lambda expressions will be |
| 192 | // parsed as functions. This is handled at runtime but at this point |
| 193 | // need to treat it as a variable rather than a function. |
| 194 | if (m == null && this.varMapper != null && funcNode.getPrefix().isEmpty()) { |
| 195 | this.varMapper.resolveVariable(funcNode.getLocalName()); |
| 196 | return; |
| 197 | } |
| 198 | |
| 199 | if (this.fnMapper == null) { |
| 200 | throw new ELException(MessageFactory.get("error.fnMapper.null")); |
| 201 | } |
| 202 | |
| 203 | if (m == null) { |
| 204 | throw new ELException(MessageFactory.get("error.fnMapper.method", funcNode.getOutputName())); |
| 205 | } |
| 206 | |
| 207 | int methodParameterCount = m.getParameterTypes().length; |
| 208 | // AstFunction->MethodParameters->Parameters() |
| 209 | int inputParameterCount = node.jjtGetChild(0).jjtGetNumChildren(); |
| 210 | if (m.isVarArgs() && inputParameterCount < methodParameterCount - 1 || |
| 211 | !m.isVarArgs() && inputParameterCount != methodParameterCount) { |
| 212 | throw new ELException(MessageFactory.get("error.fnMapper.paramcount", funcNode.getOutputName(), |
| 213 | "" + methodParameterCount, "" + node.jjtGetChild(0).jjtGetNumChildren())); |
| 214 | } |
| 215 | } else if (node instanceof AstIdentifier && this.varMapper != null) { |
| 216 | String variable = node.getImage(); |
| 217 | |
| 218 | // simply capture it |
| 219 | this.varMapper.resolveVariable(variable); |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Creates a ValueExpression from the parsed expression. |
nothing calls this directly
no test coverage detected