Skip to content

Commit 36aae3d

Browse files
committed
fix bug
1 parent 1f957a1 commit 36aae3d

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

rewatch/src/build/clean.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,14 @@ pub fn cleanup_previous_build(
170170
.get_mut(module_name)
171171
.expect("Could not find module for ast file");
172172

173-
let compile_dirty = compile_assets_state.cmt_modules.get(module_name);
173+
let cmt_last_modified = compile_assets_state.cmt_modules.get(module_name);
174174
// if there is a new AST but it has not been compiled yet, we mark the module as compile dirty
175175
// we do this by checking if the cmt file is newer than the AST file. We always compile the
176176
// interface AND implementation. For some reason the CMI file is not always rewritten if it
177177
// doesn't have any changes, that's why we just look at the CMT file.
178-
if let Some(compile_dirty) = compile_dirty {
179-
let last_modified = Some(ast_last_modified);
180-
181-
if let Some(last_modified) = last_modified {
182-
if compile_dirty > last_modified && !deleted_interfaces.contains(module_name) {
183-
module.compile_dirty = false;
184-
}
178+
if let Some(cmt_last_modified) = cmt_last_modified {
179+
if cmt_last_modified > ast_last_modified && !deleted_interfaces.contains(module_name) {
180+
module.compile_dirty = false;
185181
}
186182
}
187183

rewatch/src/helpers.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,9 @@ pub fn get_namespace_from_module_name(module_name: &str) -> Option<String> {
240240
}
241241

242242
pub fn is_interface_ast_file(file: &Path) -> bool {
243-
file.ends_with(".iast")
243+
file.extension()
244+
.map(|extension| extension.eq_ignore_ascii_case("iast"))
245+
.unwrap_or(false)
244246
}
245247

246248
pub fn read_lines(filename: &Path) -> io::Result<io::Lines<io::BufReader<fs::File>>> {
@@ -275,8 +277,7 @@ pub fn is_non_exotic_module_name(module_name: &str) -> bool {
275277
}
276278

277279
pub fn get_extension(path: &Path) -> String {
278-
let path_buf = PathBuf::from(path);
279-
return path_buf
280+
return path
280281
.extension()
281282
.expect("Could not get extension")
282283
.to_str()

0 commit comments

Comments
 (0)