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

parser: fix dollar (closes #14292) (#14378)

This commit is contained in:
Daniel Däschle 2022-05-13 07:30:10 +02:00 committed by GitHub
parent ed12a5c84c
commit d407a6449d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -663,6 +663,9 @@ pub fn (mut p Parser) top_stmt() ast.Stmt {
return p.struct_decl()
}
.dollar {
if p.peek_tok.kind == .eof {
return p.error('unexpected eof')
}
if_expr := p.if_expr(true)
return ast.ExprStmt{
expr: if_expr

View File

@ -0,0 +1,3 @@
vlib/v/parser/tests/dollar_err.vv:1:1: error: unexpected eof, expecting `if`
1 | $
| ^

View File

@ -0,0 +1 @@
$