mirror of
https://github.com/irmen/prog8.git
synced 2024-11-03 13:07:54 +00:00
properly report duplicate label names
This commit is contained in:
parent
e34dac8dbb
commit
73fc18099e
@ -108,7 +108,7 @@ internal class AstIdentifiersChecker(private val errors: IErrorReporter,
|
|||||||
// the builtin functions can't be redefined
|
// the builtin functions can't be redefined
|
||||||
errors.err("builtin function cannot be redefined", label.position)
|
errors.err("builtin function cannot be redefined", label.position)
|
||||||
} else {
|
} else {
|
||||||
val existing = label.definingSubroutine?.getAllLabels(label.name) ?: emptyList()
|
val existing = (label.definingSubroutine ?: label.definingBlock).getAllLabels(label.name)
|
||||||
for(el in existing) {
|
for(el in existing) {
|
||||||
if(el === label || el.name != label.name)
|
if(el === label || el.name != label.name)
|
||||||
continue
|
continue
|
||||||
|
@ -1,11 +1,25 @@
|
|||||||
%zeropage basicsafe
|
%import textio
|
||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
str myBar = "main.bar"
|
||||||
ubyte @shared xx
|
|
||||||
|
foo_bar:
|
||||||
|
|
||||||
|
sub start() {
|
||||||
|
txt.print(myBar)
|
||||||
|
txt.print(&foo_bar)
|
||||||
|
return
|
||||||
|
|
||||||
|
quert:
|
||||||
|
quert:
|
||||||
|
quert:
|
||||||
|
quert:
|
||||||
|
|
||||||
if xx==1 or xx==2 or xx==3 {
|
|
||||||
xx++
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub start() {
|
||||||
}
|
}
|
||||||
|
foo_bar:
|
||||||
|
foo_bar:
|
||||||
|
foo_bar:
|
||||||
|
foo_bar:
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user