mirror of
https://github.com/irmen/prog8.git
synced 2024-11-27 03:50:27 +00:00
relax name conflict rule regarding block names vs subroutine params
This commit is contained in:
parent
31ae9e1243
commit
442fa07dd4
@ -89,7 +89,7 @@ internal class AstIdentifiersChecker(private val program: Program, private val e
|
|||||||
if (existing != null && existing !== subroutine)
|
if (existing != null && existing !== subroutine)
|
||||||
nameError(subroutine.name, subroutine.position, existing)
|
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 symbolsInSub = subroutine.allDefinedSymbols()
|
||||||
val namesInSub = symbolsInSub.map{ it.first }.toSet()
|
val namesInSub = symbolsInSub.map{ it.first }.toSet()
|
||||||
val paramNames = subroutine.parameters.map { it.name }.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}
|
val sub = subroutine.statements.firstOrNull { it is Subroutine && it.name==name}
|
||||||
if(sub!=null)
|
if(sub!=null)
|
||||||
nameError(name, subroutine.position, sub)
|
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}) {
|
if(subroutine.isAsmSubroutine && subroutine.statements.any{it !is InlineAssembly}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user