small optimization with generics and use os.is_dir in vweb again
parent
4edade5067
commit
ab91733a28
|
@ -1370,13 +1370,11 @@ fn (p mut Parser) save_generic_tmpl(f mut Fn, pos int) {
|
||||||
fn (f &Fn) generic_tmpl_to_inst(ti TypeInst) string {
|
fn (f &Fn) generic_tmpl_to_inst(ti TypeInst) string {
|
||||||
mut fn_body := ''
|
mut fn_body := ''
|
||||||
for tok in f.generic_tmpl {
|
for tok in f.generic_tmpl {
|
||||||
mut toks := tok.str()
|
mut tok_str := tok.str()
|
||||||
if toks in ti.inst {
|
if tok.tok == .name && tok_str in ti.inst {
|
||||||
for k,v in ti.inst {
|
tok_str = ti.inst[tok_str]
|
||||||
toks = toks.replace(k, v)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fn_body += ' $toks'
|
fn_body += ' $tok_str'
|
||||||
}
|
}
|
||||||
return fn_body
|
return fn_body
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,8 @@ fn (ctx mut Context) scan_static_directory(directory_path, mount_path string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: os.is_dir is broken now so we expect that file is dir it has no extension
|
// todo: os.is_dir is broken now so we expect that file is dir it has no extension
|
||||||
if flag {
|
// if flag {
|
||||||
|
if os.is_dir(file) {
|
||||||
ctx.scan_static_directory(directory_path + '/' + file, mount_path + '/' + file)
|
ctx.scan_static_directory(directory_path + '/' + file, mount_path + '/' + file)
|
||||||
} else {
|
} else {
|
||||||
ctx.static_files[mount_path + '/' + file] = directory_path + '/' + file
|
ctx.static_files[mount_path + '/' + file] = directory_path + '/' + file
|
||||||
|
|
Loading…
Reference in New Issue