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