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:
|
pub:
|
||||||
cond Expr
|
cond Expr
|
||||||
stmts []Stmt
|
stmts []Stmt
|
||||||
|
pos token.Position
|
||||||
mut:
|
mut:
|
||||||
else_stmts []Stmt
|
else_stmts []Stmt
|
||||||
}
|
}
|
||||||
|
@ -259,10 +259,11 @@ fn (g mut Gen) stmt(node ast.Stmt) {
|
|||||||
g.const_decl(it)
|
g.const_decl(it)
|
||||||
}
|
}
|
||||||
ast.CompIf {
|
ast.CompIf {
|
||||||
// TODO
|
|
||||||
g.writeln('//#ifdef ')
|
g.writeln('//#ifdef ')
|
||||||
// g.expr(it.cond)
|
// g.expr(it.cond)
|
||||||
|
// println('comp if stmts $g.file.path:$it.pos.line_nr')
|
||||||
// g.stmts(it.stmts)
|
// g.stmts(it.stmts)
|
||||||
|
// println('done')
|
||||||
g.writeln('//#endif')
|
g.writeln('//#endif')
|
||||||
}
|
}
|
||||||
ast.DeferStmt {
|
ast.DeferStmt {
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
pub fn (p mut Parser) comp_if() ast.CompIf {
|
pub fn (p mut Parser) comp_if() ast.CompIf {
|
||||||
|
pos := p.tok.position()
|
||||||
p.next()
|
p.next()
|
||||||
p.check(.key_if)
|
p.check(.key_if)
|
||||||
if p.tok.kind == .not {
|
if p.tok.kind == .not {
|
||||||
@ -16,6 +17,7 @@ pub fn (p mut Parser) comp_if() ast.CompIf {
|
|||||||
}
|
}
|
||||||
mut node := ast.CompIf{
|
mut node := ast.CompIf{
|
||||||
stmts: p.parse_block()
|
stmts: p.parse_block()
|
||||||
|
pos: pos
|
||||||
}
|
}
|
||||||
if p.tok.kind == .dollar && p.peek_tok.kind == .key_else {
|
if p.tok.kind == .dollar && p.peek_tok.kind == .key_else {
|
||||||
p.next()
|
p.next()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user