mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: use -1
for *really* no precedence, since &
and |
have precedence 0
This commit is contained in:
parent
3bb6b6c8b2
commit
bdecbc1945
@ -145,7 +145,7 @@ fn (mut f Fmt) adjust_complete_line() {
|
||||
for i, buf in f.expr_bufs {
|
||||
// search for low penalties
|
||||
if i == 0 || f.penalties[i-1] <= 1 {
|
||||
precedence := if i == 0 { 0 } else { f.precedences[i-1] }
|
||||
precedence := if i == 0 { -1 } else { f.precedences[i-1] }
|
||||
mut len_sub_expr := if i == 0 { buf.len + f.line_len } else { buf.len }
|
||||
mut sub_expr_end_idx := f.penalties.len
|
||||
// search for next position with low penalty and same precedence to form subexpression
|
||||
|
@ -70,3 +70,7 @@ fn (mut p Parser) name_expr() {
|
||||
println(p.peek_tok.lit)
|
||||
}
|
||||
}
|
||||
|
||||
fn set_nr_muls(t table.Type, nr_muls int) table.Type {
|
||||
return int(t) & 0xff00ffff | (nr_muls << 16)
|
||||
}
|
||||
|
@ -82,3 +82,8 @@ fn (mut p Parser) name_expr() {
|
||||
println(p.peek_tok.lit)
|
||||
}
|
||||
}
|
||||
|
||||
fn set_nr_muls(t table.Type, nr_muls int) table.Type {
|
||||
return int(t) &
|
||||
0xff00ffff | (nr_muls << 16)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user