mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builder: search for .v files in /src/ if there are none
This commit is contained in:
parent
b5f2636b73
commit
c90e8185ed
@ -42,8 +42,10 @@ fn init_time_base() C.mach_timebase_info_data_t {
|
|||||||
fn sys_mono_now_darwin() u64 {
|
fn sys_mono_now_darwin() u64 {
|
||||||
tm := C.mach_absolute_time()
|
tm := C.mach_absolute_time()
|
||||||
if time.time_base.denom == 0 {
|
if time.time_base.denom == 0 {
|
||||||
|
unsafe {
|
||||||
C.mach_timebase_info(&time.time_base)
|
C.mach_timebase_info(&time.time_base)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return (tm - time.start_time) * time.time_base.numer / time.time_base.denom
|
return (tm - time.start_time) * time.time_base.numer / time.time_base.denom
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,8 +55,10 @@ fn sys_mono_now_darwin() u64 {
|
|||||||
fn vpc_now_darwin() u64 {
|
fn vpc_now_darwin() u64 {
|
||||||
tm := C.mach_absolute_time()
|
tm := C.mach_absolute_time()
|
||||||
if time.time_base.denom == 0 {
|
if time.time_base.denom == 0 {
|
||||||
|
unsafe {
|
||||||
C.mach_timebase_info(&time.time_base)
|
C.mach_timebase_info(&time.time_base)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return (tm - time.start_time) * time.time_base.numer / time.time_base.denom
|
return (tm - time.start_time) * time.time_base.numer / time.time_base.denom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,19 @@ pub fn (b Builder) v_files_from_dir(dir string) []string {
|
|||||||
if b.pref.is_verbose {
|
if b.pref.is_verbose {
|
||||||
println('v_files_from_dir ("$dir")')
|
println('v_files_from_dir ("$dir")')
|
||||||
}
|
}
|
||||||
return b.pref.should_compile_filtered_files(dir, files)
|
res := b.pref.should_compile_filtered_files(dir, files)
|
||||||
|
if res.len == 0 {
|
||||||
|
// Perhaps the .v files are stored in /src/ ?
|
||||||
|
src_path := os.join_path(dir, 'src')
|
||||||
|
if os.exists(src_path) {
|
||||||
|
if b.pref.is_verbose {
|
||||||
|
println('v_files_from_dir ("$src_path") (/src/)')
|
||||||
|
}
|
||||||
|
files = os.ls(src_path) or { panic(err) }
|
||||||
|
return b.pref.should_compile_filtered_files(src_path, files)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (b Builder) log(s string) {
|
pub fn (b Builder) log(s string) {
|
||||||
|
@ -3244,6 +3244,11 @@ pub fn (mut c Checker) prefix_expr(mut node ast.PrefixExpr) ast.Type {
|
|||||||
ast.InfixExpr, ast.StringLiteral, ast.StringInterLiteral] {
|
ast.InfixExpr, ast.StringLiteral, ast.StringInterLiteral] {
|
||||||
c.error('cannot take the address of $expr', node.pos)
|
c.error('cannot take the address of $expr', node.pos)
|
||||||
}
|
}
|
||||||
|
if mut node.right is ast.Ident {
|
||||||
|
if node.right.kind == .constant && !c.inside_unsafe && c.pref.experimental {
|
||||||
|
c.warn('cannot take an address of const outside `unsafe`', node.right.pos)
|
||||||
|
}
|
||||||
|
}
|
||||||
if mut node.right is ast.IndexExpr {
|
if mut node.right is ast.IndexExpr {
|
||||||
typ_sym := c.table.sym(node.right.left_type)
|
typ_sym := c.table.sym(node.right.left_type)
|
||||||
mut is_mut := false
|
mut is_mut := false
|
||||||
|
Loading…
Reference in New Issue
Block a user