mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ast: CompIf position
This commit is contained in:
parent
ab3f6d9202
commit
7b689d8c52
@ -388,6 +388,7 @@ pub struct CompIf {
|
||||
pub:
|
||||
cond Expr
|
||||
stmts []Stmt
|
||||
pos token.Position
|
||||
mut:
|
||||
else_stmts []Stmt
|
||||
}
|
||||
|
@ -259,10 +259,11 @@ fn (g mut Gen) stmt(node ast.Stmt) {
|
||||
g.const_decl(it)
|
||||
}
|
||||
ast.CompIf {
|
||||
// TODO
|
||||
g.writeln('//#ifdef ')
|
||||
// g.expr(it.cond)
|
||||
// println('comp if stmts $g.file.path:$it.pos.line_nr')
|
||||
// g.stmts(it.stmts)
|
||||
// println('done')
|
||||
g.writeln('//#endif')
|
||||
}
|
||||
ast.DeferStmt {
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
)
|
||||
|
||||
pub fn (p mut Parser) comp_if() ast.CompIf {
|
||||
pos := p.tok.position()
|
||||
p.next()
|
||||
p.check(.key_if)
|
||||
if p.tok.kind == .not {
|
||||
@ -16,6 +17,7 @@ pub fn (p mut Parser) comp_if() ast.CompIf {
|
||||
}
|
||||
mut node := ast.CompIf{
|
||||
stmts: p.parse_block()
|
||||
pos: pos
|
||||
}
|
||||
if p.tok.kind == .dollar && p.peek_tok.kind == .key_else {
|
||||
p.next()
|
||||
|
Loading…
Reference in New Issue
Block a user