| ... | ... | @@ -1045,7 +1045,11 @@ var zigAnalysis; |
| 1045 | 1045 | */ |
| 1046 | 1046 | function walkResultTypeRef(wr) { |
| 1047 | 1047 | if (wr.typeRef) return wr.typeRef; |
| 1048 | | return walkResultTypeRef(resolveValue(wr)); |
| 1048 | let resolved = resolveValue(wr); |
| 1049 | if (wr === resolved) { |
| 1050 | return {type: 0}; |
| 1051 | } |
| 1052 | return walkResultTypeRef(resolved); |
| 1049 | 1053 | } |
| 1050 | 1054 | /** |
| 1051 | 1055 | * @typedef {{ |
| ... | ... | @@ -1128,6 +1132,10 @@ var zigAnalysis; |
| 1128 | 1132 | |
| 1129 | 1133 | switch (typeObj.kind) { |
| 1130 | 1134 | default: throw "TODO"; |
| 1135 | case typeKinds.ComptimeExpr: |
| 1136 | { |
| 1137 | return "[ComptimeExpr]"; |
| 1138 | } |
| 1131 | 1139 | case typeKinds.Array: |
| 1132 | 1140 | { |
| 1133 | 1141 | let arrayObj = /** @type {ArrayType} */ (typeObj); |
| ... | ... | @@ -1660,7 +1668,7 @@ var zigAnalysis; |
| 1660 | 1668 | const funcRetExpr = resolveValue({ |
| 1661 | 1669 | expr: /** @type {Fn} */(typeExpr).ret |
| 1662 | 1670 | }); |
| 1663 | | if ("type" in funcRetExpr && funcRetExpr.type != typeTypeId) { |
| 1671 | if ("type" in funcRetExpr.expr && funcRetExpr.expr.type == typeTypeId) { |
| 1664 | 1672 | if (typeIsErrSet(declValue.expr.type)) { |
| 1665 | 1673 | errSetsList.push(decl); |
| 1666 | 1674 | } else if (typeIsStructWithNoFields(declValue.expr.type)) { |
| ... | ... | @@ -1671,9 +1679,15 @@ var zigAnalysis; |
| 1671 | 1679 | } else { |
| 1672 | 1680 | fnsList.push(decl); |
| 1673 | 1681 | } |
| 1674 | | } else { |
| 1675 | | typesList.push(decl); |
| 1676 | | } |
| 1682 | } else { |
| 1683 | if (typeIsErrSet(declValue.expr.type)) { |
| 1684 | errSetsList.push(decl); |
| 1685 | } else if (typeIsStructWithNoFields(declValue.expr.type)) { |
| 1686 | namespacesList.push(decl); |
| 1687 | } else { |
| 1688 | typesList.push(decl); |
| 1689 | } |
| 1690 | } |
| 1677 | 1691 | } else if ("typeRef" in declValue) { |
| 1678 | 1692 | if ("type" in declValue.typeRef && declValue.typeRef == typeTypeId) { |
| 1679 | 1693 | // We don't know what the type expression is, but we know it's a type. |
| ... | ... | @@ -2098,14 +2112,14 @@ var zigAnalysis; |
| 2098 | 2112 | if (list[mainDeclIndex] != null) continue; |
| 2099 | 2113 | |
| 2100 | 2114 | let decl = zigAnalysis.decls[mainDeclIndex]; |
| 2101 | | let declVal = resolveValue(decl.value); |
| 2115 | let declVal = decl.value; //resolveValue(decl.value); |
| 2102 | 2116 | let declNames = item.declNames.concat([decl.name]); |
| 2103 | 2117 | list[mainDeclIndex] = { |
| 2104 | 2118 | pkgNames: pkgNames, |
| 2105 | 2119 | declNames: declNames, |
| 2106 | 2120 | }; |
| 2107 | | if ("type" in declVal) { |
| 2108 | | let value = zigAnalysis.types[declVal.type]; |
| 2121 | if ("type" in declVal.expr) { |
| 2122 | let value = zigAnalysis.types[declVal.expr.type]; |
| 2109 | 2123 | if (declCanRepresentTypeKind(value.kind)) |
| 2110 | 2124 | { |
| 2111 | 2125 | canonTypeDecls[declVal.type] = mainDeclIndex; |
| ... | ... | @@ -2130,15 +2144,15 @@ var zigAnalysis; |
| 2130 | 2144 | if (canonDeclPaths == null) { |
| 2131 | 2145 | canonDeclPaths = computeCanonDeclPaths(); |
| 2132 | 2146 | } |
| 2133 | | let cd = /** @type {CanonDecl[]}*/(canonDeclPaths); |
| 2134 | | return cd[index]; |
| 2147 | //let cd = /** @type {CanonDecl[]}*/(canonDeclPaths); |
| 2148 | return canonDeclPaths[index]; |
| 2135 | 2149 | } |
| 2136 | 2150 | |
| 2137 | 2151 | /** @param {number} index */ |
| 2138 | 2152 | function getCanonTypeDecl(index) { |
| 2139 | 2153 | getCanonDeclPath(0); |
| 2140 | | let ct = /** @type {number[]}*/(canonTypeDecls); |
| 2141 | | return ct[index]; |
| 2154 | //let ct = /** @type {number[]}*/(canonTypeDecls); |
| 2155 | return canonTypeDecls[index]; |
| 2142 | 2156 | } |
| 2143 | 2157 | |
| 2144 | 2158 | /** @param {string} text */ |
| ... | ... | @@ -2646,7 +2660,9 @@ function renderSearch() { |
| 2646 | 2660 | let lastPkgName = canonPath.pkgNames[canonPath.pkgNames.length - 1]; |
| 2647 | 2661 | let fullPathSearchText = lastPkgName + "." + canonPath.declNames.join('.'); |
| 2648 | 2662 | let astNode = zigAnalysis.astNodes[decl.src]; |
| 2649 | | let fileAndDocs = zigAnalysis.files[astNode.file]; |
| 2663 | let fileAndDocs = "" //zigAnalysis.files[astNode.file]; |
| 2664 | // TODO: understand what this piece of code is trying to achieve |
| 2665 | // also right now `files` are expressed as a hashmap. |
| 2650 | 2666 | if (astNode.docs != null) { |
| 2651 | 2667 | fileAndDocs += "\n" + astNode.docs; |
| 2652 | 2668 | } |