commit b0cd64c019a77366abb69cf1645d84f416543df3 (tree)
parent 2bb2a2fcea5d4c22e7dfed529b318b9ba88e2ac9
Author: Rocknest <35231115+Rocknest@users.noreply.github.com>
Date: Fri, 11 Oct 2019 04:09:01 +0300
Merge branch 'master' into docs-local
Diffstat:
4 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/lib/std/os.zig b/lib/std/os.zig
@@ -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,
diff --git a/lib/std/special/docs/main.js b/lib/std/special/docs/main.js
@@ -27,6 +27,7 @@
var domFnErrorsAnyError = document.getElementById("fnErrorsAnyError");
var domFnExamples = document.getElementById("fnExamples");
var domFnNoExamples = document.getElementById("fnNoExamples");
+ var domDeclNoRef = document.getElementById("declNoRef");
var domSearch = document.getElementById("search");
var domSectSearchResults = document.getElementById("sectSearchResults");
var domListSearchResults = document.getElementById("listSearchResults");
@@ -112,6 +113,7 @@
domSectFnErrors.classList.add("hidden");
domFnExamples.classList.add("hidden");
domFnNoExamples.classList.add("hidden");
+ domDeclNoRef.classList.add("hidden");
domFnErrorsAnyError.classList.add("hidden");
domTableFnErrors.classList.add("hidden");
domSectGlobalVars.classList.add("hidden");
@@ -160,7 +162,12 @@
renderNav();
var lastDecl = curNav.declObjs[curNav.declObjs.length - 1];
- if (lastDecl.kind === 'var') {
+ if (lastDecl.pubDecls != null) {
+ renderContainer(lastDecl);
+ }
+ if (lastDecl.kind == null) {
+ return renderUnknownDecl(lastDecl);
+ } else if (lastDecl.kind === 'var') {
return renderVar(lastDecl);
} else if (lastDecl.kind === 'const' && lastDecl.type != null) {
var typeObj = zigAnalysis.types[lastDecl.type];
@@ -169,13 +176,21 @@
} else {
return renderValue(lastDecl);
}
- }
- if (lastDecl.kind != null) {
+ } else {
renderType(lastDecl);
}
- if (lastDecl.pubDecls != null) {
- renderContainer(lastDecl);
+ }
+
+ function renderUnknownDecl(decl) {
+ domDeclNoRef.classList.remove("hidden");
+
+ var docs = zigAnalysis.astNodes[decl.src].docs;
+ if (docs != null) {
+ domFnDocs.innerHTML = markdown(docs);
+ } else {
+ domFnDocs.innerHTML = '<p>There are no doc comments for this declaration.</p>';
}
+ domFnDocs.classList.remove("hidden");
}
function typeIsErrSet(typeIndex) {
@@ -423,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) {
diff --git a/src/analyze.cpp b/src/analyze.cpp
@@ -8304,7 +8304,8 @@ static void resolve_llvm_types_integer(CodeGen *g, ZigType *type) {
}
}
- type->llvm_di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&type->name), type->size_in_bits, dwarf_tag);
+ type->llvm_di_type = ZigLLVMCreateDebugBasicType(g->dbuilder, buf_ptr(&type->name),
+ type->abi_size * 8, dwarf_tag);
type->llvm_type = LLVMIntType(type->size_in_bits);
}
diff --git a/src/dump_analysis.cpp b/src/dump_analysis.cpp
@@ -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: