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

parser: fix -5.str() precedence

This commit is contained in:
yuyi 2020-05-21 05:26:23 +08:00 committed by GitHub
parent cd07429cc1
commit b8c028c727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -7,7 +7,6 @@ import v.pref
const (
skip_test_files = [
'vlib/v/tests/enum_bitfield_test.v',
'vlib/v/tests/num_lit_call_method_test.v',
'vlib/v/tests/pointers_test.v',
'vlib/v/tests/pointers_str_test.v',
'vlib/net/http/http_httpbin_test.v',

View File

@ -220,7 +220,12 @@ fn (mut p Parser) prefix_expr() ast.PrefixExpr {
// p.warn('unsafe')
// }
p.next()
right := p.expr(token.Precedence.prefix)
mut right := ast.Expr{}
if op == .minus {
right = p.expr(token.Precedence.call)
} else {
right = p.expr(token.Precedence.prefix)
}
p.is_amp = false
return ast.PrefixExpr{
op: op