Skip to content

v.builder #

fn compile #

fn compile(command string, pref_ &pref.Preferences, backend_cb FnBackend)

fn module_path #

fn module_path(mod string) string

fn new_builder #

fn new_builder(pref_ &pref.Preferences) Builder

fn verror #

fn verror(s string)

type FnBackend #

type FnBackend = fn (mut b Builder)

struct Builder #

struct Builder {
pub:
	compiled_dir string // contains os.real_path() of the dir of the final file being compiled, or the dir itself when doing `v .`
	module_path  string
pub mut:
	checker             &checker.Checker         = unsafe { nil }
	transformer         &transformer.Transformer = unsafe { nil }
	out_name_c          string
	out_name_js         string
	stats_lines         int // size of backend generated source code in lines
	stats_bytes         int // size of backend generated source code in bytes
	nr_errors           int // accumulated error count of scanner, parser, checker, and builder
	nr_warnings         int // accumulated warning count of scanner, parser, checker, and builder
	nr_notices          int // accumulated notice count of scanner, parser, checker, and builder
	pref                &pref.Preferences = unsafe { nil }
	module_search_paths []string
	parsed_files        []&ast.File
	//$if windows {
	cached_msvc MsvcResult
	//}
	table     &ast.Table = unsafe { nil }
	ccoptions CcompilerOptions
	// Note: changes in mod `builtin` force invalidation of every other .v file
	mod_invalidates_paths map[string][]string // changes in mod `os`, invalidate only .v files, that do `import os`
	mod_invalidates_mods  map[string][]string // changes in mod `os`, force invalidation of mods, that do `import os`
	path_invalidates_mods map[string][]string // changes in a .v file from `os`, invalidates `os`
	crun_cache_keys       []string            // target executable + top level source files; filled in by Builder.should_rebuild
	executable_exists     bool                // if the executable already exists, don't remove new executable after `v run`
}

fn (Builder) cc #

fn (mut v Builder) cc()

fn (Builder) dump_c_options #

fn (b &Builder) dump_c_options(all_args []string)

fn (Builder) dump_defines #

fn (b &Builder) dump_defines()

fn (Builder) dump_files #

fn (b &Builder) dump_files(files []string)

fn (Builder) dump_modules #

fn (b &Builder) dump_modules(mods []string)

fn (Builder) error_with_pos #

fn (b &Builder) error_with_pos(s string, fpath string, pos token.Pos) errors.Error

fn (Builder) find_invalidated_modules_by_files #

fn (mut b Builder) find_invalidated_modules_by_files(all_files []string) []string

fn (Builder) find_module_path #

fn (b &Builder) find_module_path(mod string, fpath string) !string

Todo: try to merge this & util.module functions to create areliable multi use function. see comments in util/module.v

fn (Builder) front_and_middle_stages #

fn (mut b Builder) front_and_middle_stages(v_files []string) !

fn (Builder) front_stages #

fn (mut b Builder) front_stages(v_files []string) !

fn (Builder) get_builtin_files #

fn (v Builder) get_builtin_files() []string

fn (Builder) get_user_files #

fn (v &Builder) get_user_files() []string

fn (Builder) get_vtmp_filename #

fn (mut b Builder) get_vtmp_filename(base_file_name string, postfix string) string

fn (Builder) import_graph #

fn (b &Builder) import_graph() &depgraph.DepGraph

graph of all imported modules

fn (Builder) info #

fn (b &Builder) info(s string)

fn (Builder) interpret_text #

fn (mut b Builder) interpret_text(code string, v_files []string) !

fn (Builder) log #

fn (b &Builder) log(s string)

fn (Builder) middle_stages #

fn (mut b Builder) middle_stages() !

fn (Builder) parse_imports #

fn (mut b Builder) parse_imports()

parse all deps from already parsed files

fn (Builder) print_warnings_and_errors #

fn (mut b Builder) print_warnings_and_errors()

fn (Builder) quote_compiler_name #

fn (mut v Builder) quote_compiler_name(name string) string

fn (Builder) rebuild #

fn (mut b Builder) rebuild(backend_cb FnBackend)

fn (Builder) rebuild_modules #

fn (mut b Builder) rebuild_modules()

fn (Builder) resolve_deps #

fn (mut b Builder) resolve_deps()

fn (Builder) set_module_lookup_paths #

fn (mut v Builder) set_module_lookup_paths()

'strings' => 'VROOT/vlib/strings' 'installed_mod' => '~/.vmodules/installed_mod' 'local_mod' => '/path/to/current/dir/local_mod'

fn (Builder) should_rebuild #

fn (mut b Builder) should_rebuild() bool

fn (Builder) show_total_warns_and_errors_stats #

fn (b &Builder) show_total_warns_and_errors_stats()

fn (Builder) v_files_from_dir #

fn (b &Builder) v_files_from_dir(dir string) []string