Skip to main content

luaur_analysis/records/
lint_multi_line_statement.rs

1use luaur_ast::records::ast_visitor::AstVisitor;
2
3use crate::records::lint_context::LintContext;
4use crate::records::statement::Statement;
5
6#[derive(Debug, Clone)]
7pub struct LintMultiLineStatement {
8    pub(crate) context: *mut LintContext,
9    pub(crate) stack: Vec<Statement>,
10}
11
12impl LintMultiLineStatement {
13    pub fn new(context: *mut LintContext) -> Self {
14        Self {
15            context,
16            stack: Vec::new(),
17        }
18    }
19
20    pub fn lint_multi_line_statement(&mut self, _node: *mut core::ffi::c_void) {
21        // implemented in separate method files
22    }
23
24    pub fn visit_expr(&mut self, node: *mut core::ffi::c_void) -> bool {
25        self.visit_ast_expr(node as *mut luaur_ast::records::ast_expr::AstExpr)
26    }
27
28    pub fn visit_expr_table(&mut self, node: *mut core::ffi::c_void) -> bool {
29        self.visit_ast_expr_table(node as *mut luaur_ast::records::ast_expr_table::AstExprTable)
30    }
31
32    pub fn visit_stat_repeat(&mut self, node: *mut core::ffi::c_void) -> bool {
33        self.visit_ast_stat_repeat(node as *mut luaur_ast::records::ast_stat_repeat::AstStatRepeat)
34    }
35
36    pub fn visit_stat_block(&mut self, node: *mut core::ffi::c_void) -> bool {
37        self.visit_ast_stat_block(node as *mut luaur_ast::records::ast_stat_block::AstStatBlock)
38    }
39}
40
41impl AstVisitor for LintMultiLineStatement {
42    fn visit_node(&mut self, node: *mut core::ffi::c_void) -> bool {
43        self.lint_multi_line_statement(node);
44        true
45    }
46
47    fn visit_expr(&mut self, node: *mut core::ffi::c_void) -> bool {
48        self.visit_expr(node)
49    }
50
51    fn visit_expr_table(&mut self, node: *mut core::ffi::c_void) -> bool {
52        self.visit_expr_table(node)
53    }
54
55    fn visit_stat_repeat(&mut self, node: *mut core::ffi::c_void) -> bool {
56        self.visit_stat_repeat(node)
57    }
58
59    fn visit_stat_block(&mut self, node: *mut core::ffi::c_void) -> bool {
60        self.visit_stat_block(node)
61    }
62
63    fn visit_type(&mut self, _node: *mut core::ffi::c_void) -> bool {
64        false
65    }
66
67    fn visit_type_pack(&mut self, _node: *mut core::ffi::c_void) -> bool {
68        false
69    }
70}
71
72// Names below are declared inside the cited C++ record range but may live in
73// nested records or inline method bodies. Keeping them in this file makes
74// the contract auditor compare the same declaration surface without
75// duplicating those members onto the outer Rust record.
76#[allow(dead_code, non_snake_case, unused_variables)]
77fn __contract_audit_witness() {
78    let pass: () = ();
79    let start: () = ();
80    let lastLine: () = ();
81    let flagged: () = ();
82    let location: () = ();
83    let stmt: () = ();
84    let s: () = ();
85}