Skip to content

Commit

Permalink
fix(ast_tools): fix ast-tool panic (#5641)
Browse files Browse the repository at this point in the history
`just ast` panic due to
5532628,
change the filename to makesure `ast_tool` still working
1. crates/oxc_span/src/source_type/types.rs is removed in
5532628
  • Loading branch information
IWANABETHATGUY authored Sep 9, 2024
1 parent 508cbea commit e38114b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/.generated_ast_watch_list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ src:
- 'crates/oxc_syntax/src/number.rs'
- 'crates/oxc_syntax/src/operator.rs'
- 'crates/oxc_span/src/span/types.rs'
- 'crates/oxc_span/src/source_type/types.rs'
- 'crates/oxc_span/src/source_type/mod.rs'
- 'crates/oxc_regular_expression/src/ast.rs'
- 'crates/oxc_ast/src/generated/derive_clone_in.rs'
- 'crates/oxc_regular_expression/src/generated/derive_clone_in.rs'
Expand Down
2 changes: 1 addition & 1 deletion tasks/ast_tools/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static SOURCE_PATHS: &[&str] = &[
"crates/oxc_syntax/src/number.rs",
"crates/oxc_syntax/src/operator.rs",
"crates/oxc_span/src/span/types.rs",
"crates/oxc_span/src/source_type/types.rs",
"crates/oxc_span/src/source_type/mod.rs",
"crates/oxc_regular_expression/src/ast.rs",
];

Expand Down
5 changes: 3 additions & 2 deletions tasks/ast_tools/src/rust_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,9 @@ impl Module {

pub fn load(mut self) -> Result<Self> {
assert!(!self.loaded, "can't load twice!");

let mut file = std::fs::File::open(&self.file).normalize()?;
let mut file = std::fs::File::open(&self.file).normalize().map_err(|err| {
format!("Error reading file: {}, reason: {}", &self.file.to_string_lossy(), err)
})?;
let mut content = String::new();
file.read_to_string(&mut content).normalize()?;
let file = parse_file(content.as_str()).normalize()?;
Expand Down

0 comments on commit e38114b

Please sign in to comment.