cgen: fix math/complex_test.v
parent
682c619456
commit
956651384c
|
@ -16,7 +16,6 @@ const (
|
||||||
'vlib/eventbus/eventbus_test.v',
|
'vlib/eventbus/eventbus_test.v',
|
||||||
'vlib/flag/flag_test.v',
|
'vlib/flag/flag_test.v',
|
||||||
'vlib/json/json_test.v',
|
'vlib/json/json_test.v',
|
||||||
'vlib/math/complex/complex_test.v',
|
|
||||||
'vlib/net/ftp/ftp_test.v',
|
'vlib/net/ftp/ftp_test.v',
|
||||||
'vlib/net/http/http_httpbin_test.v',
|
'vlib/net/http/http_httpbin_test.v',
|
||||||
'vlib/net/http/http_test.v',
|
'vlib/net/http/http_test.v',
|
||||||
|
|
|
@ -2189,9 +2189,11 @@ fn (g mut Gen) string_inter_literal(node ast.StringInterLiteral) {
|
||||||
verror('only V strings can be formatted with a ${sfmt} format')
|
verror('only V strings can be formatted with a ${sfmt} format')
|
||||||
}
|
}
|
||||||
g.write('%' + sfmt[1..])
|
g.write('%' + sfmt[1..])
|
||||||
} else if node.expr_types[i] in [table.string_type, table.bool_type, table.f32_type,
|
} else if node.expr_types[i] in [table.string_type, table.bool_type] ||
|
||||||
table.f64_type] || sym.kind in [.enum_, .array, .array_fixed] {
|
sym.kind in [.enum_, .array, .array_fixed] {
|
||||||
g.write('%.*s')
|
g.write('%.*s')
|
||||||
|
} else if node.expr_types[i] in [table.f32_type, table.f64_type] {
|
||||||
|
g.write('%f')
|
||||||
} else {
|
} else {
|
||||||
g.write('%d')
|
g.write('%d')
|
||||||
}
|
}
|
||||||
|
@ -2219,6 +2221,8 @@ fn (g mut Gen) string_inter_literal(node ast.StringInterLiteral) {
|
||||||
g.write(' ? 4 : 5, ')
|
g.write(' ? 4 : 5, ')
|
||||||
g.expr(expr)
|
g.expr(expr)
|
||||||
g.write(' ? "true" : "false"')
|
g.write(' ? "true" : "false"')
|
||||||
|
} else if node.expr_types[i] in [table.f32_type, table.f64_type] {
|
||||||
|
g.expr(expr)
|
||||||
} else {
|
} else {
|
||||||
sym := g.table.get_type_symbol(node.expr_types[i])
|
sym := g.table.get_type_symbol(node.expr_types[i])
|
||||||
if sym.kind == .enum_ {
|
if sym.kind == .enum_ {
|
||||||
|
@ -2252,8 +2256,7 @@ fn (g mut Gen) string_inter_literal(node ast.StringInterLiteral) {
|
||||||
g.enum_expr(expr)
|
g.enum_expr(expr)
|
||||||
g.write('"')
|
g.write('"')
|
||||||
}
|
}
|
||||||
} else if node.expr_types[i] in [table.f32_type, table.f64_type, table.array_type,
|
} else if sym.kind in [.array, .array_fixed] {
|
||||||
table.map_type] || sym.kind in [.array, .array_fixed] {
|
|
||||||
styp := g.typ(node.expr_types[i])
|
styp := g.typ(node.expr_types[i])
|
||||||
g.write('${styp}_str(')
|
g.write('${styp}_str(')
|
||||||
g.expr(expr)
|
g.expr(expr)
|
||||||
|
|
Loading…
Reference in New Issue