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

parser: fix position offset by 1 (#7099)

This commit is contained in:
Daniel Däschle 2020-12-03 10:25:06 +01:00 committed by GitHub
parent 97ed2bf211
commit 558a756431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 12 deletions

View File

@ -9,6 +9,6 @@ vlib/v/checker/tests/match_sumtype_multiple_types.vv:27:13: error: unknown metho
25 | Alfa, Charlie {
26 | assert l.char == `a`
27 | assert l.letter() == 'a'
| ~~~~~~~~~
| ~~~~~~~~
28 | }
29 | Bravo {

View File

@ -50,11 +50,7 @@ pub fn (mut p Parser) call_expr(language table.Language, mod string) ast.CallExp
if p.tok.kind == .not {
p.next()
}
pos := token.Position{
line_nr: first_pos.line_nr
pos: first_pos.pos
len: last_pos.pos - first_pos.pos + last_pos.len
}
pos := first_pos.extend(last_pos)
mut or_stmts := []ast.Stmt{}
mut or_pos := p.tok.position()
if p.tok.kind == .key_orelse {

View File

@ -1351,12 +1351,8 @@ fn (mut p Parser) dot_expr(left ast.Expr) ast.Expr {
or_kind = .propagate
}
//
end_pos := p.tok.position()
pos := token.Position{
line_nr: name_pos.line_nr
pos: name_pos.pos
len: end_pos.pos - name_pos.pos
}
end_pos := p.prev_tok.position()
pos := name_pos.extend(end_pos)
mcall_expr := ast.CallExpr{
left: left
name: field_name