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

cgen: minor cleanup in stmt() (#14763)

This commit is contained in:
yuyi 2022-06-15 22:44:00 +08:00 committed by GitHub
parent 5135952c9c
commit 0c1708db23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -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
}

View File

@ -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 ')

View File

@ -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')