parser: set correct last line for struct inits (#9349)
parent
0a06a83d9b
commit
49eeddcd1c
|
@ -40,6 +40,9 @@ fn keep_single_empty_line() {
|
|||
}
|
||||
|
||||
f := 0
|
||||
arr << MyStruct{}
|
||||
|
||||
arr2 := [1, 2]
|
||||
}
|
||||
|
||||
fn prevent_empty_line_after_multi_line_statements() {
|
||||
|
|
|
@ -407,7 +407,6 @@ fn (mut p Parser) struct_init(short_syntax bool) ast.StructInit {
|
|||
}
|
||||
}
|
||||
}
|
||||
last_pos := p.tok.position()
|
||||
if !short_syntax {
|
||||
p.check(.rcbr)
|
||||
}
|
||||
|
@ -419,7 +418,7 @@ fn (mut p Parser) struct_init(short_syntax bool) ast.StructInit {
|
|||
update_expr: update_expr
|
||||
update_expr_comments: update_expr_comments
|
||||
has_update_expr: has_update_expr
|
||||
pos: first_pos.extend_with_last_line(last_pos, p.tok.line_nr)
|
||||
pos: first_pos.extend(p.prev_tok.position())
|
||||
is_short: no_keys
|
||||
pre_comments: pre_comments
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue