fix compiler crash with scoped const vardecls

This commit is contained in:
Irmen de Jong
2021-04-18 01:56:26 +02:00
parent e93701f50e
commit 329f491c30
2 changed files with 8 additions and 9 deletions

View File

@@ -78,7 +78,7 @@ internal class BeforeAsmGenerationAstChanger(val program: Program, val errors: I
} }
override fun after(scope: AnonymousScope, parent: Node): Iterable<IAstModification> { override fun after(scope: AnonymousScope, parent: Node): Iterable<IAstModification> {
val decls = scope.statements.filterIsInstance<VarDecl>() val decls = scope.statements.filterIsInstance<VarDecl>().filter { it.type == VarDeclType.VAR }
subroutineVariables.addAll(decls.map { it.name to it }) subroutineVariables.addAll(decls.map { it.name to it })
val sub = scope.definingSubroutine() val sub = scope.definingSubroutine()

View File

@@ -1,11 +1,10 @@
%import textio
%zeropage dontuse
main { main {
uword hash_buckets = memory("buckets", 128*32*2) sub start() {
if cx16.r0 {
sub start() { const ubyte buffer_length = 255 ; less than 256
txt.print_uwhex(hash_buckets,true) ubyte[255] buffer
txt.print("ok") ubyte[buffer_length] buffer2
}
} }
} }