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

vfmt: ran v vet vlib/v/ and fix spaces

This commit is contained in:
Delyan Angelov 2020-07-04 16:19:54 +03:00
parent d2a2db7bff
commit fe50bdc164
7 changed files with 56 additions and 72 deletions

View File

@ -36,7 +36,6 @@ pub fn (mut o OrderedDepMap) add(name string, deps []string) {
if dep !in d {
d << dep
}
//
else{}
}
o.set(name, d)

View File

@ -1,6 +1,6 @@
import v.table
import v.doc
import v.pref
//import v.table
//import v.doc
//import v.pref
// fn test_vdoc() {
// mut prefs := &pref.Preferences{}

View File

@ -9,8 +9,7 @@ import os
pub enum BuildMode {
// `v program.v'
// Build user code only, and add pre-compiled vlib (`cc program.o builtin.o os.o...`)
default_mode
// `v -lib ~/v/os`
default_mode // `v -lib ~/v/os`
// build any module (generate os.o + os.vh)
build_module
}
@ -41,10 +40,8 @@ pub enum CompilerType {
}
const (
list_of_flags_with_param = [
'o'
'output', 'd', 'define', 'b', 'backend', 'cc', 'os', 'target-os', 'arch', 'csource'
'cf', 'cflags', 'path']
list_of_flags_with_param = ['o', 'output', 'd', 'define', 'b', 'backend', 'cc', 'os', 'target-os',
'arch', 'csource', 'cf', 'cflags', 'path']
)
pub struct Preferences {
@ -107,11 +104,9 @@ pub mut:
vroot string
out_name string
path string // Path to file/folder to compile
// -d vfmt and -d another=0 for `$if vfmt { will execute }` and `$if another { will NOT get here }`
compile_defines []string // just ['vfmt']
compile_defines_all []string // contains both: ['vfmt','another']
run_args []string // `v run x.v 1 2 3` => `1 2 3`
printfn_list []string // a list of generated function names, whose source should be shown, for debugging
print_v_files bool // when true, just print the list of all parsed .v files then stop.
@ -124,7 +119,7 @@ pub mut:
}
pub fn parse_args(args []string) (&Preferences, string) {
mut res := &pref.Preferences{}
mut res := &Preferences{}
mut command := ''
mut command_pos := 0
// for i, arg in args {
@ -222,7 +217,7 @@ pub fn parse_args(args []string) (&Preferences, string) {
'-os' {
target_os := cmdline.option(current_args, '-os', '')
i++
target_os_kind := pref.os_from_string(target_os) or {
target_os_kind := os_from_string(target_os) or {
if target_os == 'cross' {
res.output_cross_c = true
continue
@ -256,7 +251,7 @@ pub fn parse_args(args []string) (&Preferences, string) {
i++
}
'-b' {
b := pref.backend_from_string(cmdline.option(current_args, '-b', 'c')) or {
b := backend_from_string(cmdline.option(current_args, '-b', 'c')) or {
continue
}
res.backend = b
@ -318,21 +313,12 @@ pub fn parse_args(args []string) (&Preferences, string) {
return res, command
}
pub fn backend_from_string(s string) ?Backend {
match s {
'c' {
return .c
}
'js' {
return .js
}
'x64' {
return .x64
}
else {
return error('Unknown backend type $s')
}
'c' { return .c }
'js' { return .js }
'x64' { return .x64 }
else { return error('Unknown backend type $s') }
}
}

View File

@ -227,7 +227,6 @@ pub fn (mut t Table) register_builtin_type_symbol(typ TypeSymbol) int {
kind: existing_type.kind
}
}
//
else {
t.types[existing_idx] = typ
}