mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix embed file to_string() in if guard (#16334)
This commit is contained in:
parent
e1896ffd5b
commit
131d07aede
1
vlib/v/embed_file/tests/a.txt
Normal file
1
vlib/v/embed_file/tests/a.txt
Normal file
@ -0,0 +1 @@
|
||||
test
|
9
vlib/v/embed_file/tests/embed_file_to_string_test.v
Normal file
9
vlib/v/embed_file/tests/embed_file_to_string_test.v
Normal file
@ -0,0 +1,9 @@
|
||||
fn test_embed_file_to_string() {
|
||||
s := if true {
|
||||
$embed_file('./a.txt').to_string()
|
||||
} else {
|
||||
''
|
||||
}
|
||||
println(s)
|
||||
assert s.trim_space() == 'test'
|
||||
}
|
@ -1002,7 +1002,7 @@ pub fn (mut p Parser) stmt(is_top_level bool) ast.Stmt {
|
||||
}
|
||||
.name {
|
||||
mut pos := p.tok.pos()
|
||||
expr := p.comptime_call()
|
||||
expr := p.expr(0)
|
||||
pos.update_last_line(p.prev_tok.line_nr)
|
||||
return ast.ExprStmt{
|
||||
expr: expr
|
||||
|
Loading…
Reference in New Issue
Block a user