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

v.gen.c: do not use precomputed const values in -usecache mode (fix v test-all on M1)

This commit is contained in:
Delyan Angelov 2021-07-20 17:13:01 +03:00
parent 3f5e3c4bfe
commit 24c59881f5

View File

@ -4905,11 +4905,13 @@ fn (mut g Gen) const_decl(node ast.ConstDecl) {
} }
} }
else { else {
if g.pref.build_mode != .build_module {
if ct_value := field.comptime_expr_value() { if ct_value := field.comptime_expr_value() {
if g.const_decl_precomputed(field.mod, name, ct_value, field.typ) { if g.const_decl_precomputed(field.mod, name, ct_value, field.typ) {
continue continue
} }
} }
}
if field.is_simple_define_const() { if field.is_simple_define_const() {
// "Simple" expressions are not going to need multiple statements, // "Simple" expressions are not going to need multiple statements,
// only the ones which are inited later, so it's safe to use expr_string // only the ones which are inited later, so it's safe to use expr_string