-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vet, parser: rewrite vet error handling (improve parser performance e…
…xtend vvet) p1 (#21417)
- Loading branch information
Showing
4 changed files
with
121 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module main | ||
|
||
import v.token | ||
import v.vet | ||
|
||
type FilteredLines = map[vet.ErrorType]map[int]bool | ||
|
||
fn (mut fl FilteredLines) comments(is_multi bool, pos token.Pos) { | ||
if !is_multi { | ||
return | ||
} | ||
for ln in pos.line_nr + 1 .. pos.last_line + 1 { | ||
fl[.space_indent][ln] = true | ||
} | ||
} | ||
|
||
fn (mut fl FilteredLines) assigns(pos token.Pos) { | ||
if pos.line_nr == pos.last_line { | ||
return | ||
} | ||
for ln in pos.line_nr + 1 .. pos.last_line { | ||
fl[.trailing_space][ln] = true | ||
fl[.space_indent][ln] = true | ||
} | ||
fl[.trailing_space][pos.line_nr] = true | ||
fl[.space_indent][pos.last_line] = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters