mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: disallow pub fn main()
This commit is contained in:
parent
c4b7d7cab3
commit
84ac634c31
@ -79,6 +79,10 @@ pub fn (c mut Checker) check_files(ast_files []ast.File) {
|
||||
if all_mods['main'] > 0 {
|
||||
for i, f in c.table.fns {
|
||||
if f.name == 'main' {
|
||||
if f.is_pub {
|
||||
c.error('function `main` cannot be declared public', token.Position{})
|
||||
exit(1)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user