vfmt: fix asm volatile & goto (#9688)
parent
a851901620
commit
273655ecc8
|
@ -668,7 +668,13 @@ fn expr_is_single_line(expr ast.Expr) bool {
|
||||||
//=== Specific Stmt methods ===//
|
//=== Specific Stmt methods ===//
|
||||||
|
|
||||||
fn (mut f Fmt) asm_stmt(stmt ast.AsmStmt) {
|
fn (mut f Fmt) asm_stmt(stmt ast.AsmStmt) {
|
||||||
f.writeln('asm $stmt.arch {')
|
f.write('asm ')
|
||||||
|
if stmt.is_volatile {
|
||||||
|
f.write('volatile ')
|
||||||
|
} else if stmt.is_goto {
|
||||||
|
f.write('goto ')
|
||||||
|
}
|
||||||
|
f.writeln('$stmt.arch {')
|
||||||
f.indent++
|
f.indent++
|
||||||
for template in stmt.templates {
|
for template in stmt.templates {
|
||||||
if template.is_directive {
|
if template.is_directive {
|
||||||
|
@ -678,8 +684,10 @@ fn (mut f Fmt) asm_stmt(stmt ast.AsmStmt) {
|
||||||
if template.is_label {
|
if template.is_label {
|
||||||
f.write(':')
|
f.write(':')
|
||||||
} else {
|
} else {
|
||||||
|
if template.args.len > 0 {
|
||||||
f.write(' ')
|
f.write(' ')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for i, arg in template.args {
|
for i, arg in template.args {
|
||||||
f.asm_arg(arg)
|
f.asm_arg(arg)
|
||||||
if i + 1 < template.args.len {
|
if i + 1 < template.args.len {
|
||||||
|
|
Loading…
Reference in New Issue