mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 16:29:21 +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 d2ier = via2+14
|
||||||
&ubyte d2ora = via2+15
|
&ubyte d2ora = via2+15
|
||||||
|
|
||||||
&ubyte ym2151adr = $9f40
|
; YM-2151 sound chip
|
||||||
&ubyte ym2151dat = $9f41
|
&ubyte YM_ADDRESS = $9f40
|
||||||
|
&ubyte YM_DATA = $9f41
|
||||||
|
|
||||||
const uword extdev = $9f60
|
const uword extdev = $9f60
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ internal class AstIdentifiersChecker(private val errors: IErrorReporter,
|
|||||||
|
|
||||||
val existing = subroutine.lookup(listOf(subroutine.name))
|
val existing = subroutine.lookup(listOf(subroutine.name))
|
||||||
if (existing != null && existing !== subroutine) {
|
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)
|
nameShadowWarning(subroutine.name, existing.position, subroutine)
|
||||||
else
|
else
|
||||||
nameError(subroutine.name, existing.position, subroutine)
|
nameError(subroutine.name, existing.position, subroutine)
|
||||||
|
@ -3,7 +3,6 @@ TODO
|
|||||||
|
|
||||||
For next release
|
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)
|
- 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.
|
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
|
- 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 textio
|
||||||
|
%import psg
|
||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
main {
|
main {
|
||||||
ubyte @shared qqq=123
|
|
||||||
|
|
||||||
&uword mapped = $ea31
|
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
ubyte bb = 99
|
ubyte @shared variable
|
||||||
txt.print_ub(bb)
|
|
||||||
txt.print("Hello, world!")
|
sub nested() {
|
||||||
uword ww = bb
|
ubyte @shared variable2
|
||||||
txt.print_uw(bb)
|
|
||||||
txt.print_uw(ww)
|
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