Skip to content

Commit

Permalink
cgen: fix err message for if _ := m[key] {
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed Oct 14, 2024
1 parent e48e3c7 commit 5c65e58
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vlib/v/gen/c/index.v
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ fn (mut g Gen) index_of_map(node ast.IndexExpr, sym ast.TypeSymbol) {
g.writeln('if (${tmp_opt_ptr}) {')
g.writeln('\t*((${val_type_str}*)&${tmp_opt}.data) = *((${val_type_str}*)${tmp_opt_ptr});')
g.writeln('} else {')
g.writeln('\t${tmp_opt}.state = 2; ${tmp_opt}.err = _v_error(_SLIT("array index out of range"));')
g.writeln('\t${tmp_opt}.state = 2; ${tmp_opt}.err = _v_error(_SLIT("map key does not exist"));')
g.writeln('}')
if !node.is_option {
g.or_block(tmp_opt, node.or_expr, val_type)
Expand Down

0 comments on commit 5c65e58

Please sign in to comment.