cgen: clean up ternary
parent
24b263cf87
commit
ef46fbb96f
|
@ -562,17 +562,17 @@ fn (mut g Gen) decrement_inside_ternary() {
|
||||||
fn (mut g Gen) stmts(stmts []ast.Stmt) {
|
fn (mut g Gen) stmts(stmts []ast.Stmt) {
|
||||||
g.indent++
|
g.indent++
|
||||||
if g.inside_ternary > 0 {
|
if g.inside_ternary > 0 {
|
||||||
g.writeln('(')
|
g.write('(')
|
||||||
}
|
}
|
||||||
for i, stmt in stmts {
|
for i, stmt in stmts {
|
||||||
g.stmt(stmt)
|
g.stmt(stmt)
|
||||||
if g.inside_ternary > 0 && i < stmts.len - 1 {
|
if g.inside_ternary > 0 && i < stmts.len - 1 {
|
||||||
g.writeln(',')
|
g.write(',')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g.indent--
|
g.indent--
|
||||||
if g.inside_ternary > 0 {
|
if g.inside_ternary > 0 {
|
||||||
g.writeln('')
|
g.write('')
|
||||||
g.write(')')
|
g.write(')')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,8 +113,9 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl) {
|
||||||
g.write('static ')
|
g.write('static ')
|
||||||
g.definitions.write('static ')
|
g.definitions.write('static ')
|
||||||
}
|
}
|
||||||
g.definitions.write('$type_name $msvc_attrs ${name}(')
|
fn_header := if msvc_attrs.len > 0 { '$type_name $msvc_attrs ${name}(' } else { '$type_name ${name}(' }
|
||||||
g.write('$type_name $msvc_attrs ${name}(')
|
g.definitions.write(fn_header)
|
||||||
|
g.write(fn_header)
|
||||||
}
|
}
|
||||||
fargs, fargtypes := g.fn_args(it.args, it.is_variadic)
|
fargs, fargtypes := g.fn_args(it.args, it.is_variadic)
|
||||||
if it.no_body || (g.pref.use_cache && it.is_builtin) {
|
if it.no_body || (g.pref.use_cache && it.is_builtin) {
|
||||||
|
@ -777,4 +778,3 @@ fn (mut g Gen) write_fn_attr() string{
|
||||||
return msvc_attrs
|
return msvc_attrs
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue