parser: fix -5.str() precedence

pull/4967/head
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 ( const (
skip_test_files = [ skip_test_files = [
'vlib/v/tests/enum_bitfield_test.v', '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_test.v',
'vlib/v/tests/pointers_str_test.v', 'vlib/v/tests/pointers_str_test.v',
'vlib/net/http/http_httpbin_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.warn('unsafe')
// } // }
p.next() 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 p.is_amp = false
return ast.PrefixExpr{ return ast.PrefixExpr{
op: op op: op