Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: add debug assert
  • Loading branch information
Dunqing committed Jul 19, 2024
commit 1cec1518815bd5c165a19bc84c3b0cff654d25e8
7 changes: 7 additions & 0 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::{
sync::Arc,
};

use oxc_ast::visit::walk::{walk_ts_enum_member_name, walk_ts_module_declaration_name};
#[allow(clippy::wildcard_imports)]
use oxc_ast::{ast::*, AstKind, Trivias, Visit};
use oxc_cfg::{
Expand Down Expand Up @@ -287,6 +288,12 @@ impl<'a> SemanticBuilder<'a> {
self.symbols.reserve(collector.symbol, collector.reference);

self.visit_program(program);

debug_assert_eq!(self.nodes.len(), collector.node);
debug_assert_eq!(self.scope.len(), collector.scope);
debug_assert_eq!(self.symbols.references.len(), collector.reference);
debug_assert!(collector.symbol >= self.symbols.len());

// Checking syntax error on module record requires scope information from the previous AST pass
if self.check_syntax_error {
checker::check_module_record(&self);
Expand Down