diff --git a/vlib/v/builder/builder.v b/vlib/v/builder/builder.v index 0c27aae549..7ad09f8c3e 100644 --- a/vlib/v/builder/builder.v +++ b/vlib/v/builder/builder.v @@ -67,7 +67,7 @@ pub fn new_builder(pref &pref.Preferences) Builder { // parse all deps from already parsed files pub fn (mut b Builder) parse_imports() { mut done_imports := []string{} - if b.pref.is_script { + if b.pref.is_vsh { done_imports << 'os' } // TODO (joe): decide if this is correct solution. @@ -178,7 +178,7 @@ pub fn (b &Builder) import_graph() &depgraph.DepGraph { deps << 'builtin' if b.pref.backend == .c { // TODO JavaScript backend doesn't handle os for now - if b.pref.is_script && p.mod.name != 'os' { + if b.pref.is_vsh && p.mod.name != 'os' { deps << 'os' } } diff --git a/vlib/v/builder/compile.v b/vlib/v/builder/compile.v index 590c961356..92c1ca996d 100644 --- a/vlib/v/builder/compile.v +++ b/vlib/v/builder/compile.v @@ -184,7 +184,7 @@ pub fn (v Builder) get_builtin_files() []string { } if v.pref.backend == .c { // TODO JavaScript backend doesn't handle os for now - if v.pref.is_script && os.exists(os.join_path(location, 'os')) { + if v.pref.is_vsh && os.exists(os.join_path(location, 'os')) { builtin_files << v.v_files_from_dir(os.join_path(location, 'os')) } } diff --git a/vlib/v/pref/default.v b/vlib/v/pref/default.v index 8dfaa824f8..c39e31276b 100644 --- a/vlib/v/pref/default.v +++ b/vlib/v/pref/default.v @@ -60,7 +60,8 @@ pub fn (mut p Preferences) fill_with_defaults() { p.ccompiler = default_c_compiler() } p.is_test = p.path.ends_with('_test.v') || p.path.ends_with('.vv') - p.is_script = p.path.ends_with('.v') || p.path.ends_with('.vsh') + p.is_vsh = p.path.ends_with('.vsh') + p.is_script = p.is_vsh || p.path.ends_with('.v') if p.third_party_option == '' { p.third_party_option = p.cflags $if !windows { diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 88e38358ac..90e7fc247f 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -55,6 +55,7 @@ pub mut: // nofmt bool // disable vfmt is_test bool // `v test string_test.v` is_script bool // single file mode (`v program.v`), main function can be skipped + is_vsh bool // v script (`file.vsh`) file, the `os` module should be made global is_livemain bool // main program that contains live/hot code is_liveshared bool // a shared library, that will be used in a -live main program is_shared bool // an ordinary shared library, -shared, no matter if it is live or not