@@ -15,15 +15,6 @@ if (!Array.prototype.toSpliced) {
15
15
} ;
16
16
}
17
17
18
- function takeFromArray ( array , count ) {
19
- const result = [ ] ;
20
- while ( count > 0 ) {
21
- result . push ( array . shift ( ) ) ;
22
- count -= 1 ;
23
- }
24
- return result ;
25
- }
26
-
27
18
function onEachBtwn ( arr , func , funcBtwn ) {
28
19
let skipped = true ;
29
20
for ( const value of arr ) {
@@ -1448,31 +1439,7 @@ function initSearch(rawSearchIndex) {
1448
1439
let fnInputs = null ;
1449
1440
let fnOutput = null ;
1450
1441
let mgens = null ;
1451
- if ( typeInfo === "elems" ) {
1452
- fnInputs = unifyFunctionTypes (
1453
- obj . type . inputs ,
1454
- parsedQuery . elems ,
1455
- obj . type . where_clause ,
1456
- null ,
1457
- mgensOut => {
1458
- mgens = mgensOut ;
1459
- return true ;
1460
- } ,
1461
- 0 ,
1462
- ) ;
1463
- } else if ( typeInfo === "returned" ) {
1464
- fnOutput = unifyFunctionTypes (
1465
- obj . type . output ,
1466
- parsedQuery . elems ,
1467
- obj . type . where_clause ,
1468
- null ,
1469
- mgensOut => {
1470
- mgens = mgensOut ;
1471
- return true ;
1472
- } ,
1473
- 0 ,
1474
- ) ;
1475
- } else {
1442
+ if ( typeInfo !== "elems" && typeInfo !== "returned" ) {
1476
1443
fnInputs = unifyFunctionTypes (
1477
1444
obj . type . inputs ,
1478
1445
parsedQuery . elems ,
@@ -1494,6 +1461,24 @@ function initSearch(rawSearchIndex) {
1494
1461
} ,
1495
1462
0 ,
1496
1463
) ;
1464
+ } else {
1465
+ const arr = typeInfo === "elems" ? obj . type . inputs : obj . type . output ;
1466
+ const highlighted = unifyFunctionTypes (
1467
+ arr ,
1468
+ parsedQuery . elems ,
1469
+ obj . type . where_clause ,
1470
+ null ,
1471
+ mgensOut => {
1472
+ mgens = mgensOut ;
1473
+ return true ;
1474
+ } ,
1475
+ 0 ,
1476
+ ) ;
1477
+ if ( typeInfo === "elems" ) {
1478
+ fnInputs = highlighted ;
1479
+ } else {
1480
+ fnOutput = highlighted ;
1481
+ }
1497
1482
}
1498
1483
if ( ! fnInputs ) {
1499
1484
fnInputs = obj . type . inputs ;
@@ -2000,7 +1985,7 @@ function initSearch(rawSearchIndex) {
2000
1985
highlighted [ i ] = Object . assign ( { } , fnType , {
2001
1986
generics : highlightedGenerics ,
2002
1987
bindings : new Map ( [ ...fnType . bindings . entries ( ) ] . map ( ( [ k , v ] ) => {
2003
- return [ k , takeFromArray ( highlightedGenerics , v . length ) ] ;
1988
+ return [ k , highlightedGenerics . splice ( 0 , v . length ) ] ;
2004
1989
} ) ) ,
2005
1990
} ) ;
2006
1991
return highlighted ;
@@ -2116,7 +2101,7 @@ function initSearch(rawSearchIndex) {
2116
2101
unifiedGenericsMgens ,
2117
2102
solutionCb ,
2118
2103
unboxingDepth ,
2119
- ) : takeFromArray ( unifiedGenerics , v . length ) ] ;
2104
+ ) : unifiedGenerics . splice ( 0 , v . length ) ] ;
2120
2105
} ) ) ,
2121
2106
} ) ;
2122
2107
return passesUnification ;
@@ -2169,7 +2154,7 @@ function initSearch(rawSearchIndex) {
2169
2154
const highlightedFnType = Object . assign ( { } , fnType , {
2170
2155
generics : highlightedGenerics ,
2171
2156
bindings : new Map ( [ ...fnType . bindings . entries ( ) ] . map ( ( [ k , v ] ) => {
2172
- return [ k , takeFromArray ( highlightedGenerics , v . length ) ] ;
2157
+ return [ k , highlightedGenerics . splice ( 0 , v . length ) ] ;
2173
2158
} ) ) ,
2174
2159
} ) ;
2175
2160
return passesUnification . toSpliced (
0 commit comments