Skip to content

Commit

Permalink
refactor(semantic): rename vars from flag to flags (#5031)
Browse files Browse the repository at this point in the history
Part of #4991.
  • Loading branch information
overlookmotel committed Aug 21, 2024
1 parent 5f4c9ab commit 83dfb14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ impl<'a> SemanticBuilder<'a> {
self.current_scope_flags().is_strict_mode()
}

pub(crate) fn set_function_node_flag(&mut self, flags: NodeFlags) {
pub(crate) fn set_function_node_flags(&mut self, flags: NodeFlags) {
if let Some(current_function) = self.function_stack.last() {
*self.nodes.get_node_mut(*current_function).flags_mut() |= flags;
}
Expand Down Expand Up @@ -1917,7 +1917,7 @@ impl<'a> SemanticBuilder<'a> {
}
}
AstKind::YieldExpression(_) => {
self.set_function_node_flag(NodeFlags::HasYield);
self.set_function_node_flags(NodeFlags::HasYield);
}
_ => {}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_semantic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ mod tests {
(typescript, "let a: number; (a as any) = 1;", ReferenceFlags::write()),
];

for (source_type, source, flag) in sources {
for (source_type, source, flags) in sources {
let semantic = get_semantic(&alloc, source, source_type);
let a_id =
semantic.scopes().get_root_binding(&target_symbol_name).unwrap_or_else(|| {
Expand All @@ -415,7 +415,7 @@ mod tests {
"expected to find 1 reference to '{target_symbol_name}' but {num_refs} were found\n\nsource:\n{source}"
);
let ref_type = a_refs[0];
if flag.is_write() {
if flags.is_write() {
assert!(
ref_type.is_write(),
"expected reference to '{target_symbol_name}' to be write\n\nsource:\n{source}"
Expand All @@ -426,7 +426,7 @@ mod tests {
"expected reference to '{target_symbol_name}' not to have been written to, but it is\n\nsource:\n{source}"
);
}
if flag.is_read() {
if flags.is_read() {
assert!(
ref_type.is_read(),
"expected reference to '{target_symbol_name}' to be read\n\nsource:\n{source}"
Expand Down

0 comments on commit 83dfb14

Please sign in to comment.