Skip to content

Commit

Permalink
Return the highest priority error from the descendant instead of retu…
Browse files Browse the repository at this point in the history
…rn the very first one
  • Loading branch information
CYBAI committed Jan 20, 2020
1 parent 2a59482 commit 33988cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 4 additions & 3 deletions components/script/script_module.rs
Expand Up @@ -633,6 +633,7 @@ impl ModuleTree {
}

// 5-6.
let mut errors: Vec<ModuleError> = Vec::new();
let descendant_urls = module_tree.get_descendant_urls().borrow();

for descendant_module in descendant_urls
Expand All @@ -650,13 +651,13 @@ impl ModuleTree {
ModuleTree::find_first_parse_error(&global, &descendant_module, discovered_urls);

// 8-4.
if child_parse_error.is_some() {
return child_parse_error;
if let Some(child_error) = child_parse_error {
errors.push(child_error);
}
}

// Step 9.
return None;
return errors.into_iter().max();
}
}

Expand Down

This file was deleted.

0 comments on commit 33988cd

Please sign in to comment.