From ff62b27ef03a5750d65c59905cae5316bafafabb Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 13 Jul 2021 20:32:30 +0300 Subject: [PATCH] v.builder: remove unused vjs_cc vestige (the -b js backend does its job now) --- vlib/v/builder/cc.v | 49 +++++---------------------------------------- 1 file changed, 5 insertions(+), 44 deletions(-) diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 328954ef1e..47f0e9dd8d 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -455,49 +455,6 @@ fn (mut v Builder) setup_output_name() { v.ccoptions.o_args << '-o "$v.pref.out_name"' } -fn (mut v Builder) vjs_cc() bool { - vexe := pref.vexe_path() - vdir := os.dir(vexe) - // Just create a .c/.js file and exit, for example: `v -o v.c compiler` - ends_with_c := v.pref.out_name.ends_with('.c') - ends_with_js := v.pref.out_name.ends_with('.js') - if ends_with_c || ends_with_js { - v.pref.skip_running = true - // Translating V code to JS by launching vjs. - // Using a separate process for V.js is for performance mostly, - // to avoid constant is_js checks. - $if !js { - if ends_with_js { - vjs_path := vexe + 'js' - if !os.exists(vjs_path) { - println('V.js compiler not found, building...') - // Build V.js. Specifying `-os js` makes V include - // only _js.v files and ignore _c.v files. - ret := os.system('$vexe -o $vjs_path -os js $vdir/cmd/v') - if ret == 0 { - println('Done.') - } else { - println('Failed.') - exit(1) - } - } - ret := os.system('$vjs_path -o $v.pref.out_name $v.pref.path') - if ret == 0 { - println('Done. Run it with `node $v.pref.out_name`') - println('JS backend is at a very early stage.') - } - } - } - msg_mv := 'os.mv_by_cp $v.out_name_c => $v.pref.out_name' - util.timing_start(msg_mv) - // v.out_name_c may be on a different partition than v.out_name - os.mv_by_cp(v.out_name_c, v.pref.out_name) or { panic(err) } - util.timing_measure(msg_mv) - return true - } - return false -} - fn (mut v Builder) dump_c_options(all_args []string) { if v.pref.dump_c_flags != '' { non_empty_args := all_args.filter(it != '').join('\n') + '\n' @@ -522,7 +479,11 @@ fn (mut v Builder) cc() { } return } - if v.vjs_cc() { + // whether to just create a .c or .js file and exit, for example: `v -o v.c cmd.v` + ends_with_c := v.pref.out_name.ends_with('.c') + ends_with_js := v.pref.out_name.ends_with('.js') + if ends_with_c || ends_with_js { + v.pref.skip_running = true return } // Cross compiling for Windows