From 442fa07dd43ab66b6dd1fdb5a3f1257b7c13bb6e Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Wed, 26 May 2021 21:32:54 +0200 Subject: [PATCH] relax name conflict rule regarding block names vs subroutine params --- .../prog8/compiler/astprocessing/AstIdentifiersChecker.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/compiler/src/prog8/compiler/astprocessing/AstIdentifiersChecker.kt b/compiler/src/prog8/compiler/astprocessing/AstIdentifiersChecker.kt index a8bbcc367..5bbe337a7 100644 --- a/compiler/src/prog8/compiler/astprocessing/AstIdentifiersChecker.kt +++ b/compiler/src/prog8/compiler/astprocessing/AstIdentifiersChecker.kt @@ -89,7 +89,7 @@ internal class AstIdentifiersChecker(private val program: Program, private val e if (existing != null && existing !== subroutine) nameError(subroutine.name, subroutine.position, existing) - // check that there are no local variables, labels, or other subs that redefine the subroutine's parameters + // check that there are no local variables, labels, or other subs that redefine the subroutine's parameters. Blocks are okay. val symbolsInSub = subroutine.allDefinedSymbols() val namesInSub = symbolsInSub.map{ it.first }.toSet() val paramNames = subroutine.parameters.map { it.name }.toSet() @@ -101,9 +101,6 @@ internal class AstIdentifiersChecker(private val program: Program, private val e val sub = subroutine.statements.firstOrNull { it is Subroutine && it.name==name} if(sub!=null) nameError(name, subroutine.position, sub) - val block = program.allBlocks().firstOrNull { it.name==name } - if(block!=null) - nameError(name, subroutine.position, block) } if(subroutine.isAsmSubroutine && subroutine.statements.any{it !is InlineAssembly}) {