luaur_analysis/methods/
lint_multi_line_statement_visit_linter.rs1use crate::functions::emit_warning::emit_warning;
2use crate::records::lint_multi_line_statement::LintMultiLineStatement;
3use luaur_ast::records::ast_expr::AstExpr;
4use luaur_config::enums::code::Code;
5use luaur_config::records::lint_warning::LintWarning;
6
7impl LintMultiLineStatement {
8 pub fn visit_ast_expr(&mut self, node: *mut AstExpr) -> bool {
9 let node = unsafe { &*node };
10 let top = self.stack.last_mut().unwrap();
11
12 if !top.flagged {
13 let location = node.base.location;
14
15 if location.begin.line > top.lastLine() {
16 top.lastLine = location.begin.line;
17
18 if location.begin.column <= top.start.begin.column {
19 emit_warning(
20 unsafe { &mut *self.context },
21 Code::Code_MultiLineStatement,
22 location,
23 format_args!("Statement spans multiple lines; use indentation to silence"),
24 );
25
26 top.flagged = true;
27 }
28 }
29 }
30
31 true
32 }
33}