@Override
    public StringBuilder toString(StringBuilder string, SerializationContext context, Deque<String> path, CompositeNode parent) {
        // A reference to an identifier (function argument or bound variable)?
        if (reference.isIdentifier() && context.getBinding(getName()) != null) {
            // a bound identifier: replace by the value it is bound to
            return string.append(context.getBinding(getName()));
        }

        // A reference to a function?
        ExpressionFunction function = context.getFunction(getName());
        if (!isFeatureArgument && function != null && function.arguments().size() == getArguments().size() && getOutput() == null) {
            // a function reference: replace by the referenced function wrapped in rankingExpression
            if (path == null)
                path = new ArrayDeque<>();
            String myPath = getName() + getArguments().expressions();
            if (path.contains(myPath))
                throw new IllegalArgumentException("Cycle in ranking expression function '" + getName() + "' called from: " + path);
            path.addLast(myPath);

            String functionName = getName();
            boolean needSerialization = (!getArguments().isEmpty()) || context.needSerialization(functionName);

            if ( needSerialization ) {
                ExpressionFunction.Instance instance = function.expand(context, getArguments().expressions(), path);
                functionName = instance.getName();
                context.addFunctionSerialization(RankingExpression.propertyName(functionName), instance.getExpressionString());
                for (Map.Entry<String, TensorType> argumentType : function.argumentTypes().entrySet())
                    context.addArgumentTypeSerialization(functionName, argumentType.getKey(), argumentType.getValue());
                if (function.returnType().isPresent())
                    context.addFunctionTypeSerialization(functionName, function.returnType().get());
            }
            path.removeLast();
            return string.append(wrapInRankingExpression(functionName));
        }

        // Not resolved in this context: output as-is
        return reference.toString(string, context, path, parent);
    }
Returns an empty list as this has no children
searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/rule/ReferenceNode.java