mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: fix pointer cast expressions hack (#10777)
This commit is contained in:
@@ -560,7 +560,7 @@ fn (p &Parser) fileis(s string) bool {
|
||||
return p.file_name.contains(s)
|
||||
}
|
||||
|
||||
fn (mut p Parser) prefix_expr() ast.PrefixExpr {
|
||||
fn (mut p Parser) prefix_expr() ast.Expr {
|
||||
mut pos := p.tok.position()
|
||||
op := p.tok.kind
|
||||
if op == .amp {
|
||||
@@ -576,8 +576,11 @@ fn (mut p Parser) prefix_expr() ast.PrefixExpr {
|
||||
p.next()
|
||||
mut right := p.expr(int(token.Precedence.prefix))
|
||||
p.is_amp = false
|
||||
if mut right is ast.CastExpr {
|
||||
right.in_prexpr = true
|
||||
if mut right is ast.CastExpr && op == .amp {
|
||||
return ast.CastExpr{
|
||||
...right
|
||||
pos: pos.extend(right.pos)
|
||||
}
|
||||
}
|
||||
mut or_stmts := []ast.Stmt{}
|
||||
mut or_kind := ast.OrKind.absent
|
||||
|
||||
Reference in New Issue
Block a user