MCPcopy Create free account
hub / github.com/ParaN3xus/udon-decompiler / append_function

Function append_function

src/decompiler/codegen.rs:90–124  ·  view source on GitHub ↗
(out: &mut Vec<String>, function: &IrFunction, ctx: &DecompileContext)

Source from the content-addressed store, hash-verified

88 }
89}
90fn append_function(out: &mut Vec<String>, function: &IrFunction, ctx: &DecompileContext) {
91 out.push(format!(
92 "{}void {}()",
93 if function.is_function_public {
94 "public "
95 } else {
96 ""
97 },
98 sanitize_identifier(function.function_name.as_str())
99 ));
100 out.push("{".to_string());
101
102 let mut body_lines = Vec::<String>::new();
103 append_function_body(&mut body_lines, function, ctx);
104
105 let local_declarations = function
106 .variable_declarations
107 .iter()
108 .map(|declaration| {
109 let variable = require_variable(ctx, declaration.variable_address);
110 let name = variable.name.as_str();
111 render_local_variable_declaration(variable, name, declaration.init_value.as_ref())
112 })
113 .collect::<Vec<_>>();
114
115 for declaration in &local_declarations {
116 out.push(declaration.clone());
117 }
118 if !local_declarations.is_empty() && !body_lines.is_empty() {
119 out.push(String::new());
120 }
121
122 out.extend(body_lines);
123 out.push("}".to_string());
124}
125
126fn append_function_body(out: &mut Vec<String>, function: &IrFunction, ctx: &DecompileContext) {
127 let emit_indices = function

Callers 1

generate_csharpFunction · 0.85

Calls 6

append_function_bodyFunction · 0.85
iterMethod · 0.80
is_emptyMethod · 0.80
require_variableFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected