From dc24df951017fa06183f50165ca46f25e4109211 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 11 Mar 2023 14:19:18 +0300 Subject: [PATCH] cbuilder: change order of functions to improve readability --- vlib/v/builder/cbuilder/cbuilder.v | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/vlib/v/builder/cbuilder/cbuilder.v b/vlib/v/builder/cbuilder/cbuilder.v index b0a3fccb76..6dc0e3697e 100644 --- a/vlib/v/builder/cbuilder/cbuilder.v +++ b/vlib/v/builder/cbuilder/cbuilder.v @@ -36,6 +36,18 @@ pub fn compile_c(mut b builder.Builder) { } } +pub fn build_c(mut b builder.Builder, v_files []string, out_file string) { + b.out_name_c = out_file + b.pref.out_name_c = os.real_path(out_file) + b.info('build_c(${out_file})') + output2 := gen_c(mut b, v_files) + os.write_file(out_file, output2) or { panic(err) } + if b.pref.is_stats { + b.stats_lines = output2.count('\n') + 1 + b.stats_bytes = output2.len + } +} + pub fn gen_c(mut b builder.Builder, v_files []string) string { b.front_and_middle_stages(v_files) or { if err.code() > 7000 { @@ -56,15 +68,3 @@ pub fn gen_c(mut b builder.Builder, v_files []string) string { return res } - -pub fn build_c(mut b builder.Builder, v_files []string, out_file string) { - b.out_name_c = out_file - b.pref.out_name_c = os.real_path(out_file) - b.info('build_c(${out_file})') - output2 := gen_c(mut b, v_files) - os.write_file(out_file, output2) or { panic(err) } - if b.pref.is_stats { - b.stats_lines = output2.count('\n') + 1 - b.stats_bytes = output2.len - } -}