mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 01:29:28 +00:00
fixed subroutine name shadow check
This commit is contained in:
parent
e614e9787a
commit
3dcf628fdb
@ -290,8 +290,9 @@ cx16 {
|
||||
&ubyte d2ier = via2+14
|
||||
&ubyte d2ora = via2+15
|
||||
|
||||
&ubyte ym2151adr = $9f40
|
||||
&ubyte ym2151dat = $9f41
|
||||
; YM-2151 sound chip
|
||||
&ubyte YM_ADDRESS = $9f40
|
||||
&ubyte YM_DATA = $9f41
|
||||
|
||||
const uword extdev = $9f60
|
||||
|
||||
|
@ -86,7 +86,7 @@ internal class AstIdentifiersChecker(private val errors: IErrorReporter,
|
||||
|
||||
val existing = subroutine.lookup(listOf(subroutine.name))
|
||||
if (existing != null && existing !== subroutine) {
|
||||
if(existing.parent!==existing.parent) // TODO fix this check
|
||||
if(existing.parent!==subroutine.parent && existing is Subroutine)
|
||||
nameShadowWarning(subroutine.name, existing.position, subroutine)
|
||||
else
|
||||
nameError(subroutine.name, existing.position, subroutine)
|
||||
|
@ -3,7 +3,6 @@ TODO
|
||||
|
||||
For next release
|
||||
^^^^^^^^^^^^^^^^
|
||||
- AstIdentifiersChecker: fix the subroutine name shadow if-condition (see vardecl check)
|
||||
- 6502 codegen: make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as ``p8v_``? Or not worth it (most 3 letter opcodes as variables are nonsensical anyway)
|
||||
then we can get rid of the instruction lists in the machinedefinitions as well. This is already no problem at all in the IR codegen.
|
||||
- create BSS section in output program and put StStaticVariables in there with bss=true. Don't forget to add init code to zero out everything that was put in bss. If array in bss->only zero ONCE! So requires self-modifying code
|
||||
|
@ -1,17 +1,35 @@
|
||||
%import textio
|
||||
%import psg
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
ubyte @shared qqq=123
|
||||
|
||||
&uword mapped = $ea31
|
||||
|
||||
sub start() {
|
||||
ubyte bb = 99
|
||||
txt.print_ub(bb)
|
||||
txt.print("Hello, world!")
|
||||
uword ww = bb
|
||||
txt.print_uw(bb)
|
||||
txt.print_uw(ww)
|
||||
ubyte @shared variable
|
||||
|
||||
sub nested() {
|
||||
ubyte @shared variable2
|
||||
|
||||
variable2 = 33
|
||||
nested()
|
||||
|
||||
sub nested() {
|
||||
ubyte @shared variable3
|
||||
|
||||
variable3 = 33
|
||||
}
|
||||
}
|
||||
|
||||
nested()
|
||||
explosion()
|
||||
}
|
||||
|
||||
sub explosion() {
|
||||
; this subroutine is not used but it is an example of how to make a sound effect using the psg library!
|
||||
psg.silent()
|
||||
psg.voice(0, psg.LEFT, 63, psg.NOISE, 0)
|
||||
psg.voice(1, psg.RIGHT, 63, psg.NOISE, 0)
|
||||
psg.freq(0, 1000)
|
||||
psg.freq(1, 2000)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user