cgen: minor cleanup in stmt() (#14763)
parent
5135952c9c
commit
0c1708db23
|
@ -5,7 +5,7 @@ module c
|
|||
|
||||
import v.ast
|
||||
|
||||
fn (mut g Gen) gen_assert_stmt(original_assert_statement ast.AssertStmt) {
|
||||
fn (mut g Gen) assert_stmt(original_assert_statement ast.AssertStmt) {
|
||||
if !original_assert_statement.is_used {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import v.ast
|
|||
import v.util
|
||||
import v.token
|
||||
|
||||
fn (mut g Gen) gen_assign_stmt(node_ ast.AssignStmt) {
|
||||
fn (mut g Gen) assign_stmt(node_ ast.AssignStmt) {
|
||||
mut node := unsafe { node_ }
|
||||
if node.is_static {
|
||||
g.write('static ')
|
||||
|
|
|
@ -1630,18 +1630,17 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
|||
g.set_current_pos_as_last_stmt_pos()
|
||||
}
|
||||
match node {
|
||||
ast.EmptyStmt {}
|
||||
ast.AsmStmt {
|
||||
g.write_v_source_line_info(node.pos)
|
||||
g.gen_asm_stmt(node)
|
||||
g.asm_stmt(node)
|
||||
}
|
||||
ast.AssertStmt {
|
||||
g.write_v_source_line_info(node.pos)
|
||||
g.gen_assert_stmt(node)
|
||||
g.assert_stmt(node)
|
||||
}
|
||||
ast.AssignStmt {
|
||||
g.write_v_source_line_info(node.pos)
|
||||
g.gen_assign_stmt(node)
|
||||
g.assign_stmt(node)
|
||||
}
|
||||
ast.Block {
|
||||
g.write_v_source_line_info(node.pos)
|
||||
|
@ -1729,6 +1728,7 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
|||
g.writeln('${g.defer_flag_var(defer_stmt)} = true;')
|
||||
g.defer_stmts << defer_stmt
|
||||
}
|
||||
ast.EmptyStmt {}
|
||||
ast.EnumDecl {
|
||||
g.enum_decl(node)
|
||||
}
|
||||
|
@ -2278,7 +2278,7 @@ fn (mut g Gen) gen_attrs(attrs []ast.Attr) {
|
|||
}
|
||||
}
|
||||
|
||||
fn (mut g Gen) gen_asm_stmt(stmt ast.AsmStmt) {
|
||||
fn (mut g Gen) asm_stmt(stmt ast.AsmStmt) {
|
||||
g.write('__asm__')
|
||||
if stmt.is_volatile {
|
||||
g.write(' volatile')
|
||||
|
|
Loading…
Reference in New Issue