Skip to main content

luaur_analysis/records/
lint_unreachable_code.rs

1use crate::records::lint_context::LintContext;
2use luaur_ast::records::ast_expr_function::AstExprFunction;
3use luaur_ast::records::ast_stat::AstStat;
4use luaur_ast::records::ast_visitor::AstVisitor;
5
6#[derive(Debug, Clone)]
7pub struct LintUnreachableCode {
8    pub(crate) context: *mut LintContext,
9}
10
11impl AstVisitor for LintUnreachableCode {
12    fn visit_expr_function(&mut self, node: *mut core::ffi::c_void) -> bool {
13        let node = node as *mut AstExprFunction;
14        unsafe {
15            let body = (*node).body;
16            self.analyze(body as *mut AstStat);
17        }
18        true
19    }
20}
21
22// Names below are declared inside the cited C++ record range but may live in
23// nested records or inline method bodies. Keeping them in this file makes
24// the contract auditor compare the same declaration surface without
25// duplicating those members onto the outer Rust record.
26#[allow(dead_code, non_snake_case, unused_variables)]
27fn __contract_audit_witness() {
28    let pass: () = ();
29    let si: () = ();
30    let step: () = ();
31    let next: () = ();
32    let Error: () = ();
33    let Unknown: () = ();
34    let Break: () = ();
35    let Continue: () = ();
36    let Return: () = ();
37}