mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: check for module name duplicates
This commit is contained in:
parent
14db4a38a9
commit
22202ef680
@ -355,6 +355,9 @@ fn (mut c Checker) assign_stmt(mut node ast.AssignStmt) {
|
||||
c.warn('duplicate of a const name `${full_name}`', left.pos)
|
||||
}
|
||||
}
|
||||
if left.mod == left.name && !c.file.path.contains('vlib') {
|
||||
c.error('duplicate of an module name `${left.name}`', left.pos)
|
||||
}
|
||||
// Check if variable name is already registered as imported module symbol
|
||||
if c.check_import_sym_conflict(left.name) {
|
||||
c.error('duplicate of an import symbol `${left.name}`', left.pos)
|
||||
|
@ -256,11 +256,17 @@ fn (mut c Checker) fn_decl(mut node ast.FnDecl) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if node.mod == param.name && !c.file.path.contains('vlib') {
|
||||
c.error('duplicate of an module name `${param.name}`', param.pos)
|
||||
}
|
||||
// Check if parameter name is already registered as imported module symbol
|
||||
if c.check_import_sym_conflict(param.name) {
|
||||
c.error('duplicate of an import symbol `${param.name}`', param.pos)
|
||||
}
|
||||
}
|
||||
if node.mod == node.short_name && !c.file.path.contains('vlib') && node.mod != 'main' {
|
||||
c.error('duplicate of an module name `${node.short_name}`', node.pos)
|
||||
}
|
||||
// Check if function name is already registered as imported module symbol
|
||||
if !node.is_method && c.check_import_sym_conflict(node.short_name) {
|
||||
c.error('duplicate of an import symbol `${node.short_name}`', node.pos)
|
||||
|
Loading…
Reference in New Issue
Block a user