Commit 03a6b33a73

Andrew Kelley <andrew@ziglang.org>
2019-10-08 17:59:55
generated docs: bool type and fix error for some fns
1 parent 6814d6b
Changed files (2)
lib
std
special
docs
src
lib/std/special/docs/main.js
@@ -32,6 +32,7 @@
     var typeKindPtrId;
     var typeKindFloatId;
     var typeKindIntId;
+    var typeKindBoolId;
     findTypeKinds();
 
     // for each package, is an array with packages to get to this one
@@ -214,7 +215,7 @@
         }
 
         var protoSrcNode = zigAnalysis.astNodes[protoSrcIndex];
-        if (docsSource == null && protoSrcNode.docs != null) {
+        if (docsSource == null && protoSrcNode != null && protoSrcNode.docs != null) {
             docsSource = protoSrcNode.docs;
         }
         if (docsSource != null) {
@@ -422,6 +423,12 @@
                 } else {
                     return "type";
                 }
+            case typeKindBoolId:
+                if (wantHtml) {
+                    return '<span class="tok-type">bool</span>';
+                } else {
+                    return "bool";
+                }
             default:
                 if (wantHtml) {
                     return escapeHtml(typeObj.name);
@@ -534,6 +541,8 @@
                 typeKindFloatId = i;
             } else if (zigAnalysis.typeKinds[i] === "Int") {
                 typeKindIntId = i;
+            } else if (zigAnalysis.typeKinds[i] === "Bool") {
+                typeKindBoolId = i;
             }
         }
         if (typeKindTypeId == null) {
@@ -551,6 +560,9 @@
         if (typeKindIntId == null) {
             throw new Error("No type kind 'Int' found");
         }
+        if (typeKindBoolId == null) {
+            throw new Error("No type kind 'Bool' found");
+        }
     }
 
     function findTypeTypeId() {
src/dump_analysis.cpp
@@ -723,6 +723,7 @@ static void anal_dump_type(AnalDumpCtx *ctx, ZigType *ty) {
 
     switch (ty->id) {
         case ZigTypeIdMetaType:
+        case ZigTypeIdBool:
             break;
         case ZigTypeIdStruct: {
             if (ty->data.structure.is_slice) {