Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vet, parser: use parse_file, remove parse_vet_file #21444

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/tools/vvet/vvet.v
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn (mut vt Vet) vet_file(path string) {
prefs.is_vsh = path.ends_with('.vsh')
mut table := ast.new_table()
vt.vprintln("vetting file '${path}'...")
file := parser.parse_vet_file(path, mut table, prefs)
file := parser.parse_file(path, mut table, .parse_comments, prefs)
vt.stmts(file.stmts)
source_lines := os.read_lines(vt.file) or { []string{} }
for ln, line in source_lines {
Expand Down
24 changes: 0 additions & 24 deletions vlib/v/parser/parser.v
Original file line number Diff line number Diff line change
Expand Up @@ -256,30 +256,6 @@ pub fn parse_file(path string, mut table ast.Table, comments_mode scanner.Commen
return res
}

pub fn parse_vet_file(path string, mut table_ ast.Table, pref_ &pref.Preferences) &ast.File {
$if trace_parse_vet_file ? {
eprintln('> ${@MOD}.${@FN} path: ${path}')
}
global_scope := &ast.Scope{
parent: unsafe { nil }
}
mut p := Parser{
scanner: scanner.new_scanner_file(path, .parse_comments, pref_) or { panic(err) }
table: table_
pref: pref_
scope: &ast.Scope{
start_pos: 0
parent: global_scope
}
errors: []errors.Error{}
warnings: []errors.Warning{}
}
p.set_path(path)
file := p.parse()
unsafe { p.free_scanner() }
return file
}

pub fn (mut p Parser) parse() &ast.File {
util.timing_start('PARSE')
defer {
Expand Down
Loading