File tree Expand file tree Collapse file tree 2 files changed +50
-10
lines changed
main/java/org/exist/xquery Expand file tree Collapse file tree 2 files changed +50
-10
lines changed Original file line number Diff line number Diff line change @@ -262,16 +262,20 @@ public boolean equals(final Object obj) {
262
262
if (obj == null || !(obj instanceof FunctionSignature )) {
263
263
return false ;
264
264
}
265
-
266
- final FunctionSignature other = (FunctionSignature )obj ;
267
- if (name == null ) {
268
- if (other .name != null ) {
269
- return false ;
270
- }
271
- return getArgumentCount () == other .getArgumentCount ();
265
+ // quick comparison by object identity
266
+ if (this == obj ) { return true ; }
267
+
268
+ // anonymous functions cannot be compared by name and argument count
269
+ final FunctionSignature other = (FunctionSignature ) obj ;
270
+ if (
271
+ name == null || other .name == null ||
272
+ name .getLocalPart ().equals ("" ) ||
273
+ other .name .getLocalPart ().equals ("" )
274
+ ) {
275
+ return false ;
272
276
}
273
-
274
- if (name .equals (other .name )) {
277
+
278
+ if (name .equals (other .name )) {
275
279
return getArgumentCount () == other .getArgumentCount ();
276
280
}
277
281
Original file line number Diff line number Diff line change @@ -49,6 +49,16 @@ declare variable $mt:integerKeys := map {
49
49
7 : "Saturday"
50
50
};
51
51
52
+ declare variable $mt:places := map {
53
+ "Scotland" : map {
54
+ "Highlands" : map {
55
+ "Inverness" : 1 ,
56
+ "Fort William" : 1
57
+ },
58
+ "Lowlands" : map { "Glasgow" : 1 }
59
+ }
60
+ };
61
+
52
62
declare variable $mt:mapOfSequences := map {0 : (), 1 : ("One" , "Two" ) };
53
63
54
64
declare
@@ -720,7 +730,7 @@ function mt:single-entry-map() {
720
730
map:for-each ($map, function ($k, $v) { $k })
721
731
};
722
732
723
- declare
733
+ declare
724
734
%test:assertEquals(5 )
725
735
function mt:qname () {
726
736
let $a := 1
@@ -989,3 +999,29 @@ function mt:map-merge-2-empty-options-map() {
989
999
let $actual := map:merge ($maps, map {})
990
1000
return $expected?Su eq $actual?Su
991
1001
};
1002
+
1003
+ (: test for issue https://github.com/eXist-db/exist/issues/5685 :)
1004
+ declare
1005
+ %test:assertEquals("<ul><li>Scotland<ul><li>Highlands<ul><li>Fort William</li><li>Inverness</li></ul></li><li>Lowlands<ul><li>Glasgow</li></ul></li></ul></li></ul>" )
1006
+ function mt:nested-map-for-each () {
1007
+ <ul>{
1008
+ map:for-each ($mt:places, function ($country-key, $region-map) {
1009
+ <li>{
1010
+ $country-key,
1011
+ <ul>{
1012
+ map:for-each ($region-map, function ($region-key, $town-map) {
1013
+ <li>{
1014
+ $region-key,
1015
+ <ul>{
1016
+ map:for-each ($town-map, function ($town-key, $town-value) {
1017
+ <li>{ $town-key }</li>
1018
+ })
1019
+ }</ul>
1020
+ }</li>
1021
+ })
1022
+ }</ul>
1023
+ }</li>
1024
+ })
1025
+ }</ul>
1026
+ => serialize (map{'indent' :false ()})
1027
+ };
You can’t perform that action at this time.
0 commit comments