mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: process RangeExpr properly
This commit is contained in:
parent
7d2eb4f604
commit
2bbb8526a3
@ -425,9 +425,11 @@ fn (f mut Fmt) index_expr(node ast.IndexExpr) {
|
||||
ast.RangeExpr {
|
||||
is_range = true
|
||||
f.expr(node.left)
|
||||
f.write('[')
|
||||
f.expr(it.low)
|
||||
f.write('..')
|
||||
f.expr(it.high)
|
||||
f.write(')')
|
||||
f.write(']')
|
||||
}
|
||||
else {}
|
||||
}
|
||||
|
@ -41,6 +41,10 @@ fn new_user() User {
|
||||
}
|
||||
}
|
||||
|
||||
fn fn_contains_range_expr() {
|
||||
a := 1 in arr[0..2]
|
||||
}
|
||||
|
||||
fn voidfn() {
|
||||
println('this is a function that does not return anything')
|
||||
}
|
||||
|
@ -45,6 +45,10 @@ User
|
||||
}
|
||||
}
|
||||
|
||||
fn fn_contains_range_expr() {
|
||||
a:=1 in arr[0..2]
|
||||
}
|
||||
|
||||
fn voidfn(){
|
||||
println('this is a function that does not return anything')
|
||||
}
|
||||
@ -103,4 +107,3 @@ reserved_types = {
|
||||
'i128': true
|
||||
}
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user