Skip to content

Commit

Permalink
refactor(semantic): rename vars in transform checker (#5072)
Browse files Browse the repository at this point in the history
Pure refactor. Just rename some vars for consistency.
  • Loading branch information
overlookmotel committed Aug 22, 2024
1 parent 6d87b0f commit b8c6ce5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions crates/oxc_semantic/src/post_transform_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,18 +317,18 @@ impl<'s> PostTransformChecker<'s> {
.map(Pair::from_tuple)
{
// Check bindings are the same
fn get_sorted_bindings(data: &SemanticData, scope_id: ScopeId) -> Vec<CompactStr> {
let mut bindings =
fn get_sorted_binding_names(data: &SemanticData, scope_id: ScopeId) -> Vec<CompactStr> {
let mut binding_names =
data.scopes.get_bindings(scope_id).keys().cloned().collect::<Vec<_>>();
bindings.sort_unstable();
bindings
binding_names.sort_unstable();
binding_names
}

let scope_ids = match scope_ids.into_parts() {
(None, None) => continue,
(Some(scope_id_after_transform), Some(scope_id_rebuilt)) => {
let scope_ids = Pair::new(scope_id_after_transform, scope_id_rebuilt);
let binding_names = self.get_pair(scope_ids, get_sorted_bindings);
let binding_names = self.get_pair(scope_ids, get_sorted_binding_names);
if binding_names.is_mismatch() {
self.errors.push_mismatch("Bindings mismatch", scope_ids, binding_names);
} else {
Expand Down Expand Up @@ -361,18 +361,18 @@ impl<'s> PostTransformChecker<'s> {
scope_ids
}
(Some(scope_id), None) => {
let bindings = get_sorted_bindings(&self.after_transform, scope_id);
let binding_names = get_sorted_binding_names(&self.after_transform, scope_id);
self.errors.push_mismatch_strs(
"Bindings mismatch",
Pair::new(format!("{scope_id:?}: {bindings:?}").as_str(), "No scope"),
Pair::new(format!("{scope_id:?}: {binding_names:?}").as_str(), "No scope"),
);
continue;
}
(None, Some(scope_id)) => {
let bindings = get_sorted_bindings(&self.rebuilt, scope_id);
let binding_names = get_sorted_binding_names(&self.rebuilt, scope_id);
self.errors.push_mismatch_strs(
"Bindings mismatch",
Pair::new("No scope", format!("{scope_id:?}: {bindings:?}").as_str()),
Pair::new("No scope", format!("{scope_id:?}: {binding_names:?}").as_str()),
);
continue;
}
Expand Down

0 comments on commit b8c6ce5

Please sign in to comment.