Skip to content

Commit a2b8ac3

Browse files
committed
[ignore] Add toString to help with debugging
1 parent b9f58ad commit a2b8ac3

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

exist-core/src/main/java/org/exist/xquery/DynamicFunctionCall.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,31 @@ public void resetState(final boolean postOptimization) {
117117
functionExpr.resetState(postOptimization);
118118
arguments.forEach(arg -> arg.resetState(postOptimization));
119119
}
120+
121+
@Override
122+
public String toString() {
123+
final StringBuilder builder = new StringBuilder();
124+
if (functionExpr != null) {
125+
builder.append(functionExpr);
126+
} else {
127+
builder.append("DynamicFunctionCall{arguments=");
128+
}
129+
130+
builder.append('(');
131+
if (arguments != null) {
132+
for (int i = 0; i < arguments.size(); i++) {
133+
if (i > 0) {
134+
builder.append(", ");
135+
}
136+
builder.append(arguments.get(i).toString());
137+
}
138+
}
139+
builder.append(')');
140+
141+
if (functionExpr == null) {
142+
builder.append('}');
143+
}
144+
145+
return builder.toString();
146+
}
120147
}

exist-core/src/main/java/org/exist/xquery/value/FunctionReference.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,9 @@ public AtomicValue min(Collator collator, AtomicValue other)
170170
public AtomicValue atomize() throws XPathException {
171171
throw new XPathException(ErrorCodes.FOTY0013, "A function item other than an array cannot be atomized");
172172
}
173+
174+
@Override
175+
public String toString() {
176+
return "anonymous-function#" + functionCall.getArgumentCount();
177+
}
173178
}

0 commit comments

Comments
 (0)