generated docs: add vector type support

See  #3404
This commit is contained in:
s-ol
2020-10-14 16:48:06 +02:00
parent 68b31c59a6
commit c81e8c2125
2 changed files with 17 additions and 0 deletions

View File

@@ -564,6 +564,13 @@
name += "]";
name += typeIndexName(typeObj.elem, wantHtml, wantSubLink, null);
return name;
case typeKinds.Vector:
var name = "Vector(";
name += token(typeObj.len, tokenKinds.Number, wantHtml);
name += ", ";
name += typeIndexName(typeObj.elem, wantHtml, wantSubLink, null);
name += ")";
return name;
case typeKinds.Optional:
return "?" + typeIndexName(typeObj.child, wantHtml, wantSubLink, fnDecl, linkFnNameDecl);
case typeKinds.Pointer:

View File

@@ -1046,6 +1046,16 @@ static void anal_dump_type(AnalDumpCtx *ctx, ZigType *ty) {
anal_dump_type_ref(ctx, ty->data.array.child_type);
break;
}
case ZigTypeIdVector: {
jw_object_field(jw, "len");
jw_int(jw, ty->data.vector.len);
jw_object_field(jw, "elem");
anal_dump_type_ref(ctx, ty->data.vector.elem_type);
break;
}
case ZigTypeIdInvalid:
zig_unreachable();
default:
jw_object_field(jw, "name");
jw_string(jw, buf_ptr(&ty->name));