1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

revert "parser: disallow module name as expression name"

This reverts commit 3248962111.
This commit is contained in:
Turiiya 2023-05-08 13:38:09 +02:00
parent 3248962111
commit 14db4a38a9
3 changed files with 0 additions and 13 deletions

View File

@ -202,10 +202,6 @@ fn (mut p Parser) partial_assign_stmt(left []ast.Expr, left_comments []ast.Comme
match mut lx {
ast.Ident {
if op == .decl_assign {
if p.mod == lx.name {
return p.error_with_pos('expression names cannot match module name',
lx.pos)
}
if p.scope.known_var(lx.name) {
return p.error_with_pos('redefinition of `${lx.name}`', lx.pos)
}

View File

@ -373,12 +373,6 @@ fn (mut p Parser) fn_decl() ast.FnDecl {
params << args2
if !are_args_type_only {
for k, param in params {
if p.mod == param.name {
p.error_with_pos('parameter names cannot match module name', param.pos)
return ast.FnDecl{
scope: 0
}
}
if p.scope.known_var(param.name) {
p.error_with_pos('redefinition of parameter `${param.name}`', param.pos)
return ast.FnDecl{

View File

@ -3677,9 +3677,6 @@ fn (mut p Parser) const_decl() ast.ConstDecl {
if p.tok.kind == .decl_assign {
p.error_with_pos('cannot use `:=` to declare a const, use `=` instead', p.tok.pos())
}
if p.mod == name {
p.error_with_pos('const names cannot match module name', pos)
}
p.check(.assign)
end_comments << p.eat_comments()
if p.tok.kind == .key_fn {