Skip to content

Commit 70466e5

Browse files
[MOD] Adaptive serialization: more flexibility for function items
1 parent b78375a commit 70466e5

3 files changed

Lines changed: 73 additions & 104 deletions

File tree

basex-core/src/main/java/org/basex/io/serial/AdaptiveSerializer.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,7 @@ protected final void function(final FItem item) throws IOException {
145145
} else if(item instanceof final XQMap map) {
146146
map(map);
147147
} else {
148-
if(this instanceof BaseXSerializer) {
149-
printChars(Token.token(item.toErrorString()));
150-
} else {
151-
final QNm fn = item.funcName();
152-
if(fn == null) printChars(Token.token("(anonymous-function)"));
153-
else printChars(fn.prefixId());
154-
printChar('#');
155-
printChars(Token.token(item.arity()));
156-
}
148+
printChars(Token.token(item.toErrorString()));
157149
}
158150
}
159151

basex-core/src/test/java/org/basex/query/SerializerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public final class SerializerTest extends SandboxTest {
271271
query(option + "xs:dayTimeDuration('P1D')", "xs:duration(\"P1D\")");
272272
query(option + "<xml><a>B</a></xml>", "<xml><a>B</a></xml>");
273273
query(option + "true#0", "fn:true#0");
274-
query(option + "fn() {}", "(anonymous-function)#0");
274+
query(option + "fn() {}", "fn() as empty-sequence() { () }");
275275
query(option + "xs:float(1)", "xs:float(\"1\")");
276276

277277
query(option + "[]", "[]");
@@ -290,7 +290,7 @@ public final class SerializerTest extends SandboxTest {
290290
query(option + "[ xs:dayTimeDuration('P1D') ]", "[xs:duration(\"P1D\")]");
291291
query(option + "[ <xml><a>B</a></xml> ]", "[<xml><a>B</a></xml>]");
292292
query(option + "[ true#0 ]", "[fn:true#0]");
293-
query(option + "[ fn() {} ]", "[(anonymous-function)#0]");
293+
query(option + "[ fn() {} ]", "[fn() as empty-sequence() { () }]");
294294
query(option + "[ xs:float(1) ]", "[xs:float(\"1\")]");
295295

296296
query(option + "{ 1: (), 2: 3, 4: (5, 6) }", "{1:(),2:3,4:(5,6)}");

0 commit comments

Comments
 (0)