|
564 | 564 | var results_length = 0;
|
565 | 565 | val = extractGenerics(val.substr(1, val.length - 2));
|
566 | 566 | for (var i = 0; i < nSearchWords; ++i) {
|
567 |
| - var param = findArg(searchIndex[i], val, true); |
| 567 | + var in_args = findArg(searchIndex[i], val, true); |
568 | 568 | var returned = checkReturned(searchIndex[i], val, true);
|
569 | 569 | var ty = searchIndex[i];
|
570 | 570 | if (searchWords[i] === val.name) {
|
|
575 | 575 | results[ty.path + ty.name] = {id: i, index: -1};
|
576 | 576 | results_length += 1;
|
577 | 577 | }
|
578 |
| - } else if ((param === true || returned === true) && |
| 578 | + } else if ((in_args === true || returned === true) && |
579 | 579 | typePassesFilter(typeFilter, searchIndex[i].ty)) {
|
580 | 580 | if (results[ty.path + ty.name] === undefined) {
|
581 | 581 | results[ty.path + ty.name] = {
|
582 | 582 | id: i,
|
583 | 583 | index: -1,
|
584 | 584 | dontValidate: true,
|
585 |
| - param: param, |
| 585 | + in_args: in_args, |
586 | 586 | returned: returned,
|
587 | 587 | };
|
588 | 588 | results_length += 1;
|
589 | 589 | } else {
|
590 |
| - if (param === true) { |
591 |
| - results[ty.path + ty.name].param = true; |
| 590 | + if (in_args === true) { |
| 591 | + results[ty.path + ty.name].in_args = true; |
592 | 592 | }
|
593 | 593 | if (returned === true) {
|
594 | 594 | results[ty.path + ty.name].returned = true;
|
|
625 | 625 | var typeOutput = type.output ? type.output.name : "";
|
626 | 626 | var returned = checkReturned(ty, output, true);
|
627 | 627 | if (output.name === "*" || returned === true) {
|
628 |
| - var param = false; |
| 628 | + var in_args = false; |
629 | 629 | var module = false;
|
630 | 630 |
|
631 | 631 | if (input === "*") {
|
|
635 | 635 | for (var it = 0; allFound === true && it < inputs.length; it++) {
|
636 | 636 | allFound = checkType(type, inputs[it], true);
|
637 | 637 | }
|
638 |
| - param = allFound; |
| 638 | + in_args = allFound; |
639 | 639 | }
|
640 |
| - if (param === true || returned === true || module === true) { |
| 640 | + if (in_args === true || returned === true || module === true) { |
641 | 641 | if (results[ty.path + ty.name] !== undefined) {
|
642 | 642 | if (returned === true) {
|
643 | 643 | results[ty.path + ty.name].returned = true;
|
644 | 644 | }
|
645 |
| - if (param === true) { |
646 |
| - results[ty.path + ty.name].param = true; |
| 645 | + if (in_args === true) { |
| 646 | + results[ty.path + ty.name].in_args = true; |
647 | 647 | }
|
648 | 648 | } else {
|
649 | 649 | results[ty.path + ty.name] = {
|
650 | 650 | id: i,
|
651 | 651 | index: -1,
|
652 | 652 | dontValidate: true,
|
653 | 653 | returned: returned,
|
654 |
| - param: param, |
| 654 | + in_args: in_args, |
655 | 655 | };
|
656 | 656 | }
|
657 | 657 | }
|
|
677 | 677 | continue;
|
678 | 678 | }
|
679 | 679 | var returned = false;
|
680 |
| - var param = false; |
| 680 | + var in_args = false; |
681 | 681 | var index = -1;
|
682 | 682 | // we want lev results to go lower than others
|
683 |
| - var lev = 0; |
| 683 | + var lev = MAX_LEV_DISTANCE; |
684 | 684 |
|
685 | 685 | if (searchWords[j].indexOf(split[i]) > -1 ||
|
686 | 686 | searchWords[j].indexOf(val) > -1 ||
|
|
696 | 696 | if (typePassesFilter(typeFilter, searchIndex[j].ty) &&
|
697 | 697 | (results[ty.path + ty.name] === undefined ||
|
698 | 698 | results[ty.path + ty.name].lev > lev_distance)) {
|
699 |
| - lev = lev_distance; |
| 699 | + lev = min(lev, lev_distance); |
700 | 700 | index = 0;
|
701 | 701 | }
|
702 | 702 | }
|
|
705 | 705 | if (typePassesFilter(typeFilter, searchIndex[j].ty) &&
|
706 | 706 | (results[ty.path + ty.name] === undefined ||
|
707 | 707 | results[ty.path + ty.name].lev > lev_distance)) {
|
708 |
| - param = true; |
709 |
| - lev = lev_distance; |
| 708 | + in_args = true; |
| 709 | + lev = min(lev_distance, lev); |
710 | 710 | index = 0;
|
711 | 711 | }
|
712 | 712 | }
|
|
716 | 716 | (results[ty.path + ty.name] === undefined ||
|
717 | 717 | results[ty.path + ty.name].lev > lev_distance)) {
|
718 | 718 | returned = true;
|
719 |
| - lev = lev_distance; |
| 719 | + lev = min(lev_distance, lev); |
720 | 720 | index = 0;
|
721 | 721 | }
|
722 | 722 | }
|
|
726 | 726 | id: j,
|
727 | 727 | index: index,
|
728 | 728 | lev: lev,
|
729 |
| - param: param, |
| 729 | + in_args: in_args, |
730 | 730 | returned: returned,
|
731 | 731 | };
|
732 | 732 | results_length += 1;
|
733 | 733 | } else {
|
734 | 734 | if (results[ty.path + ty.name].lev > lev) {
|
735 | 735 | results[ty.path + ty.name].lev = lev;
|
736 | 736 | }
|
737 |
| - if (param === true) { |
738 |
| - results[ty.path + ty.name].param = true; |
| 737 | + if (in_args === true) { |
| 738 | + results[ty.path + ty.name].in_args = true; |
739 | 739 | }
|
740 | 740 | if (returned === true) {
|
741 | 741 | results[ty.path + ty.name].returned = true;
|
|
1164 | 1164 | filterdata.push([obj.name, obj.ty, obj.path, obj.desc]);
|
1165 | 1165 | if (obj.type) {
|
1166 | 1166 | if (results['returned'].length < maxResults &&
|
1167 |
| - resultIndex[i].returned === true) { |
| 1167 | + resultIndex[i].returned === true) |
| 1168 | + { |
1168 | 1169 | results['returned'].push(obj);
|
1169 | 1170 | added = true;
|
1170 | 1171 | }
|
1171 |
| - if (results['in_args'].length < maxResults && resultIndex[i] === true) { |
| 1172 | + if (results['in_args'].length < maxResults && |
| 1173 | + resultIndex[i].in_args === true) |
| 1174 | + { |
1172 | 1175 | results['in_args'].push(obj);
|
1173 | 1176 | added = true;
|
1174 | 1177 | }
|
|
0 commit comments