From 45766dcb2e737e56f4ed27f73c09e4e5349e1bd6 Mon Sep 17 00:00:00 2001 From: Rendims <52757857+Rendims@users.noreply.github.com> Date: Sat, 10 Aug 2019 00:56:44 +0200 Subject: [PATCH] main: generate main body on new line Fix issue #1551 --- compiler/main.v | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/main.v b/compiler/main.v index 6e714e30f0..743a32f478 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -465,7 +465,9 @@ string _STR_TMP(const char *fmt, ...) { // It can be skipped in single file programs if v.pref.is_script { //println('Generating main()...') - cgen.genln('int main() { init_consts(); $cgen.fn_main; return 0; }') + cgen.genln('int main() { init_consts();') + cgen.genln('$cgen.fn_main;') + cgen.genln('return 0; }') } else { println('panic: function `main` is undeclared in the main module')