mirror of
https://github.com/vlang/v.git
synced 2025-09-16 16:02:29 +03:00
compiler: cache modules
This commit is contained in:
parent
f45d3f07ed
commit
52f4f4026b
10 changed files with 422 additions and 242 deletions
|
@ -144,6 +144,7 @@ fn (p mut Parser) is_sig() bool {
|
|||
fn (p mut Parser) fn_decl() {
|
||||
p.clear_vars() // clear local vars every time a new fn is started
|
||||
p.fgen('fn ')
|
||||
|
||||
//defer { p.fgenln('\n') }
|
||||
// If we are in the first pass, create a new function.
|
||||
// In the second pass fetch the one we created.
|
||||
|
@ -426,10 +427,17 @@ fn (p mut Parser) fn_decl() {
|
|||
if !is_c && p.first_pass() {
|
||||
// TODO hack to make Volt compile without -embed_vlib
|
||||
if f.name == 'darwin__nsstring' && p.pref.build_mode == .default_mode {
|
||||
return
|
||||
|
||||
} else {
|
||||
p.cgen.fns << fn_decl + ';'
|
||||
}
|
||||
p.cgen.fns << fn_decl + ';'
|
||||
}
|
||||
// Generate .vh header files when building a module
|
||||
/*
|
||||
if p.pref.build_mode == .build_module {
|
||||
p.vh_genln(f.v_definition())
|
||||
}
|
||||
*/
|
||||
return
|
||||
}
|
||||
if p.attr == 'live' && p.pref.is_so {
|
||||
|
@ -1092,11 +1100,6 @@ fn (f &Fn) typ_str() string {
|
|||
return sb.str()
|
||||
}
|
||||
|
||||
// "fn foo(a int) stirng", for .vh module headers
|
||||
fn (f &Fn) v_definition() string {
|
||||
return 'fn '//$f.name(${f.str_args()})'
|
||||
}
|
||||
|
||||
// f.args => "int a, string b"
|
||||
fn (f &Fn) str_args(table &Table) string {
|
||||
mut s := ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue