| author | |
| committer | |
| log | 84a6254c0de7dd1bcd097da3898d2b4cb8c4b64e |
| tree | 06836771054a46299091cc2111735cc17a25728a |
| parent | 2205bf12c2792b8eef92453a207a8521c32055c4 |
| signature | Signed by PGP key B5690EEEBB952194 |
12 files changed, 49 insertions(+), 49 deletions(-)
doc/language-manual.md+6-6| ... | ... | @@ -11,8 +11,8 @@ Key goals of this project are: |
| 11 | 11 | It primarily focuses on merging some great points of Rust, Zig, and JavaScript's language designs: |
| 12 | 12 | |
| 13 | 13 | - **Rust** - Expressive control flow that is easy to write. |
| 14 | - **Zig** - Execute any code at compile time, everything is an expression. | |
| 15 | - **JavaScript** - Garbage collected values with a versitile type system. | |
| 14 | - **Zig** - Execute any code at compile time; everything is an expression. | |
| 15 | - **JavaScript** - Garbage collected values with a versatile type system. | |
| 16 | 16 | |
| 17 | 17 | ## Standard Library |
| 18 | 18 | |
| ... | ... | @@ -25,9 +25,9 @@ let print = @js("console").log; |
| 25 | 25 | print("Hello, world!"); |
| 26 | 26 | ``` |
| 27 | 27 | |
| 28 | The `print` function is implemented by getting an external reference to the `console` JavaScript global, and then retriving the `log` property from it. | |
| 28 | The `print` function is implemented by getting an external reference to the `console` JavaScript global and then retrieving the `log` property from it. | |
| 29 | 29 | |
| 30 | ## Primative Data Types | |
| 30 | ## Primitive Data Types | |
| 31 | 31 | |
| 32 | 32 | | name | ts equivilent | description | |
| 33 | 33 | | ---------- | --------------------- | ---------------------------------------------- | |
| ... | ... | @@ -36,7 +36,7 @@ The `print` function is implemented by getting an external reference to the `con |
| 36 | 36 | | `bool` | `boolean` | either `true` or `false` | |
| 37 | 37 | | `string` | `string` | a sequence of text characters | |
| 38 | 38 | | `void` | `undefined` or `null` | detectable lack of a value | |
| 39 | | `opaque` | `unknown` or `any` | could be any value | | |
| 39 | | `opaque` | `unknown` or `any` | could be any value | | |
| 40 | 40 | | `noreturn` | `never` | control flow prevents this value from existing | |
| 41 | 41 | |
| 42 | 42 | > **note**: `bigint` is planned but not added |
| ... | ... | @@ -61,7 +61,7 @@ let true = 1 == 0; |
| 61 | 61 | |
| 62 | 62 | There are two types of variables, `let` and `var`. |
| 63 | 63 | |
| 64 | `let` bindings cannot be overridden, and should be thought of as aliases of the expression within. Referring to these identifiers is equivilent to inlining it's where it was used, aside from side effect duplication. | |
| 64 | `let` bindings cannot be overridden, and should be thought of as aliases of the expression within. Referring to these identifiers is equivalent to inlining it where it was used, aside from side effect duplication. | |
| 65 | 65 | |
| 66 | 66 | ```lang:run |
| 67 | 67 | let hello: int = 1; |
src/core/Ast.zig+6-6| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | //! The Abstract Syntax Tree preserves most details of the source code, |
| 2 | 2 | //! as it is used for formatting. Before semantic analysis, this |
| 3 | 3 | //! structure is normalized into `Teg`, which removes constructs like |
| 4 | //! grouping, unneded let bindings, and other transforms. | |
| 4 | //! grouping, unneeded let bindings, and other transforms. | |
| 5 | 5 | //! |
| 6 | 6 | //! `ast.nodes` contains nodes stored as three parts: |
| 7 | 7 | //! - tag: the type of the node |
| 8 | //! - main_token: index to it's primary token, depends on the tag | |
| 8 | //! - main_token: index to its primary token, depends on the tag | |
| 9 | 9 | //! - data: two u32 values, depends on the tag |
| 10 | 10 | //! |
| 11 | 11 | //! Many nodes encode all their metadata with just `node.data`, using |
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | //! - If the keyword before `main_token` is `kw_pub` it is a public variable. |
| 21 | 21 | //! |
| 22 | 22 | //! To make decoding these easier, many nodes contain a "full" variant, |
| 23 | //! such as `full.VarDecl`, which can be aquired with `ast.fullVarDecl(id)`. | |
| 23 | //! such as `full.VarDecl`, which can be acquired with `ast.fullVarDecl(id)`. | |
| 24 | 24 | //! |
| 25 | 25 | //! For nodes that must store more than 64 bits of payload data, an "extra" |
| 26 | 26 | //! struct is stored out-of-line in the `extra` field. These can be read |
| ... | ... | @@ -56,7 +56,7 @@ pub const Node = struct { |
| 56 | 56 | /// main_token is the { |
| 57 | 57 | /// data is .list (containing stmt slice) |
| 58 | 58 | /// |
| 59 | /// This guarantees that the block either empty, or the last statement | |
| 59 | /// This guarantees that either the block is empty or the last statement | |
| 60 | 60 | /// ends with a semicolon. |
| 61 | 61 | block_void, |
| 62 | 62 | /// main_token is the { |
| ... | ... | @@ -332,7 +332,7 @@ pub const Node = struct { |
| 332 | 332 | extra: ExtraIndex, |
| 333 | 333 | body: NodeIndex, |
| 334 | 334 | }, |
| 335 | /// either is a node list or a token list, depending on the node's tag | |
| 335 | /// is either a node list or a token list, depending on the node's tag | |
| 336 | 336 | list: SubList, |
| 337 | 337 | var_decl: struct { |
| 338 | 338 | type: OptionalNodeIndex, |
| ... | ... | @@ -398,7 +398,7 @@ pub const Span = struct { |
| 398 | 398 | main: u32, |
| 399 | 399 | }; |
| 400 | 400 | |
| 401 | // This can be removed when the following issue is implemented: | |
| 401 | // This can be removed when the following issues are implemented: | |
| 402 | 402 | // See: https://github.com/ziglang/zig/issues/104 |
| 403 | 403 | // See: https://github.com/ziglang/zig/issues/3806 |
| 404 | 404 | pub const OptionalNodeIndex = enum(u32) { |
src/core/Cache.zig+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | |
| 3 | /// This is 128 bits - Even with 2^54 cache entries, the probably of a collision would be under 10^-6 | |
| 3 | /// This is 128 bits - Even with 2^54 cache entries, the probability of a collision would be under 10^-6 | |
| 4 | 4 | pub const bin_digest_len = 16; |
| 5 | 5 | pub const hex_digest_len = bin_digest_len * 2; |
| 6 | 6 | pub const BinDigest = [bin_digest_len]u8; |
src/core/Comp.zig+6-6| ... | ... | @@ -12,7 +12,7 @@ analyzed_instructions: usize = 0, |
| 12 | 12 | |
| 13 | 13 | options: Options = .{}, |
| 14 | 14 | |
| 15 | // TODO: consider computing this dynamicly per-link | |
| 15 | // TODO: consider computing this dynamically per-link | |
| 16 | 16 | current_compile_decls: std.ArrayListUnmanaged(Decl.Index) = .{}, |
| 17 | 17 | |
| 18 | 18 | pub fn init(comp: *Comp) !void { |
| ... | ... | @@ -60,7 +60,7 @@ pub const File = struct { |
| 60 | 60 | root_module: Decl.Index.Optional, |
| 61 | 61 | status: enum { |
| 62 | 62 | never_loader, |
| 63 | /// A failure occurred during loading the file. Retrying might succeed. | |
| 63 | /// A failure occurred while loading the file. Retrying might succeed. | |
| 64 | 64 | retryable_failure, |
| 65 | 65 | /// Errors during parse |
| 66 | 66 | parse_failure, |
| ... | ... | @@ -232,7 +232,7 @@ pub const Decl = struct { |
| 232 | 232 | teg_decl_index: InternPool.TrackedInst.Index.Optional, |
| 233 | 233 | |
| 234 | 234 | /// Represents the "shallow" analysis status. For example, for decls that are functions, |
| 235 | /// the function type is analyzed with this set to `in_progress`, however, the semantic | |
| 235 | /// the function type is analyzed with this set to `in_progress`; however, the semantic | |
| 236 | 236 | /// analysis of the function body is performed with this value set to `success`. Functions |
| 237 | 237 | /// have their own analysis status field. |
| 238 | 238 | analysis: enum { |
| ... | ... | @@ -256,10 +256,10 @@ pub const Decl = struct { |
| 256 | 256 | sema_failure, |
| 257 | 257 | /// There will be a corresponding ErrorMsg in Zcu.failed_decls. |
| 258 | 258 | codegen_failure, |
| 259 | /// Sematic analysis and constant value codegen of this Decl has | |
| 259 | /// Semantic analysis and constant value codegen of this Decl has | |
| 260 | 260 | /// succeeded. However, the Decl may be outdated due to an in-progress |
| 261 | 261 | /// update. Note that for a function, this does not mean codegen of the |
| 262 | /// function body succeded: that state is indicated by the function's | |
| 262 | /// function body succeeded: that state is indicated by the function's | |
| 263 | 263 | /// `analysis` field. |
| 264 | 264 | complete, |
| 265 | 265 | }, |
| ... | ... | @@ -268,7 +268,7 @@ pub const Decl = struct { |
| 268 | 268 | |
| 269 | 269 | is_pub: bool, |
| 270 | 270 | |
| 271 | /// What kind of a declaration is this. | |
| 271 | /// What kind of a declaration this is. | |
| 272 | 272 | kind: Kind, |
| 273 | 273 | |
| 274 | 274 | pub fn deinit(decl: *Decl, gpa: Allocator) void { |
src/core/InternPool.zig+4-4| ... | ... | @@ -8,7 +8,7 @@ items: std.MultiArrayList(Item) = .{}, |
| 8 | 8 | extra: ExtraStore = .{}, |
| 9 | 9 | |
| 10 | 10 | /// In order to store references to strings in fewer bytes, we copy all |
| 11 | /// string bytes into here. String bytes can be null. It is up to whomever | |
| 11 | /// string bytes into here. String bytes can be null. It is up to whoever | |
| 12 | 12 | /// is referencing the data here whether they want to store both index and length, |
| 13 | 13 | /// thus allowing null bytes, or store only index, and use null-termination. The |
| 14 | 14 | /// `string_bytes` array is agnostic to either usage. |
| ... | ... | @@ -69,7 +69,7 @@ pub const EncodedData = dod.EncodedData(Tag, u32); |
| 69 | 69 | pub const ExtraIndex = ExtraStore.Index; |
| 70 | 70 | |
| 71 | 71 | pub const Tag = enum(u8) { |
| 72 | /// This special tag represents a value which was removed from this pool via | |
| 72 | /// This special tag represents a value that was removed from this pool via | |
| 73 | 73 | /// `InternPool.remove`. The item remains allocated to preserve indices, but |
| 74 | 74 | /// lookups will consider it not equal to any other item, and all queries |
| 75 | 75 | /// assert not this tag. `data` is unused. |
| ... | ... | @@ -581,7 +581,7 @@ pub const TrackedInst = extern struct { |
| 581 | 581 | inst: Teg.Inst.Index, |
| 582 | 582 | |
| 583 | 583 | comptime { |
| 584 | // The fields should be tightly packed. See also serialiation logic in `Compilation.saveState`. | |
| 584 | // The fields should be tightly packed. See also serialization logic in `Compilation.saveState`. | |
| 585 | 585 | assert(@sizeOf(@This()) == Cache.bin_digest_len + @sizeOf(Teg.Inst.Index)); |
| 586 | 586 | } |
| 587 | 587 | |
| ... | ... | @@ -882,7 +882,7 @@ pub fn init(ip: *InternPool, gpa: Allocator) !void { |
| 882 | 882 | try ip.map.ensureUnusedCapacity(gpa, static_keys.len); |
| 883 | 883 | try ip.extra.list.ensureUnusedCapacity(gpa, static_keys.len); |
| 884 | 884 | |
| 885 | // This inserts all the statically-known values into the intern pool in the | |
| 885 | // This inserts all the statically known values into the intern pool in the | |
| 886 | 886 | // order expected. |
| 887 | 887 | for (static_keys) |key| { |
| 888 | 888 | _ = ip.get(gpa, key) catch unreachable; |
src/core/JsLink.zig+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /// This is the JavaScript backend's linker. |
| 2 | /// It takes in a compilation, a list of `JsTree`s and creates a JavaScript | |
| 2 | /// It takes in a compilation and a list of `JsTree`s and creates a JavaScript | |
| 3 | 3 | /// bundle out of them. |
| 4 | 4 | comp: *Comp, |
| 5 | 5 | |
| ... | ... | @@ -453,7 +453,7 @@ pub fn indexOfNeedsEscape(slice: []const u8) ?usize { |
| 453 | 453 | return null; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | // This function is loosely based off of Bun's `writeJSONString`, which | |
| 456 | // This function is loosely based on Bun's `writeJSONString`, which | |
| 457 | 457 | // is a Zig port of esbuild's `printUnquotedUTF16` function. |
| 458 | 458 | // Both projects are licensed under MIT |
| 459 | 459 | fn writeString(decoded: []const u8, writer: anytype) !void { |
src/core/Parse.zig+5-5| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | //! Parser takes a Token list and creates a Node list. It does not own the source code or |
| 2 | //! token data, however transferring into an `Ast` does move token list ownership. | |
| 2 | //! token data, but transferring into an `Ast` does move token list ownership. | |
| 3 | 3 | gpa: Allocator, |
| 4 | 4 | source: [:0]const u8, |
| 5 | 5 | token_tags: []const Token.Tag, |
| ... | ... | @@ -250,7 +250,7 @@ fn parseModuleMembers(p: *Parse) Error!SubList { |
| 250 | 250 | try p.scratch.append(p.gpa, try p.parseExpression(true)); |
| 251 | 251 | |
| 252 | 252 | switch (first_tag) { |
| 253 | // some control flow and blocks are allowed to not have a | |
| 253 | // some control flow and blocks are allowed to not have | |
| 254 | 254 | // trailing semicolons. this is a stylistic choice. |
| 255 | 255 | .kw_if, |
| 256 | 256 | .start_brace, |
| ... | ... | @@ -425,7 +425,7 @@ fn parseBlockContents(p: *Parse) Error!struct { Node.Tag, SubList } { |
| 425 | 425 | try p.scratch.append(p.gpa, try p.parseExpression(true)); |
| 426 | 426 | |
| 427 | 427 | switch (first_tag) { |
| 428 | // some control flow and blocks are allowed to not have a | |
| 428 | // some control flow and blocks are allowed to not have | |
| 429 | 429 | // trailing semicolons. this is a stylistic choice. |
| 430 | 430 | .kw_if, |
| 431 | 431 | .start_brace, |
| ... | ... | @@ -1027,13 +1027,13 @@ fn parseGroup(p: *Parse) Error!NodeIndex { |
| 1027 | 1027 | |
| 1028 | 1028 | // helpers |
| 1029 | 1029 | |
| 1030 | /// Append a node and return it's index. | |
| 1030 | /// Append a node and return its index. | |
| 1031 | 1031 | fn addNode(p: *Parse, node: Node) !NodeIndex { |
| 1032 | 1032 | const trace = t.trace(@src()); |
| 1033 | 1033 | defer trace.end(); |
| 1034 | 1034 | |
| 1035 | 1035 | try p.nodes.append(p.gpa, node); |
| 1036 | // @intCast is always safe because 2^32 tokens alwayss produce less than | |
| 1036 | // @intCast is always safe because 2^32 tokens always produce less than | |
| 1037 | 1037 | // 2^32 nodes, and there is a 2^32 limit on source file bytes. |
| 1038 | 1038 | return @intCast(p.nodes.len - 1); |
| 1039 | 1039 | } |
src/core/Report.zig+3-3| ... | ... | @@ -358,7 +358,7 @@ pub const Warn = union(enum) { |
| 358 | 358 | }, |
| 359 | 359 | }; |
| 360 | 360 | |
| 361 | /// A variant of std.builtin.StackTrace that stores it's data within itself | |
| 361 | /// A variant of std.builtin.StackTrace that stores its data within itself | |
| 362 | 362 | /// instead of being a pointer. This allows capturing the stack trace and |
| 363 | 363 | /// saving it for later printing. |
| 364 | 364 | pub const StoredTrace = struct { |
| ... | ... | @@ -603,7 +603,7 @@ pub fn dumpToStdErr(report: Report, comp: *Comp) !void { |
| 603 | 603 | const tty = std.io.tty.detectConfig(stderr); |
| 604 | 604 | |
| 605 | 605 | if (false or |
| 606 | // Windows API uses it's own API calls, so a buffered writer | |
| 606 | // Windows API uses its own API calls, so a buffered writer | |
| 607 | 607 | // cannot be used :/ |
| 608 | 608 | (builtin.os.tag == .windows and tty == .windows_api) or |
| 609 | 609 | // Debug stack trace printer writes directly to standard err, |
| ... | ... | @@ -776,7 +776,7 @@ pub const MsgContext = struct { |
| 776 | 776 | report: *const Report, |
| 777 | 777 | utf8_source: [:0]const u8, |
| 778 | 778 | |
| 779 | /// This arena is is a stack fallback with 16kb, then | |
| 779 | /// This arena is a stack fallback with 16kb, then | |
| 780 | 780 | /// falling back to an arena allocator. This should |
| 781 | 781 | /// make the cost of arbitrarily creating `Component` |
| 782 | 782 | /// nodes extremely lightweight. |
src/core/Sema.zig+1-1| ... | ... | @@ -42,7 +42,7 @@ pub const Error = error{ |
| 42 | 42 | } || Comp.File.GetTegError; |
| 43 | 43 | |
| 44 | 44 | /// Instead of using a hash map for this, just pre-allocate a list long enough to hold everything. |
| 45 | /// This is fine because all instructions are going to be adacent in a single declaration. | |
| 45 | /// This is fine because all instructions are going to be adjacent in a single declaration. | |
| 46 | 46 | const InstMap = struct { |
| 47 | 47 | items: []Air.Inst.Ref.Optional, |
| 48 | 48 | start: Teg.Inst.Index, |
src/core/Teg.zig+2-2| ... | ... | @@ -207,7 +207,7 @@ pub const Inst = struct { |
| 207 | 207 | } |
| 208 | 208 | }; |
| 209 | 209 | |
| 210 | /// A reference to instruction, or to an InternPool index, or neither. | |
| 210 | /// A reference to an instruction, or to an InternPool index, or to neither. | |
| 211 | 211 | /// |
| 212 | 212 | /// If the integer tag value is < InternPool.static_len, then it |
| 213 | 213 | /// corresponds to an InternPool index. Otherwise, this refers to a ZIR |
| ... | ... | @@ -328,7 +328,7 @@ pub const Inst = struct { |
| 328 | 328 | }; |
| 329 | 329 | }; |
| 330 | 330 | |
| 331 | /// Trailng data for function declarations | |
| 331 | /// Trailing data for function declarations | |
| 332 | 332 | pub const DeclFn = struct { |
| 333 | 333 | params: RefList, |
| 334 | 334 | return_type: Ref, |
src/core/Tokenizer.zig+10-10| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | //! The tokenizer is extremely simple structure that, given a view of source | |
| 1 | //! The tokenizer is an extremely simple structure that, given a view of source | |
| 2 | 2 | //! code, can stream tokens one at a time. A token is an 8-bit tag and a 32-bit |
| 3 | 3 | //! offset to where that token is located. |
| 4 | 4 | //! |
| 5 | //! Retriving payloads like string/numeric values, identifier names, etc is | |
| 5 | //! Retrieving payloads like string/numeric values, identifier names, etc is | |
| 6 | 6 | //! done separately, either in Parse or Transform, when the respective data |
| 7 | //! is actually needed. Tokenization does guarante that such data is valid. | |
| 7 | //! is actually needed. Tokenization does guarantee that such data is valid. | |
| 8 | 8 | code: [:0]const u8, |
| 9 | 9 | pos: ByteOffset = 0, |
| 10 | 10 | |
| ... | ... | @@ -146,7 +146,7 @@ pub const Token = struct { |
| 146 | 146 | /// Used so that parser does not need to do out of bounds checks |
| 147 | 147 | eof, |
| 148 | 148 | |
| 149 | /// Most tokens have statically known lexeme, such as "struct" or "+=" | |
| 149 | /// Most tokens have statically known lexemes, such as "struct" or "+=" | |
| 150 | 150 | pub fn lexeme(tag: Tag) ?[]const u8 { |
| 151 | 151 | return switch (tag) { |
| 152 | 152 | .invalid => unreachable, |
| ... | ... | @@ -290,7 +290,7 @@ pub const Token = struct { |
| 290 | 290 | }); |
| 291 | 291 | }; |
| 292 | 292 | |
| 293 | /// When any of these error occurs, the tokenizer's position is set to | |
| 293 | /// When any of these errors occurs, the tokenizer's position is set to | |
| 294 | 294 | /// the start of the offending token. |
| 295 | 295 | pub const NextTokenError = error{ |
| 296 | 296 | /// Generic token syntax error |
| ... | ... | @@ -525,7 +525,7 @@ fn nextByte(t: Tokenizer) u8 { |
| 525 | 525 | return t.code[t.pos + 1]; |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | /// Remember that using this only makes sense if you know for certain that all | |
| 528 | /// Remember that using this makes sense only if you know for certain that all | |
| 529 | 529 | /// previous bytes are ASCII, otherwise you may hit UB |
| 530 | 530 | fn byteAt(t: Tokenizer, comptime offset: u32) ?u8 { |
| 531 | 531 | if (offset == 1) @compileError("use nextByte()"); |
| ... | ... | @@ -940,7 +940,7 @@ fn simpleToken(t: *Tokenizer, comptime tag: Token.Tag) Token { |
| 940 | 940 | |
| 941 | 941 | /// We are about to return an error, such as error.TrailingNumericSeparator. |
| 942 | 942 | /// However, the character we ran into might actually be invalid UTF-8. |
| 943 | /// This utility just checks for that to make sure we dont mask error.InvalidUtf8 | |
| 943 | /// This utility just checks for that to make sure we don't mask error.InvalidUtf8 | |
| 944 | 944 | fn maybeUTF8Error(t: *Tokenizer, comptime real_err: anytype) @Type(.{ |
| 945 | 945 | .ErrorSet = &[_]std.builtin.Type.Error{ |
| 946 | 946 | .{ .name = "InvalidUtf8" }, |
| ... | ... | @@ -1003,7 +1003,7 @@ pub fn tokenLocation( |
| 1003 | 1003 | .line_end = @intCast(utf8_source.len), |
| 1004 | 1004 | }; |
| 1005 | 1005 | |
| 1006 | // Scan to by line until we go past the token start | |
| 1006 | // Scan by line until we go past the token start | |
| 1007 | 1007 | while (std.mem.indexOfScalarPos(u8, utf8_source, loc.line_start, '\n')) |i| { |
| 1008 | 1008 | if (i >= token_start) { |
| 1009 | 1009 | break; // Went past |
| ... | ... | @@ -1058,7 +1058,7 @@ pub fn decodeStringCount(esc: []const u8) usize { |
| 1058 | 1058 | // - 0x00 thru 0x7F -> one byte |
| 1059 | 1059 | // - 0x80 thru 0xFF -> two bytes |
| 1060 | 1060 | // |
| 1061 | // we check the second byte anyways to ensure safe modes | |
| 1061 | // we check the second byte anyway to ensure safe modes | |
| 1062 | 1062 | // catch potential invalid string literals. |
| 1063 | 1063 | 'x' => switch (esc[backslash + 3]) { |
| 1064 | 1064 | '0'...'9', 'a'...'f', 'A'...'F' => { |
| ... | ... | @@ -1105,7 +1105,7 @@ pub fn decodeStringCount(esc: []const u8) usize { |
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | /// Given a valid string literal contents (excluding the quotes), write |
| 1108 | /// it's decoded form (WTF-8) into the buf. | |
| 1108 | /// its decoded form (WTF-8) into the buf. | |
| 1109 | 1109 | pub fn decodeStringBuf(esc: []const u8, buf: []u8) []u8 { |
| 1110 | 1110 | var result_i: usize = 0; |
| 1111 | 1111 | var i: usize = 0; |
src/core/Transform.zig+3-3| ... | ... | @@ -144,7 +144,7 @@ const BlockContext = struct { |
| 144 | 144 | /// mutable pointers to it. When `break :brk` is encountered |
| 145 | 145 | const BreakTarget = struct { |
| 146 | 146 | label: ?[]const u8, |
| 147 | /// This allows `continue` as well as implicit break targetting. | |
| 147 | /// This allows `continue` as well as implicit break targeting. | |
| 148 | 148 | is_loop: bool, |
| 149 | 149 | /// If `null`, this label was unused. |
| 150 | 150 | block_index: ?Inst.Index = null, |
| ... | ... | @@ -711,7 +711,7 @@ fn transformExpression(t: *Transform, decl: BlockContext, node: NodeIndex) Alloc |
| 711 | 711 | }), |
| 712 | 712 | .mutable => |idx| idx.toRef(), |
| 713 | 713 | .immutable => |ref| ref, |
| 714 | .param => unreachable, //unresolved param | |
| 714 | .param => unreachable, // unresolved param | |
| 715 | 715 | }; |
| 716 | 716 | }, |
| 717 | 717 | |
| ... | ... | @@ -1038,7 +1038,7 @@ fn transformExpression(t: *Transform, decl: BlockContext, node: NodeIndex) Alloc |
| 1038 | 1038 | |
| 1039 | 1039 | if (yes == .void and no == .void) { |
| 1040 | 1040 | // when both branches do nothing, we can omit the branch, |
| 1041 | // however we still need to type-check the condition operand | |
| 1041 | // but we still need to type-check the condition operand | |
| 1042 | 1042 | _ = try t.addInstRef(.{ |
| 1043 | 1043 | .tag = .ensure_bool, |
| 1044 | 1044 | .data = EncodedData.encode(.ensure_bool, .{ |