1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fix V.js methods after the recent generics fix

This commit is contained in:
Alexander Medvednikov
2019-10-25 21:57:32 +03:00
parent 280c7d396c
commit 9c5a359de3
4 changed files with 17 additions and 8 deletions

View File

@ -19,13 +19,17 @@ fn (v mut V) cc() {
// Just create a C/JavaScript file and exit
// for example: `v -o v.c compiler`
if v.out_name.ends_with('.c') || v.out_name.ends_with('.js') {
// Translating V code to JS by launching vjs
// 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 v.out_name.ends_with('.js') {
vjs_path := vexe + 'js'
dir := os.dir(vexe)
if !os.file_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 $dir/v.v')
if ret == 0 {
println('Done.')