diff options
| author | Veikka Tuominen <git@vexu.eu> | 2023-01-24 13:35:10 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-10-21 12:36:29 +0300 |
| commit | bf61c5c0656e3b2198fb009fe5cc59f55263ceae (patch) | |
| tree | d72d4f475af2d6ba6cbc4080ecb6e8b0d7a24c3d /src/Module.zig | |
| parent | 3d6e63337164b42fec4df55687071be38d33dce9 (diff) | |
| download | zig-bf61c5c0656e3b2198fb009fe5cc59f55263ceae.tar.gz zig-bf61c5c0656e3b2198fb009fe5cc59f55263ceae.zip | |
make distinct error limit configurable
Closes #786
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig index 41f4ec2b41..36d9a4284c 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -137,6 +137,9 @@ deletion_set: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .{}, /// Key is the error name, index is the error tag value. Index 0 has a length-0 string. global_error_set: GlobalErrorSet = .{}, +/// Maximum amount of distinct error values, set by --error-limit +error_limit: ErrorInt, + /// Incrementing integer used to compare against the corresponding Decl /// field to determine whether a Decl's status applies to an ongoing update, or a /// previous analysis. @@ -5020,6 +5023,11 @@ pub fn getErrorValueFromSlice( return getErrorValue(mod, interned_name); } +pub fn errorSetBits(mod: *Module) u16 { + if (mod.error_limit == 0) return 0; + return std.math.log2_int_ceil(ErrorInt, mod.error_limit + 1); // +1 for no error +} + pub fn createAnonymousDecl(mod: *Module, block: *Sema.Block, typed_value: TypedValue) !Decl.Index { const src_decl = mod.declPtr(block.src_decl); return mod.createAnonymousDeclFromDecl(src_decl, block.namespace, block.wip_capture_scope, typed_value); |
