v.pref: fix `error: duplicate method` with -b native of a file.v with `import os`

pull/10703/head
Delyan Angelov 2021-07-08 19:19:28 +03:00
parent fb9b2e873c
commit f5d3a6e020
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 10 additions and 0 deletions

View File

@ -21,6 +21,9 @@ pub fn (prefs &Preferences) should_compile_filtered_files(dir string, files_ []s
if prefs.backend == .js && !prefs.should_compile_js(file) {
continue
}
if prefs.backend == .native && !prefs.should_compile_native(file) {
continue
}
if prefs.backend != .js && !prefs.should_compile_asm(file) {
continue
}
@ -83,6 +86,7 @@ pub fn (prefs &Preferences) should_compile_filtered_files(dir string, files_ []s
res << file
}
if prefs.is_verbose {
// println('>>> prefs: $prefs')
println('>>> should_compile_filtered_files: res: $res')
}
return res
@ -118,6 +122,12 @@ fn fname_without_platform_postfix(file string) string {
return res
}
pub fn (prefs &Preferences) should_compile_native(file string) bool {
// allow custom filtering for native backends,
// but if there are no other rules, default to the c backend rules
return prefs.should_compile_c(file)
}
pub fn (prefs &Preferences) should_compile_c(file string) bool {
if file.ends_with('.js.v') {
// Probably something like `a.js.v`.