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

cgen: use c_name() for escaping goto label names too

This commit is contained in:
Delyan Angelov 2021-12-11 19:41:44 +02:00
parent 9e68a03f94
commit fe14e2fceb
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 5 additions and 5 deletions

View File

@ -93,7 +93,7 @@ pub fn gamma(a f64) f64 {
for x < 0 {
if x > -1e-09 {
unsafe {
goto small_
goto small
}
}
z = z / x
@ -102,7 +102,7 @@ pub fn gamma(a f64) f64 {
for x < 2 {
if x < 1e-09 {
unsafe {
goto small_
goto small
}
}
z = z / x
@ -119,7 +119,7 @@ pub fn gamma(a f64) f64 {
if true {
return z * p / q
}
small_:
small:
if x == 0 {
return inf(1)
}

View File

@ -1675,11 +1675,11 @@ fn (mut g Gen) stmt(node ast.Stmt) {
g.global_decl(node)
}
ast.GotoLabel {
g.writeln('$node.name: {}')
g.writeln('${c_name(node.name)}: {}')
}
ast.GotoStmt {
g.write_v_source_line_info(node.pos)
g.writeln('goto $node.name;')
g.writeln('goto ${c_name(node.name)};')
}
ast.HashStmt {
mut ct_condition := ''