less verbose anon label names

This commit is contained in:
Irmen de Jong 2019-03-16 00:11:04 +01:00
parent 563122ac92
commit 223bab21aa
2 changed files with 3 additions and 3 deletions

View File

@ -1584,7 +1584,7 @@ class AnonymousScope(override var statements: MutableList<IStatement>,
override lateinit var parent: Node
init {
name = "<<<anonymous-$sequenceNumber>>>"
name = "<anon-$sequenceNumber>" // make sure it's an invalid soruce code identifier so user source code can never produce it
sequenceNumber++
}

View File

@ -25,7 +25,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
init {
// Because 64tass understands scoped names via .proc / .block,
// we'll strip the block prefix from all scoped names in the program.
// Also, convert invalid label names (such as "<<<anonymous-1>>>") to something that's allowed.
// Also, convert invalid label names (such as "<anon-1>") to something that's allowed.
// Also have to do that for the variablesMarkedForZeropage!
val newblocks = mutableListOf<IntermediateProgram.ProgramBlock>()
for(block in program.blocks) {
@ -128,7 +128,7 @@ class AsmGen(val options: CompilationOptions, val program: IntermediateProgram,
scoped
}
}
name = name.replace("<<<", "prog8_").replace(">>>", "")
name = name.replace("<", "prog8_").replace(">", "") // take care of the autogenerated invalid (anon) label names
if(name=="-")
return "-"
if(blockLocal)