Skip to main content

luaur_analysis/methods/
expr_printer_visit_dump_cfg_alt_b.rs

1use crate::records::expr_printer::ExprPrinter;
2use luaur_ast::enums::constant_number_parse_result::ConstantNumberParseResult;
3use luaur_ast::records::ast_expr_constant_number::AstExprConstantNumber;
4
5impl ExprPrinter {
6    pub fn visit_ast_expr_constant_number(&mut self, node: *mut AstExprConstantNumber) -> bool {
7        unsafe {
8            let n = &*node;
9            if n.parse_result == ConstantNumberParseResult::Ok && n.value == n.value.trunc() {
10                self.result.push_str(&format!("{}", n.value as i64));
11            } else {
12                self.result.push_str(&format!("{}", n.value));
13            }
14        }
15        false
16    }
17}