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

cgen: generate indents for more readable C code

This commit is contained in:
Alexander Medvednikov
2020-03-22 10:12:43 +01:00
parent 53a9329ab6
commit ab3f6d9202
5 changed files with 54 additions and 31 deletions

View File

@@ -14,11 +14,13 @@ pub fn (p mut Parser) comp_if() ast.CompIf {
if p.tok.kind == .question {
p.next()
}
p.parse_block()
mut node := ast.CompIf{
stmts: p.parse_block()
}
if p.tok.kind == .dollar && p.peek_tok.kind == .key_else {
p.next()
p.check(.key_else)
p.parse_block()
node.else_stmts = p.parse_block()
}
return ast.CompIf{}
return node
}