1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: temporary c2v const fix

This commit is contained in:
Alexander Medvednikov 2022-05-04 08:28:24 +03:00
parent f321422964
commit 3d4b8dffdf

View File

@ -1187,7 +1187,9 @@ fn (mut c Checker) fail_if_immutable(expr_ ast.Expr) (string, token.Pos) {
} }
} }
} else if expr.obj is ast.ConstField && expr.name in c.const_names { } else if expr.obj is ast.ConstField && expr.name in c.const_names {
if !c.inside_unsafe { if !c.inside_unsafe && !c.pref.translated {
// TODO fix this in c2v, do not allow modification of all consts
// in translated code
c.error('cannot modify constant `$expr.name`', expr.pos) c.error('cannot modify constant `$expr.name`', expr.pos)
} }
} }