builder: add 'builtin' to builtin_module_parts instead of .clone()

pull/5350/head
Delyan Angelov 2020-06-11 19:23:13 +03:00
parent b2428290f9
commit 05177b9dcb
3 changed files with 7 additions and 4 deletions

View File

@ -18,13 +18,13 @@ pub:
mut:
checker checker.Checker
pref &pref.Preferences
parsed_files []ast.File
global_scope &ast.Scope
out_name_c string
out_name_js string
max_nr_errors int = 100
pub mut:
module_search_paths []string
parsed_files []ast.File
}
pub fn new_builder(pref &pref.Preferences) Builder {
@ -142,8 +142,7 @@ pub fn (mut b Builder) resolve_deps() {
// graph of all imported modules
pub fn (b &Builder) import_graph() &depgraph.DepGraph {
mut builtins := util.builtin_module_parts.clone()
builtins << 'builtin'
builtins := util.builtin_module_parts
mut graph := depgraph.new_dep_graph()
for p in b.parsed_files {
mut deps := []string{}

View File

@ -156,6 +156,10 @@ Did you forget to add vlib to the path? (Use @vlib for default vlib)')
}
pub fn (v Builder) get_user_files() []string {
if v.pref.path == 'vlib/builtin' {
// get_builtin_files() has already added the builtin files:
return []
}
mut dir := v.pref.path
v.log('get_v_files($dir)')
// Need to store user files separately, because they have to be added after

View File

@ -12,7 +12,7 @@ pub const (
// math.bits is needed by strconv.ftoa
pub const (
builtin_module_parts = ['math.bits', 'strconv', 'strconv.ftoa', 'hash.wyhash', 'strings']
builtin_module_parts = ['math.bits', 'strconv', 'strconv.ftoa', 'hash.wyhash', 'strings', 'builtin']
)
pub const (