Skip to content

Commit

Permalink
GLOBALS
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jan 6, 2025
1 parent 969a967 commit 2b5257e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions crates/swc_ecma_lints/src/rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use std::{fmt::Debug, sync::Arc};

use auto_impl::auto_impl;
use parking_lot::Mutex;
use swc_common::errors::{Diagnostic, DiagnosticBuilder, Emitter, Handler, HANDLER};
use swc_common::{
errors::{Diagnostic, DiagnosticBuilder, Emitter, Handler, HANDLER},
GLOBALS,
};
use swc_ecma_ast::{Module, Script};
use swc_ecma_visit::{Visit, VisitWith};
use swc_parallel::join;
Expand Down Expand Up @@ -54,10 +57,12 @@ fn join_lint_rules<N: LintNode<R>, R: Rule>(rules: &mut [R], program: &N) -> Vec

let (ra, rb) = rules.split_at_mut(len / 2);

let (mut da, db) = join(
|| join_lint_rules(ra, program),
|| join_lint_rules(rb, program),
);
let (mut da, db) = GLOBALS.with(|globals| {
join(
|| GLOBALS.set(globals, || join_lint_rules(ra, program)),
|| GLOBALS.set(globals, || join_lint_rules(rb, program)),
)
});

da.extend(db);

Expand Down

0 comments on commit 2b5257e

Please sign in to comment.