generated docs: add optional type support

This commit is contained in:
Andrew Kelley 2019-10-10 20:32:17 -04:00
parent fa47172841
commit 6082c14753
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
3 changed files with 12 additions and 0 deletions

View File

@ -537,7 +537,12 @@ pub const OpenError = error{
SystemFdQuotaExceeded,
NoDevice,
FileNotFound,
/// Insufficient kernel memory was available, or
/// the named file is a FIFO and per-user hard limit on
/// memory allocation for pipes has been reached.
SystemResources,
NoSpaceLeft,
NotDir,
PathAlreadyExists,

View File

@ -438,6 +438,8 @@
name += "]";
name += typeIndexName(typeObj.elem, wantHtml, wantSubLink, null);
return name;
case typeKinds.Optional:
return "?" + typeIndexName(typeObj.child, wantHtml, wantSubLink, fnDecl, linkFnNameDecl);
case typeKinds.Pointer:
var name = "";
switch (typeObj.len) {

View File

@ -991,6 +991,11 @@ static void anal_dump_type(AnalDumpCtx *ctx, ZigType *ty) {
}
break;
}
case ZigTypeIdOptional: {
jw_object_field(jw, "child");
anal_dump_type_ref(ctx, ty->data.maybe.child_type);
break;
}
case ZigTypeIdPointer: {
switch (ty->data.pointer.ptr_len) {
case PtrLenSingle: