Skip to content

Commit

Permalink
Use a boolean instead of passing &self.file_directive
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Nov 22, 2024
1 parent a78a3ff commit fd5dc5f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl<C: Comments> ServerActions<C> {
let directive_visitor = &mut DirectiveVisitor {
config: &self.config,
directive: None,
file_directive: &self.file_directive,
has_file_directive: self.file_directive.is_some(),
is_allowed_position: true,
location: DirectiveLocation::FunctionBody,
};
Expand All @@ -355,7 +355,7 @@ impl<C: Comments> ServerActions<C> {
let directive_visitor = &mut DirectiveVisitor {
config: &self.config,
directive: None,
file_directive: &self.file_directive,
has_file_directive: false,
is_allowed_position: true,
location: DirectiveLocation::Module,
};
Expand Down Expand Up @@ -2444,9 +2444,9 @@ fn collect_decl_idents_in_stmt(stmt: &Stmt, idents: &mut Vec<Ident>) {

struct DirectiveVisitor<'a> {
config: &'a Config,
file_directive: &'a Option<Directive>,
location: DirectiveLocation,
directive: Option<Directive>,
has_file_directive: bool,
is_allowed_position: bool,
}

Expand All @@ -2457,7 +2457,7 @@ impl DirectiveVisitor<'_> {
*/
fn visit_stmt(&mut self, stmt: &Stmt) -> bool {
let in_fn_body = matches!(self.location, DirectiveLocation::FunctionBody);
let allow_inline = self.config.is_react_server_layer || self.file_directive.is_some();
let allow_inline = self.config.is_react_server_layer || self.has_file_directive;

match stmt {
Stmt::Expr(ExprStmt {
Expand Down

0 comments on commit fd5dc5f

Please sign in to comment.