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

vfmt: fix asm volatile & goto (#9688)

This commit is contained in:
Louis Schmieder 2021-04-11 22:32:28 +02:00 committed by GitHub
parent a851901620
commit 273655ecc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View File

@ -668,7 +668,13 @@ fn expr_is_single_line(expr ast.Expr) bool {
//=== Specific Stmt methods ===//
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++
for template in stmt.templates {
if template.is_directive {
@ -678,8 +684,10 @@ fn (mut f Fmt) asm_stmt(stmt ast.AsmStmt) {
if template.is_label {
f.write(':')
} else {
if template.args.len > 0 {
f.write(' ')
}
}
for i, arg in template.args {
f.asm_arg(arg)
if i + 1 < template.args.len {