File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -324,13 +324,17 @@ pub fn (mut c Checker) check_files(ast_files []&ast.File) {
324
324
// println('check_files')
325
325
// c.files = ast_files
326
326
mut has_main_mod_file := false
327
+ mut has_no_main_mod_file := false
327
328
mut has_main_fn := false
328
329
unsafe {
329
330
mut files_from_main_module := []& ast.File{}
330
331
for i in 0 .. ast_files.len {
331
332
mut file := ast_files[i]
332
333
c.timers.start ('checker_check ${file.path} ' )
333
334
c.check (mut file)
335
+ if file.mod.name == 'no_main' {
336
+ has_no_main_mod_file = true
337
+ }
334
338
if file.mod.name == 'main' {
335
339
files_from_main_module << file
336
340
has_main_mod_file = true
@@ -446,6 +450,9 @@ pub fn (mut c Checker) check_files(ast_files []&ast.File) {
446
450
// This is useful for compiling linux kernel modules for example.
447
451
return
448
452
}
453
+ if has_no_main_mod_file {
454
+ return
455
+ }
449
456
if ! has_main_mod_file {
450
457
c.error ('project must include a `main` module or be a shared library (compile with `v -shared`)' ,
451
458
token.Pos{})
You can’t perform that action at this time.
0 commit comments