@@ -263,7 +263,6 @@ function initSearch(rawSearchIndex) {
263263 * @returns {integer }
264264 */
265265 function buildTypeMapIndex ( name ) {
266-
267266 if ( name === "" || name === null ) {
268267 return - 1 ;
269268 }
@@ -1380,7 +1379,7 @@ function initSearch(rawSearchIndex) {
13801379 * @type Map<integer, QueryElement[]>
13811380 */
13821381 const queryElemSet = new Map ( ) ;
1383- const addQueryElemToQueryElemSet = function addQueryElemToQueryElemSet ( queryElem ) {
1382+ const addQueryElemToQueryElemSet = queryElem => {
13841383 let currentQueryElemList ;
13851384 if ( queryElemSet . has ( queryElem . id ) ) {
13861385 currentQueryElemList = queryElemSet . get ( queryElem . id ) ;
@@ -1397,7 +1396,7 @@ function initSearch(rawSearchIndex) {
13971396 * @type Map<integer, FunctionType[]>
13981397 */
13991398 const fnTypeSet = new Map ( ) ;
1400- const addFnTypeToFnTypeSet = function addFnTypeToFnTypeSet ( fnType ) {
1399+ const addFnTypeToFnTypeSet = fnType => {
14011400 // Pure generic, or an item that's not matched by any query elems.
14021401 // Try [unboxing] it.
14031402 //
@@ -2385,12 +2384,11 @@ ${item.displayPath}<span class="${type}">${name}</span>\
23852384 lowercasePaths
23862385 ) ;
23872386 }
2387+ // `0` is used as a sentinel because it's fewer bytes than `null`
2388+ const item = pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] ;
23882389 return {
2389- // `0` is used as a sentinel because it's fewer bytes than `null`
2390- id : pathIndex === 0
2391- ? - 1
2392- : buildTypeMapIndex ( lowercasePaths [ pathIndex - 1 ] . name ) ,
2393- ty : pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] . ty ,
2390+ id : item === null ? - 1 : buildTypeMapIndex ( item . name ) ,
2391+ ty : item === null ? null : item . ty ,
23942392 generics : generics ,
23952393 } ;
23962394 } ) ;
@@ -2419,14 +2417,13 @@ ${item.displayPath}<span class="${type}">${name}</span>\
24192417 if ( functionSearchType === 0 ) {
24202418 return null ;
24212419 }
2422- let inputs , output ;
2420+ let inputs , output , item ;
24232421 if ( typeof functionSearchType [ INPUTS_DATA ] === "number" ) {
24242422 const pathIndex = functionSearchType [ INPUTS_DATA ] ;
2423+ item = pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] ;
24252424 inputs = [ {
2426- id : pathIndex === 0
2427- ? - 1
2428- : buildTypeMapIndex ( lowercasePaths [ pathIndex - 1 ] . name ) ,
2429- ty : pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] . ty ,
2425+ id : item === null ? - 1 : buildTypeMapIndex ( item . name ) ,
2426+ ty : item === null ? null : item . ty ,
24302427 generics : [ ] ,
24312428 } ] ;
24322429 } else {
@@ -2438,11 +2435,10 @@ ${item.displayPath}<span class="${type}">${name}</span>\
24382435 if ( functionSearchType . length > 1 ) {
24392436 if ( typeof functionSearchType [ OUTPUT_DATA ] === "number" ) {
24402437 const pathIndex = functionSearchType [ OUTPUT_DATA ] ;
2438+ item = pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] ;
24412439 output = [ {
2442- id : pathIndex === 0
2443- ? - 1
2444- : buildTypeMapIndex ( lowercasePaths [ pathIndex - 1 ] . name ) ,
2445- ty : pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] . ty ,
2440+ id : item === null ? - 1 : buildTypeMapIndex ( item . name ) ,
2441+ ty : item === null ? null : item . ty ,
24462442 generics : [ ] ,
24472443 } ] ;
24482444 } else {
0 commit comments