diff options
| author | Veikka Tuominen <git@vexu.eu> | 2023-01-24 13:35:10 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-10-16 04:08:45 -0400 |
| commit | 78855bd21866b515018259a2194e036e4b3120df (patch) | |
| tree | 9d5df7cd0e5d909163475a5bdb30c94794460321 /src/Module.zig | |
| parent | fbd90e487b4abe32422dc997467b1d81ad574d5d (diff) | |
| download | zig-78855bd21866b515018259a2194e036e4b3120df.tar.gz zig-78855bd21866b515018259a2194e036e4b3120df.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); |
