mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix null termination bug gen tests to fail
This commit is contained in:
parent
28fc9d332c
commit
cfeafb9ab4
@ -1159,13 +1159,14 @@ fn (g mut Gen) const_decl(node ast.ConstDecl) {
|
|||||||
g.write('//')
|
g.write('//')
|
||||||
pos := g.out.len
|
pos := g.out.len
|
||||||
g.expr(expr)
|
g.expr(expr)
|
||||||
g.writeln('')
|
mut b := g.out.buf[pos..g.out.buf.len].clone()
|
||||||
b := g.out.buf[pos..g.out.buf.len].clone()
|
b << `\0`
|
||||||
val := string(b)
|
val := string(b)
|
||||||
// val += '\0'
|
// val += '\0'
|
||||||
// g.out.go_back(val.len)
|
// g.out.go_back(val.len)
|
||||||
// println('pos=$pos buf.len=$g.out.buf.len len=$g.out.len val.len=$val.len val="$val"\n')
|
// println('pos=$pos buf.len=$g.out.buf.len len=$g.out.len val.len=$val.len val="$val"\n')
|
||||||
g.definitions.write(val)
|
g.writeln('')
|
||||||
|
g.definitions.writeln(val)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
styp := g.typ(field.typ)
|
styp := g.typ(field.typ)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user