Skip to content

Commit

Permalink
refactor(semantic): comment why extra CFG enabled check (#4274)
Browse files Browse the repository at this point in the history
Add a comment referencing conclusions of #4273.
  • Loading branch information
overlookmotel committed Jul 15, 2024
1 parent f9d3f2e commit 639fd48
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ impl<'a> SemanticBuilder<'a> {

#[inline]
fn record_ast_node(&mut self) {
// The `self.cfg.is_some()` check here could be removed, since `ast_node_records` is empty
// if CFG is disabled. But benchmarks showed removing the extra check is a perf regression.
// <https://github.com/oxc-project/oxc/pull/4273>
if self.cfg.is_some() {
if let Some(record) = self.ast_node_records.last_mut() {
if *record == AstNodeId::dummy() {
Expand Down

0 comments on commit 639fd48

Please sign in to comment.