mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
checker: cleanup err
removal (#25043)
Some checks are pending
Graphics CI / gg-regressions (push) Waiting to run
vlib modules CI / build-module-docs (push) Waiting to run
native backend CI / native-backend-ubuntu (push) Waiting to run
native backend CI / native-backend-windows (push) Waiting to run
Shy and PV CI / v-compiles-puzzle-vibes (push) Waiting to run
Sanitized CI / sanitize-undefined-gcc (push) Waiting to run
Sanitized CI / sanitize-undefined-clang (push) Waiting to run
Sanitized CI / tests-sanitize-address-clang (push) Waiting to run
Sanitized CI / sanitize-address-msvc (push) Waiting to run
Sanitized CI / sanitize-address-gcc (push) Waiting to run
Sanitized CI / sanitize-memory-clang (push) Waiting to run
sdl CI / v-compiles-sdl-examples (push) Waiting to run
Time CI / time-linux (push) Waiting to run
Time CI / time-macos (push) Waiting to run
Time CI / time-windows (push) Waiting to run
toml CI / toml-module-pass-external-test-suites (push) Waiting to run
Tools CI / tools-linux (clang) (push) Waiting to run
Tools CI / tools-linux (gcc) (push) Waiting to run
Tools CI / tools-linux (tcc) (push) Waiting to run
Tools CI / tools-macos (clang) (push) Waiting to run
Tools CI / tools-windows (gcc) (push) Waiting to run
Tools CI / tools-windows (msvc) (push) Waiting to run
Tools CI / tools-windows (tcc) (push) Waiting to run
Tools CI / tools-docker-ubuntu-musl (push) Waiting to run
vab CI / v-compiles-os-android (push) Waiting to run
vab CI / vab-compiles-v-examples (push) Waiting to run
wasm backend CI / wasm-backend (ubuntu-22.04) (push) Waiting to run
wasm backend CI / wasm-backend (windows-2022) (push) Waiting to run
Some checks are pending
Graphics CI / gg-regressions (push) Waiting to run
vlib modules CI / build-module-docs (push) Waiting to run
native backend CI / native-backend-ubuntu (push) Waiting to run
native backend CI / native-backend-windows (push) Waiting to run
Shy and PV CI / v-compiles-puzzle-vibes (push) Waiting to run
Sanitized CI / sanitize-undefined-gcc (push) Waiting to run
Sanitized CI / sanitize-undefined-clang (push) Waiting to run
Sanitized CI / tests-sanitize-address-clang (push) Waiting to run
Sanitized CI / sanitize-address-msvc (push) Waiting to run
Sanitized CI / sanitize-address-gcc (push) Waiting to run
Sanitized CI / sanitize-memory-clang (push) Waiting to run
sdl CI / v-compiles-sdl-examples (push) Waiting to run
Time CI / time-linux (push) Waiting to run
Time CI / time-macos (push) Waiting to run
Time CI / time-windows (push) Waiting to run
toml CI / toml-module-pass-external-test-suites (push) Waiting to run
Tools CI / tools-linux (clang) (push) Waiting to run
Tools CI / tools-linux (gcc) (push) Waiting to run
Tools CI / tools-linux (tcc) (push) Waiting to run
Tools CI / tools-macos (clang) (push) Waiting to run
Tools CI / tools-windows (gcc) (push) Waiting to run
Tools CI / tools-windows (msvc) (push) Waiting to run
Tools CI / tools-windows (tcc) (push) Waiting to run
Tools CI / tools-docker-ubuntu-musl (push) Waiting to run
vab CI / v-compiles-os-android (push) Waiting to run
vab CI / vab-compiles-v-examples (push) Waiting to run
wasm backend CI / wasm-backend (ubuntu-22.04) (push) Waiting to run
wasm backend CI / wasm-backend (windows-2022) (push) Waiting to run
This commit is contained in:
parent
5c5566eca4
commit
af89eb27c7
3 changed files with 6 additions and 6 deletions
|
@ -3812,15 +3812,15 @@ fn (mut c Checker) check_for_mut_receiver(mut expr ast.Expr) (string, token.Pos)
|
|||
}
|
||||
|
||||
fn scope_register_it(mut s ast.Scope, pos token.Pos, typ ast.Type) {
|
||||
scope_register_var_name(mut s, pos, typ, 'it')
|
||||
scope_register_special_var_name(mut s, pos, typ, 'it')
|
||||
}
|
||||
|
||||
fn scope_register_a_b(mut s ast.Scope, pos token.Pos, typ ast.Type) {
|
||||
scope_register_var_name(mut s, pos, typ.ref(), 'a')
|
||||
scope_register_var_name(mut s, pos, typ.ref(), 'b')
|
||||
scope_register_special_var_name(mut s, pos, typ.ref(), 'a')
|
||||
scope_register_special_var_name(mut s, pos, typ.ref(), 'b')
|
||||
}
|
||||
|
||||
fn scope_register_var_name(mut s ast.Scope, pos token.Pos, typ ast.Type, name string) {
|
||||
fn scope_register_special_var_name(mut s ast.Scope, pos token.Pos, typ ast.Type, name string) {
|
||||
s.register(ast.Var{
|
||||
name: name
|
||||
pos: pos
|
||||
|
|
|
@ -7177,7 +7177,7 @@ fn (mut g Gen) or_block(var_name string, or_block ast.OrExpr, return_type ast.Ty
|
|||
}
|
||||
if or_block.kind == .block {
|
||||
g.or_expr_return_type = return_type.clear_option_and_result()
|
||||
if !g.pref.skip_unused || or_block.err_used
|
||||
if or_block.err_used
|
||||
|| (g.fn_decl != unsafe { nil } && (g.fn_decl.is_main || g.fn_decl.is_test)) {
|
||||
g.writeln('\tIError err = ${cvar_name}${tmp_op}err;')
|
||||
}
|
||||
|
|
|
@ -311,7 +311,7 @@ fn (mut g Gen) if_expr(node ast.IfExpr) {
|
|||
// define `err` for the last branch after a `if val := opt {...}' guard
|
||||
if is_guard && guard_idx == i - 1 {
|
||||
if err_var := branch.scope.find_var('err') {
|
||||
if !g.pref.skip_unused || err_var.is_used {
|
||||
if err_var.is_used {
|
||||
cvar_name := guard_vars[guard_idx]
|
||||
g.writeln('\tIError err = ${cvar_name}.err;')
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue