mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: replace var
with mut
This commit is contained in:
@@ -74,7 +74,7 @@ fn main() {
|
||||
eprintln('vfmt env_vflags_and_os_args: ' + args.str())
|
||||
eprintln('vfmt possible_files: ' + possible_files.str())
|
||||
}
|
||||
var files := []string
|
||||
mut files := []string
|
||||
for file in possible_files {
|
||||
if !file.ends_with('.v') && !file.ends_with('.vv') {
|
||||
verror('v fmt can only be used on .v files.\nOffending file: "$file"')
|
||||
@@ -90,16 +90,16 @@ fn main() {
|
||||
vhelp.show_topic('fmt')
|
||||
exit(0)
|
||||
}
|
||||
var cli_args_no_files := []string
|
||||
mut cli_args_no_files := []string
|
||||
for a in os.args {
|
||||
if !(a in files) {
|
||||
cli_args_no_files << a
|
||||
}
|
||||
}
|
||||
var errors := 0
|
||||
mut errors := 0
|
||||
for file in files {
|
||||
fpath := os.real_path(file)
|
||||
var worker_command_array := cli_args_no_files.clone()
|
||||
mut worker_command_array := cli_args_no_files.clone()
|
||||
worker_command_array << ['-worker', fpath]
|
||||
worker_cmd := worker_command_array.join(' ')
|
||||
if foptions.is_verbose {
|
||||
@@ -252,8 +252,8 @@ fn file_to_target_os(file string) string {
|
||||
}
|
||||
|
||||
fn file_to_mod_name_and_is_module_file(file string) (string, bool) {
|
||||
var mod_name := 'main'
|
||||
var is_module_file := false
|
||||
mut mod_name := 'main'
|
||||
mut is_module_file := false
|
||||
flines := read_source_lines(file) or {
|
||||
return mod_name, is_module_file
|
||||
}
|
||||
@@ -287,7 +287,7 @@ fn get_compile_name_of_potential_v_project(file string) string {
|
||||
all_files_in_pfolder := os.ls(pfolder) or {
|
||||
panic(err)
|
||||
}
|
||||
var vfiles := []string
|
||||
mut vfiles := []string
|
||||
for f in all_files_in_pfolder {
|
||||
vf := os.join_path(pfolder, f)
|
||||
if f.starts_with('.') || !f.ends_with('.v') || os.is_dir(vf) {
|
||||
@@ -304,7 +304,7 @@ fn get_compile_name_of_potential_v_project(file string) string {
|
||||
// containing `fn main` then the folder contains multiple standalone
|
||||
// v programs. If only one contains `fn main` then the folder is
|
||||
// a project folder, that should be compiled with `v pfolder`.
|
||||
var main_fns := 0
|
||||
mut main_fns := 0
|
||||
for f in vfiles {
|
||||
slines := read_source_lines(f) or {
|
||||
panic(err)
|
||||
|
12
cmd/v/v.v
12
cmd/v/v.v
@@ -109,9 +109,9 @@ fn main() {
|
||||
}
|
||||
|
||||
fn parse_args(args []string) (&pref.Preferences, string) {
|
||||
var res := &pref.Preferences{}
|
||||
var command := ''
|
||||
var command_pos := 0
|
||||
mut res := &pref.Preferences{}
|
||||
mut command := ''
|
||||
mut command_pos := 0
|
||||
// for i, arg in args {
|
||||
for i := 0; i < args.len; i++ {
|
||||
arg := args[i]
|
||||
@@ -198,7 +198,7 @@ fn parse_args(args []string) (&pref.Preferences, string) {
|
||||
i++
|
||||
}
|
||||
else {
|
||||
var should_continue := false
|
||||
mut should_continue := false
|
||||
for flag_with_param in list_of_flags_with_param {
|
||||
if '-$flag_with_param' == arg {
|
||||
should_continue = true
|
||||
@@ -254,8 +254,8 @@ fn create_symlink() {
|
||||
return
|
||||
}
|
||||
vexe := pref.vexe_path()
|
||||
var link_path := '/usr/local/bin/v'
|
||||
var ret := os.exec('ln -sf $vexe $link_path') or {
|
||||
mut link_path := '/usr/local/bin/v'
|
||||
mut ret := os.exec('ln -sf $vexe $link_path') or {
|
||||
panic(err)
|
||||
}
|
||||
if ret.exit_code == 0 {
|
||||
|
Reference in New Issue
Block a user