Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
hyf0 committed Aug 19, 2023
1 parent c5d542d commit 2f3e207
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions tasks/coverage/src/suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,16 @@ pub trait Case: Sized + Sync + Send + UnwindSafe {
}

fn are_all_identifiers_resolved(semantic: &oxc_semantic::Semantic<'_>) -> bool {
use oxc_ast::ast;
use oxc_ast::AstKind;
use oxc_ast::{ast, AstKind};
use oxc_semantic::AstNode;

let ast_nodes = semantic.nodes();
let has_non_resolved = ast_nodes.iter().any(|node| {
match node.kind() {
AstKind::BindingIdentifier(id) => {
match ast_nodes.parent_kind(node.id()) {
let mut parents = ast_nodes.iter_parents(node.id()).map(AstNode::kind);
parents.next(); // Exclude BindingIdentifier itself
match parents.next() {
Some(AstKind::Function(func))
if func.r#type == ast::FunctionType::FunctionExpression =>
{
Expand All @@ -381,6 +383,17 @@ fn are_all_identifiers_resolved(semantic: &oxc_semantic::Semantic<'_>) -> bool {
}
_ => {}
}
let mut parents = ast_nodes.iter_parents(node.id()).map(AstNode::kind);
parents.next(); // Exclude BindingIdentifier itself
match (parents.next(), parents.next()) {
// FIXME: case like `if (xx) ; else function test() {}`
(Some(AstKind::Function(func)), Some(AstKind::IfStatement(_)))
if func.r#type == ast::FunctionType::FunctionDeclaration =>
{
return false;
}
_ => {}
}

id.symbol_id.get().is_none()
}
Expand Down

0 comments on commit 2f3e207

Please sign in to comment.