mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: cache modules if they are not built yet
This commit is contained in:
parent
a5ccc4673b
commit
e1dd4c19b5
@ -111,20 +111,14 @@ fn (v mut V) cc() {
|
||||
a << '-c'
|
||||
}
|
||||
else if v.pref.is_debug {
|
||||
vexe := os.executable()
|
||||
builtin_o_path := '$v_modules_path/vlib/builtin.o'
|
||||
if os.file_exists(builtin_o_path) {
|
||||
libs = builtin_o_path
|
||||
} else {
|
||||
println('$builtin_o_path not found... build module builtin')
|
||||
println('$builtin_o_path not found... building module builtin')
|
||||
os.system('$vexe build module vlib/builtin')
|
||||
}
|
||||
// '$v_modules_path/vlib/strings.o '+
|
||||
// '$v_modules_path/vlib/math.o '
|
||||
/*
|
||||
if !os.file_exists(libs) {
|
||||
println('object file `$libs` not found')
|
||||
exit(1)
|
||||
}
|
||||
*/
|
||||
for imp in v.table.imports {
|
||||
if imp == 'webview' {
|
||||
continue
|
||||
@ -134,7 +128,8 @@ fn (v mut V) cc() {
|
||||
if os.file_exists(path) {
|
||||
libs += ' ' + path
|
||||
} else {
|
||||
println('$path not found... build module $imp')
|
||||
println('$path not found... building module $imp')
|
||||
os.system('$vexe build module vlib/$imp')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -419,8 +419,8 @@ fn (p mut Parser) fn_decl() {
|
||||
p.genln('pthread_mutex_lock(&live_fn_mutex);')
|
||||
}
|
||||
|
||||
if f.name == 'main__main' || f.name == 'main' || f.name == 'WinMain' {
|
||||
if p.pref.is_test && !p.scanner.file_path.contains('/volt') {
|
||||
if f.name in ['main__main', 'main', 'WinMain'] {
|
||||
if p.pref.is_test {
|
||||
p.error_with_token_index('tests cannot have function `main`', f.fn_name_token_idx)
|
||||
}
|
||||
}
|
||||
|
@ -1686,6 +1686,7 @@ fn (p mut Parser) bterm() string {
|
||||
|
||||
// also called on *, &, @, . (enum)
|
||||
fn (p mut Parser) name_expr() string {
|
||||
//println('n')
|
||||
p.has_immutable_field = false
|
||||
p.is_const_literal = false
|
||||
ph := p.cgen.add_placeholder()
|
||||
@ -2958,7 +2959,7 @@ fn (p mut Parser) map_init() string {
|
||||
mut i := 0
|
||||
for {
|
||||
key := p.lit
|
||||
keys_gen += 'tos2((byte*)"$key"), '
|
||||
keys_gen += 'tos3("$key"), '
|
||||
p.check(.str)
|
||||
p.check(.colon)
|
||||
p.cgen.start_tmp()
|
||||
|
@ -177,6 +177,7 @@ pub fn (m &map) keys() []string {
|
||||
}
|
||||
|
||||
fn (m map) get(key string, out voidptr) bool {
|
||||
//println('g')
|
||||
if m.root == 0 {
|
||||
return false
|
||||
}
|
||||
|
@ -333,6 +333,7 @@ pub fn exec(cmd string) ?Result {
|
||||
}
|
||||
}
|
||||
|
||||
// `system` works like `exec()`, but only returns a return code.
|
||||
pub fn system(cmd string) int {
|
||||
mut ret := int(0)
|
||||
$if windows {
|
||||
|
Loading…
Reference in New Issue
Block a user