Skip to content

Commit

Permalink
Use a clearer name for a line index when reading .symtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
petrpavlu committed Jan 10, 2025
1 parent 2aa5746 commit c2294d5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/sym/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,14 @@ impl SymCorpus {

// Parse all declarations.
let mut file_indices = Vec::new();
for (i, line) in lines.iter().enumerate() {
for (line_idx, line) in lines.iter().enumerate() {
// Obtain a name of the record.
let mut words = line.split_ascii_whitespace();
let name = words.next().ok_or_else(|| {
crate::Error::new_parse(&format!(
"{}:{}: Expected a record name",
path.display(),
i + 1
line_idx + 1
))
})?;

Expand All @@ -382,7 +382,7 @@ impl SymCorpus {
return Err(crate::Error::new_parse(&format!(
"{}:{}: Duplicate record '{}'",
path.display(),
i + 1,
line_idx + 1,
name,
)))
}
Expand All @@ -392,7 +392,7 @@ impl SymCorpus {
// Check for a file declaration and remember its index. File declarations are processed
// later after remapping of all symbol variants is known.
if name.starts_with("F#") {
file_indices.push(i);
file_indices.push(line_idx);
continue;
}

Expand Down Expand Up @@ -436,8 +436,8 @@ impl SymCorpus {
// Consolidated file needs more work.

// Handle file declarations.
for i in file_indices {
let mut words = lines[i].split_ascii_whitespace();
for line_idx in file_indices {
let mut words = lines[line_idx].split_ascii_whitespace();

let record_name = words.next().unwrap();
assert!(record_name.starts_with("F#"));
Expand Down Expand Up @@ -466,7 +466,7 @@ impl SymCorpus {
crate::Error::new_parse(&format!(
"{}:{}: Type '{}' is not known",
path.display(),
i + 1,
line_idx + 1,
type_name
))
})?;
Expand Down

0 comments on commit c2294d5

Please sign in to comment.