@@ -191,7 +191,7 @@ function initSearch(rawSearchIndex) {
191
191
*/
192
192
let searchIndex ;
193
193
let currentResults ;
194
- const ALIASES = Object . create ( null ) ;
194
+ const ALIASES = new Map ( ) ;
195
195
196
196
function isWhitespace ( c ) {
197
197
return " \t\n\r" . indexOf ( c ) !== - 1 ;
@@ -1424,22 +1424,22 @@ function initSearch(rawSearchIndex) {
1424
1424
const aliases = [ ] ;
1425
1425
const crateAliases = [ ] ;
1426
1426
if ( filterCrates !== null ) {
1427
- if ( ALIASES [ filterCrates ] && ALIASES [ filterCrates ] [ lowerQuery ] ) {
1428
- const query_aliases = ALIASES [ filterCrates ] [ lowerQuery ] ;
1427
+ if ( ALIASES . has ( filterCrates ) && ALIASES . get ( filterCrates ) . has ( lowerQuery ) ) {
1428
+ const query_aliases = ALIASES . get ( filterCrates ) . get ( lowerQuery ) ;
1429
1429
for ( const alias of query_aliases ) {
1430
1430
aliases . push ( createAliasFromItem ( searchIndex [ alias ] ) ) ;
1431
1431
}
1432
1432
}
1433
1433
} else {
1434
- Object . keys ( ALIASES ) . forEach ( crate => {
1435
- if ( ALIASES [ crate ] [ lowerQuery ] ) {
1434
+ for ( const [ crate , crateAliasesIndex ] of ALIASES ) {
1435
+ if ( crateAliasesIndex . has ( lowerQuery ) ) {
1436
1436
const pushTo = crate === currentCrate ? crateAliases : aliases ;
1437
- const query_aliases = ALIASES [ crate ] [ lowerQuery ] ;
1437
+ const query_aliases = crateAliasesIndex . get ( lowerQuery ) ;
1438
1438
for ( const alias of query_aliases ) {
1439
1439
pushTo . push ( createAliasFromItem ( searchIndex [ alias ] ) ) ;
1440
1440
}
1441
1441
}
1442
- } ) ;
1442
+ }
1443
1443
}
1444
1444
1445
1445
const sortFunc = ( aaa , bbb ) => {
@@ -2345,17 +2345,22 @@ function initSearch(rawSearchIndex) {
2345
2345
}
2346
2346
2347
2347
if ( aliases ) {
2348
- ALIASES [ crate ] = Object . create ( null ) ;
2348
+ const currentCrateAliases = new Map ( ) ;
2349
+ ALIASES . set ( crate , currentCrateAliases ) ;
2349
2350
for ( const alias_name in aliases ) {
2350
2351
if ( ! hasOwnPropertyRustdoc ( aliases , alias_name ) ) {
2351
2352
continue ;
2352
2353
}
2353
2354
2354
- if ( ! hasOwnPropertyRustdoc ( ALIASES [ crate ] , alias_name ) ) {
2355
- ALIASES [ crate ] [ alias_name ] = [ ] ;
2355
+ let currentNameAliases ;
2356
+ if ( currentCrateAliases . has ( alias_name ) ) {
2357
+ currentNameAliases = currentCrateAliases . get ( alias_name ) ;
2358
+ } else {
2359
+ currentNameAliases = [ ] ;
2360
+ currentCrateAliases . set ( alias_name , currentNameAliases ) ;
2356
2361
}
2357
2362
for ( const local_alias of aliases [ alias_name ] ) {
2358
- ALIASES [ crate ] [ alias_name ] . push ( local_alias + currentIndex ) ;
2363
+ currentNameAliases . push ( local_alias + currentIndex ) ;
2359
2364
}
2360
2365
}
2361
2366
}
0 commit comments