From 5f0ab34cc5b5d4d59bf4665964b36ae8c218df76 Mon Sep 17 00:00:00 2001 From: Reece Van Atta Date: Mon, 21 Mar 2022 13:42:22 -0400 Subject: [PATCH] autodoc: add type comments to main.js file --- lib/docs/main.js | 179 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) diff --git a/lib/docs/main.js b/lib/docs/main.js index 9ff8d42d45..28f8142f33 100644 --- a/lib/docs/main.js +++ b/lib/docs/main.js @@ -1,5 +1,184 @@ 'use strict'; +/** + * @typedef { + | "Type" + | "Void" + | "Bool" + | "NoReturn" + | "Int" + | "Float" + | "Pointer" + | "Array" + | "Struct" + | "ComptimeFloat" + | "ComptimeInt" + | "Undefined" + | "Null" + | "Optional" + | "ErrorUnion" + | "ErrorSet" + | "Enum" + | "Union" + | "Fn" + | "BoundFn" + | "Opaque" + | "Frame" + | "AnyFrame" + | "Vector" + | "EnumLiteral" + | "ComptimeExpr" + | "Unanalyzed" + } TypeKind +*/ + +/** + * @typedef { + | WalkResult + | { unspecified: {} } + | { anytype: {} } + | { type: number } + | { comptimeExpr: number } + | { call: number } + | { hasCte: boolean; declPath: number[] } + } TypeRef +*/ + +/** + * @typedef { + | { void: {} } + | { unreachable: {} } + | { anytype: {} } + | { type: number } + | { comptimeExpr: number } + | { call: number } + | { int: { typeRef: TypeRef; value: number } } + | { float: { typeRef: TypeRef; value: number } } + | { bool: boolean } + | { undefined: TypeRef } + | { null: TypeRef } + | { typeOf: WalkResult } + | { compileError: string } + | { string: string } + | { struct: Struct } + | { hasCte: boolean; declPath: number[] } + | { array: ZigArray } + | { enumLiteral: string } + } WalkResult +*/ + +/** + * @typedef { + { kind: number } & ( + | { name: string } // Type, Void, Bool, NoReturn, Int, Float, ComptimeExpr, ComptimeFloat, ComptimeInt, Undefined, Null, ErrorUnion, BoundFn, Opaque, Frame, AnyFrame, Vector, EnumLiteral + | { name: string; child: TypeRef } // Optional + | { len: WalkResult; child: TypeRef } // Array + | { name: string; fields: { name: string; docs: string }[] } // ErrorSet + | { size: "One" | "Many" | "Slice" | "C"; child: TypeRef } // Pointer + | { name: string; src?: number; privDecls: number[]; pubDecls: number[]; fields?: TypeRef[] } // Struct, Enum, Union + | { name: string; src?: number; ret: TypeRef; params?: TypeRef[] } // Fn + ) + } Type +*/ + +/** + * @typedef {{ + name: string, + src: number | null, + ret: TypeRef, + params: TypeRef[] | null, + }} Fn +*/ + +/** + * @typedef {{ + func: TypeRef, + args: WalkResult[], + ret: WalkResult, + }} Call +*/ + +/** + * @typedef {{ + file: number, + line: number, + col: number, + name?: string, + docs?: string, + fields?: number[], + comptime: boolean, + }} AstNode +*/ + +/** + * @typedef {{ + name: string, + kind: string, + src: number, + value: WalkResult, + decltest?: number, + }} Decl +*/ + +/** + * @typedef {{ + name: string, + file: number, + main: number, + table: { root: number }, + }} Package +*/ + +/** + * @typedef {{ + name: string, + src?: number, + privDecls: number[], + pubDecls: number[], + fields?: TypeRef[], + }} Struct +*/ + +/** + * @typedef {{ + len: WalkResult, + child: TypeRef, + }} ZigArray +*/ + +/** + * @typedef {{ + code: string, + typeRef: TypeRef, + }} ComptimeExpr +*/ + +/** + * @typedef {{ + typeKinds: TypeKind[]; + rootPkg: number; + params: { + zigId: string; + zigVersion: string; + target: string; + rootName: string; + builds: { target: string }; + }; + packages: Package[]; + errors: {}; + astNodes: AstNode[]; + calls: Call[]; + files: Record; + types: Type[]; + decls: Decl[]; + comptimeExprs: ComptimeExpr[]; + fns: Fn[]; + }} DocData +*/ + +/** @type {DocData} */ +var zigAnalysis; + (function() { var domStatus = document.getElementById("status"); var domSectNav = document.getElementById("sectNav");