Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/formatters/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,9 @@ fn stmt_remove_leading_newlines(stmt: Stmt) -> Stmt {
type_function.type_token(),
with_type_token
),
#[cfg(feature = "lua52")]
#[cfg(any(feature = "lua52", feature = "luajit"))]
Stmt::Goto(goto) => update_first_token!(Goto, goto, goto.goto_token(), with_goto_token),
#[cfg(feature = "lua52")]
#[cfg(any(feature = "lua52", feature = "luajit"))]
Stmt::Label(label) => {
update_first_token!(Label, label, label.left_colons(), with_left_colons)
}
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/formatters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub mod expression;
#[cfg(any(feature = "luau", feature = "cfxlua"))]
pub mod compound_assignment;
pub mod functions;
#[cfg(feature = "lua52")]
pub mod lua52;
#[cfg(any(feature = "lua52", feature = "luajit"))]
pub mod goto;
#[cfg(feature = "lua54")]
pub mod lua54;
#[cfg(feature = "luau")]
Expand Down
14 changes: 7 additions & 7 deletions src/formatters/stmt.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(any(feature = "luau", feature = "cfxlua"))]
use crate::formatters::compound_assignment::format_compound_assignment;
#[cfg(feature = "lua52")]
use crate::formatters::lua52::{format_goto, format_goto_no_trivia, format_label};
#[cfg(any(feature = "lua52", feature = "luajit"))]
use crate::formatters::goto::{format_goto, format_goto_no_trivia, format_label};
#[cfg(feature = "luau")]
use crate::formatters::luau::{
format_exported_type_declaration, format_exported_type_function, format_type_declaration_stmt,
Expand Down Expand Up @@ -1089,9 +1089,9 @@ pub(crate) mod stmt_block {
Stmt::TypeFunction(type_function) => {
Stmt::TypeFunction(format_type_function_block(ctx, type_function, block_shape))
}
#[cfg(feature = "lua52")]
#[cfg(any(feature = "lua52", feature = "luajit"))]
Stmt::Goto(node) => Stmt::Goto(node.to_owned()),
#[cfg(feature = "lua52")]
#[cfg(any(feature = "lua52", feature = "luajit"))]
Stmt::Label(node) => Stmt::Label(node.to_owned()),
other => panic!("unknown node {:?}", other),
}
Expand Down Expand Up @@ -1124,8 +1124,8 @@ pub fn format_stmt(ctx: &Context, stmt: &Stmt, shape: Shape) -> Stmt {
#[cfg(feature = "luau")] TypeDeclaration = format_type_declaration_stmt,
#[cfg(feature = "luau")] ExportedTypeFunction = format_exported_type_function,
#[cfg(feature = "luau")] TypeFunction = format_type_function_stmt,
#[cfg(feature = "lua52")] Goto = format_goto,
#[cfg(feature = "lua52")] Label = format_label,
#[cfg(any(feature = "lua52", feature = "luajit"))] Goto = format_goto,
#[cfg(any(feature = "lua52", feature = "luajit"))] Label = format_label,
})
}

Expand All @@ -1141,7 +1141,7 @@ pub fn format_stmt_no_trivia(ctx: &Context, stmt: &Stmt, shape: Shape) -> Stmt {
}
Stmt::Assignment(stmt) => Stmt::Assignment(format_assignment_no_trivia(ctx, stmt, shape)),
Stmt::FunctionCall(stmt) => Stmt::FunctionCall(format_function_call(ctx, stmt, shape)),
#[cfg(feature = "lua52")]
#[cfg(any(feature = "lua52", feature = "luajit"))]
Stmt::Goto(goto) => Stmt::Goto(format_goto_no_trivia(ctx, goto, shape)),
_ => unreachable!("format_stmt_no_trivia: node != assignment/function call/goto"),
}
Expand Down
4 changes: 2 additions & 2 deletions src/formatters/trivia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -696,13 +696,13 @@ define_update_trivia!(Stmt, |this, leading, trailing| {
}
#[cfg(feature = "luau")]
Stmt::TypeFunction(stmt) => Stmt::TypeFunction(stmt.update_trivia(leading, trailing)),
#[cfg(feature = "lua52")]
#[cfg(any(feature = "lua52", feature = "luajit"))]
Stmt::Goto(stmt) => Stmt::Goto(
stmt.to_owned()
.with_goto_token(stmt.goto_token().update_leading_trivia(leading))
.with_label_name(stmt.label_name().update_trailing_trivia(trailing)),
),
#[cfg(feature = "lua52")]
#[cfg(any(feature = "lua52", feature = "luajit"))]
Stmt::Label(stmt) => Stmt::Label(
stmt.to_owned()
.with_left_colons(stmt.left_colons().update_leading_trivia(leading))
Expand Down
6 changes: 3 additions & 3 deletions src/formatters/trivia_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pub fn is_block_simple(block: &Block) -> bool {
true
}
Stmt::FunctionCall(_) => true,
#[cfg(feature = "lua52")]
#[cfg(any(feature = "lua52", feature = "luajit"))]
Stmt::Goto(_) => true,
_ => false,
})
Expand Down Expand Up @@ -948,7 +948,7 @@ pub fn get_stmt_trailing_trivia(stmt: Stmt) -> (Stmt, Vec<Token>) {
let (type_declaration, trailing_trivia) = take_trailing_trivia(&stmt);
(Stmt::TypeFunction(type_declaration), trailing_trivia)
}
#[cfg(feature = "lua52")]
#[cfg(any(feature = "lua52", feature = "luajit"))]
Stmt::Goto(stmt) => {
let trailing_trivia = stmt
.label_name()
Expand All @@ -963,7 +963,7 @@ pub fn get_stmt_trailing_trivia(stmt: Stmt) -> (Stmt, Vec<Token>) {
trailing_trivia,
)
}
#[cfg(feature = "lua52")]
#[cfg(any(feature = "lua52", feature = "luajit"))]
Stmt::Label(stmt) => {
let trailing_trivia = stmt
.right_colons()
Expand Down