builder: do not allow importing 'builtin' module

pull/4982/head
Swastik Baranwal 2020-05-21 20:01:41 +05:30 committed by GitHub
parent cb82ff618b
commit bf7ab19d09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -60,6 +60,10 @@ pub fn (mut b Builder) parse_imports() {
ast_file := b.parsed_files[i]
for _, imp in ast_file.imports {
mod := imp.mod
if mod == 'builtin' {
verror('cannot import module "$mod"')
break
}
if mod in done_imports {
continue
}