@Override public String resolve(FunctionNode node) { ExpressionContext instance = ExpressionContext.getInstance(); boolean canHandleArrayOperators = instance.isCanHandleArrayOperators(); try { instance.setCanHandleArrayOperators(true); List<ParameterImpl> parameters = getParameters(node); StringBuilder builder = new StringBuilder(node.getName()); builder.append('('); List<Node> arguments = node.getArguments(); for (int i = 0; i < arguments.size(); i++) { if (i > 0) { builder.append(", "); } String argumentString = getArgumentString(parameters, arguments, i); builder.append(argumentString); } builder.append(')'); return builder.toString(); } finally { instance.setCanHandleArrayOperators(canHandleArrayOperators); } }
protected List<ParameterImpl> getParameters(FunctionNode node) { ProjectData projectData = ProjectData.getCurrentInstance(); for (Function function : projectData.getFunctions()) { if (node.getName().equals(function.getName())) { return function.getParameters(); } } return null; }