aboutsummaryrefslogtreecommitdiff
path: root/src/Autodoc.zig
AgeCommit message (Collapse)Author
2023-09-17autodoc: split json payload per fieldLoris Cro
this will make s3 re-enable compression for the stdlib's autodoc and improve loading times (and data usage) for users alongside this commit the deploy script for the official website is also being updated
2023-09-16autodoc: Implement builtin function rendering.Krzysztof Wolicki
Implement unary ops handling. Fix getType in main.js Minor cleanup of builtin function handling.
2023-09-16autodoc: Remove unnecessary Expr tagKrzysztof Wolicki
2023-09-16autodoc: Handle `ref` ZIR instructionKrzysztof Wolicki
2023-09-06fix: panic message typoMustafa Uzun
2023-09-03autodoc: Implement `@call`, `@unionInit`, `@mulAdd` support (#16918)Krzysztof Wolicki
* autodoc: Implement `@call`, `@unionInit`, `@mulAdd` support * autodoc: Implement builtinIndex in ex
2023-09-03autodoc: Implement `a[b]`, `a.?`, and `a.*` (#16863)Krzysztof Wolicki
* autodoc: Implement elem_val_node and basic optional_payload_* * autodoc: Add `.*` loads
2023-08-17Autodoc: fix guide path resolutionIan Johnson
The previous logic was using `root_src_directory` both in constructing the resolved path and as the root when opening the resolved path, which effectively duplicates those path components in the final path.
2023-08-14Autodoc: remove assumption that slice's lhs is always a declRefKrzysztof Wolicki
2023-07-22move installation logic to the build script where it belongsAndrew Kelley
* build.zig: introduce `-Dflat` option which makes the installation match what we want to ship for our download tarballs. This allows deleting a bunch of shell script logic from the CI. - for example it puts the executable directly in prefix/zig rather than prefix/bin/zig and it additionally includes prefix/LICENSE. * build.zig: by default also install std lib documentation to doc/std/ - this can be disabled by `-Dno-autodocs` similar to how there is already `-Dno-langref`. * build.zig: add `std-docs` and `langref` steps which build and install the std lib autodocs and langref to prefix/doc/std and prefix/doc/langref.html, respectively. * std.Build: implement proper handling of `-femit-docs` using the LazyPath system. This is a breaking change. - this is a partial implementation of #16351 * frontend: fixed the handling of Autodocs with regards to caching and putting the artifacts in the proper location to integrate with the build system. - closes #15864 * CI: delete the logic for autodocs since it is now handled by build.zig and is enabled by default. - in the future we should strive to have nearly all the CI shell script logic deleted in favor of `zig build` commands. * CI: pass `-DZIG_NO_LIB=ON`/`-Dno-lib` except for the one command where we want to actually generate the langref and autodocs. Generating the langref takes 14 minutes right now (why?!) so we don't want to do that more times than necessary. * Autodoc: fixed use of a global variable. It works fine as a local variable instead. - note that in the future we will want to make Autodoc run simultaneously using the job system, but for now the principle of YAGNI dictates that we don't have an init()/deinit() API and instead simply call the function that does the things. * Autodoc: only do it when there are no compile errors
2023-07-21std.json: Unify stringify and writeStream (#16405)Josh Wolfe
2023-07-21autodoc: avoid recursing reference loops in call instructionsLoris Cro
2023-07-18Autodoc: fix crash on new InternPool additionAndrew Kelley
2023-07-14Autodoc tokenizer (#16409)Loris Cro
* autodoc: init work to refactor exprName * autodoc: Implement more expressions in exprName refactor * autodoc: more work * autodoc: More exprName to ex refactoring * autodoc: Remove whitespace flag from renderer; Add pre tags in value and variable drawing in renderContainer * autodoc: add inline styling to pre blocks * autodoc: move renderer code to main.js * autodoc: More exprName to ex refactoring; Fn signatures rendered with new code * autodoc: Fix function rendering. Add more things to ex * autodoc: nuke exprName --------- Co-authored-by: Krzysztof Wolicki <der.teufel.mail@gmail.com>
2023-07-06Autodoc: implement boolean operationsIan Johnson
2023-07-03autodoc: wire in js tokenizer to frontendLoris Cro
2023-07-01autodoc: fix scoring bug when matching full decl nameLoris Cro
2023-07-01Fixed Autodoc rendering of @truncate builtin (#16263)Emile Badenhorst
* fixed autodoc rendering of @trucate builtin * Changed to LHS for typeRef * autodoc: fix typeref for `truncate` --------- Co-authored-by: Loris Cro <kappaloris@gmail.com>
2023-06-28autodoc: Correct a comment about types from std.builtinKrzysztof Wolicki
2023-06-28autodoc: Try to handle all InternPool.Index types good enoughKrzysztof Wolicki
2023-06-27autodoc: Added u0, i0 to correctly indexed typesKrzysztof Wolicki
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-24compiler: remove destination type from cast builtinsmlugg
Resolves: #5909
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19compiler: rename "@XToY" to "@YFromX", zig fmt: rewrite themEric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-18autodoc: Handle more InternPool.Index types properly in AutodocKrzysztof Wolicki
2023-06-16Autodoc: fix crash when walking `@min`/`@max` with two operandsmlugg
This was causing CI failures after the previous commit.
2023-06-13Eliminate switch_cond[_ref] ZIR tagsmlugg
This finishes the process of consolidating switch expressions in ZIR into as simple and compact a representation as is possible. There are now just two ZIR tags dedicated to switch expressions: switch_block and switch_block_ref, with the latter being for an operand passed by reference.
2023-06-11Autodoc: make it work under InternPoolmlugg
2023-06-10stage2: start the InternPool transitionAndrew Kelley
Instead of doing everything at once which is a hopelessly large task, this introduces a piecemeal transition that can be done in small increments at a time. This is a minimal changeset that keeps the compiler compiling. It only uses the InternPool for a small set of types. Behavior tests are not passing. Air.Inst.Ref and Zir.Inst.Ref are separated into different enums but compile-time verified to have the same fields in the same order. The large set of changes is mainly to deal with the fact that most Type and Value methods now require a Module to be passed in, so that the InternPool object can be accessed.
2023-06-03Merge pull request #15579 from squeek502/mem-delimitersAndrew Kelley
Split `std.mem.split` and `tokenize` into `sequence`, `any`, and `scalar` versions
2023-05-20Zir: eliminate `field_call_bind` and `field_call_bind_named`mlugg
This commit removes the `field_call_bind` and `field_call_bind_named` ZIR instructions, replacing them with a `field_call` instruction which does the bind and call in one. `field_call_bind` is an unfortunate instruction. It's tied into one very specific usage pattern - its result can only be used as a callee. This means that it creates a value of a "pseudo-type" of sorts, `bound_fn` - this type used to exist in Zig, but now we just hide it from the user and have AstGen ensure it's only used in one way. This is quite silly - `Type` and `Value` should, as much as possible, reflect real Zig types and values. It makes sense to instead encode the `a.b()` syntax as its own ZIR instruction, so that's what we do here. This commit introduces a new instruction, `field_call`. It's like `call`, but rather than a callee ref, it contains a ref to the object pointer (`&a` in `a.b()`) and the string field name (`b`). This eliminates `bound_fn` from the language, and slightly decreases the size of generated ZIR - stats below. This commit does remove a few usages which used to be allowed: - `@field(a, "b")()` - `@call(.auto, a.b, .{})` - `@call(.auto, @field(a, "b"), .{})` These forms used to work just like `a.b()`, but are no longer allowed. I believe this is the correct choice for a few reasons: - `a.b()` is a purely *syntactic* form; for instance, `(a.b)()` is not valid. This means it is *not* inconsistent to not allow it in these cases; the special case here isn't "a field access as a callee", but rather this exact syntactic form. - The second argument to `@call` looks much more visually distinct from the callee in standard call syntax. To me, this makes it seem strange for that argument to not work like a normal expression in this context. - A more practical argument: it's confusing! `@field` and `@call` are used in very different contexts to standard function calls: the former normally hints at some comptime machinery, and the latter that you want more precise control over parts of a function call. In these contexts, you don't want implicit arguments adding extra confusion: you want to be very explicit about what you're doing. Lastly, some stats. I mentioned before that this change slightly reduces the size of ZIR - this is due to two instructions (`field_call_bind` then `call`) being replaced with one (`field_call`). Here are some numbers: +--------------+----------+----------+--------+ | File | Before | After | Change | +--------------+----------+----------+--------+ | Sema.zig | 4.72M | 4.53M | -4% | | AstGen.zig | 1.52M | 1.48M | -3% | | hash_map.zig | 283.9K | 276.2K | -3% | | math.zig | 312.6K | 305.3K | -2% | +--------------+----------+----------+--------+
2023-05-13Update all std.mem.split calls to their appropriate functionRyan Liptak
Everywhere that can now use `splitScalar` should get a nice little performance boost.
2023-05-13std: Rewrite low-level json api to support streaming (#15602)Josh Wolfe
2023-05-11Merge pull request #15519 from dweiller/issue-15482Andrew Kelley
Optimize lowering of `s[start..][0..len]`
2023-05-11Merge pull request #15637 from der-teufel-programming/autodoc-layoutsLoris Cro
autodoc: Add layout to Struct and Union to handle packed and extern
2023-05-10autodoc: fix crash when call syntax has complex callee expressionLoris Cro
2023-05-10autodoc: Add layout to Struct and Union to properly display packed and extern;Krzysztof Wolicki
Make rendering of types in exprName more similar to zig fmt
2023-05-09autodoc: Fix tag type for unions; Fix backing int for packed structsKrzysztof Wolicki
2023-05-08autodoc: Analyze and expose backing integer types for packed structsKrzysztof Wolicki
2023-05-07autodoc: fix support for slice_length ZIR instructiondweiller
2023-05-07add optional sentinel to slice_length ZIRdweiller
2023-05-07autodoc: implement slice_length case in walkInstructiondweiller
2023-05-07zir: add slice_length tagdweiller
2023-05-06autodoc: Add gathering of top-level doc comments for imported filesKrzysztof Wolicki
2023-05-05autodoc: Save switches as comptimeExpr with the code instead of analyzing it ↵Krzysztof Wolicki
deeply; simplified getBlockSource;
2023-05-05autodoc: Better comptimeExpr code for blocksKrzysztof Wolicki
2023-04-29Merge pull request #15478 from der-teufel-programming/autodoc-decltestsLoris Cro
autodoc: Gather and display decltests
2023-04-29autodoc: Gather and display decltestsKrzysztof Wolicki
2023-04-28compiler: use `@memcpy` instead of `std.mem.copy`Andrew Kelley