mirror of
https://github.com/irmen/prog8.git
synced 2025-01-14 17:31:01 +00:00
removed invalid duplicate name check about subroutine parameters
This commit is contained in:
parent
f2b069c562
commit
f0cd03d14f
@ -88,14 +88,6 @@ 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)
|
||||||
|
|
||||||
// does the parameter redefine a variable declared elsewhere?
|
|
||||||
for(param in subroutine.parameters) {
|
|
||||||
val existingVar = subroutine.lookup(listOf(param.name), subroutine)
|
|
||||||
if (existingVar != null && existingVar.parent !== subroutine) {
|
|
||||||
nameError(param.name, param.position, existingVar)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
||||||
val symbolsInSub = subroutine.allDefinedSymbols()
|
val symbolsInSub = subroutine.allDefinedSymbols()
|
||||||
val namesInSub = symbolsInSub.map{ it.first }.toSet()
|
val namesInSub = symbolsInSub.map{ it.first }.toSet()
|
||||||
|
@ -8,14 +8,6 @@
|
|||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
;asmsub clear_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) { ...}
|
|
||||||
; TODO dont cause name conflict if we define sub or sub with param 'color' or even a var 'color' later.
|
|
||||||
|
|
||||||
; sub color(...) {}
|
|
||||||
; sub other(ubyte color) {} ; TODO don't cause name conflict
|
|
||||||
|
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user