mirror of
https://github.com/irmen/prog8.git
synced 2024-12-26 14:29:35 +00:00
check for name conflict with existing block (/module)
This commit is contained in:
parent
61784a03bb
commit
87cee7a0fd
@ -119,9 +119,12 @@ internal class AstIdentifiersChecker(private val program: Program, private val e
|
||||
val labelOrVar = subroutine.getLabelOrVariable(name)
|
||||
if(labelOrVar!=null && labelOrVar.position != subroutine.position)
|
||||
nameError(name, labelOrVar.position, subroutine)
|
||||
val sub = subroutine.statements.singleOrNull { it is Subroutine && it.name==name}
|
||||
val sub = subroutine.statements.firstOrNull { it is Subroutine && it.name==name}
|
||||
if(sub!=null)
|
||||
nameError(name, sub.position, subroutine)
|
||||
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}) {
|
||||
|
@ -6,10 +6,7 @@
|
||||
|
||||
main {
|
||||
|
||||
; TODO: error when a parameter has the same name as an existing module/block/subroutine: sub print_right(ubyte width, uword string) {
|
||||
|
||||
sub start() {
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub start2 () {
|
||||
|
Loading…
Reference in New Issue
Block a user