factorio_codegen/generator/
comment.rs1use crate::LuaGenerator;
2
3impl LuaGenerator {
4 pub(crate) fn parameter_type_comment(&self, source_type: Option<&str>) -> String {
6 if self.debug_level_at_least(1) {
7 source_type.map_or_else(String::new, |ty| format!(" --[[ {ty} ]]"))
8 } else {
9 String::new()
10 }
11 }
12
13 pub(crate) fn variable_type_comment(&self, source_type: Option<&str>) -> String {
15 if self.debug_level_at_least(1) {
16 source_type.map_or_else(String::new, |ty| format!(" --[[ {ty} ]]"))
17 } else {
18 String::new()
19 }
20 }
21
22 pub(crate) fn function_return_comment(&self, return_type: Option<&str>) -> String {
24 if self.debug_level_at_least(1) {
25 return_type.map_or_else(String::new, |ty| format!(" --[[ -> {ty} ]]"))
26 } else {
27 String::new()
28 }
29 }
30}