mirror of
https://github.com/irmen/prog8.git
synced 2024-12-23 09:32:43 +00:00
fix possible string error on inlined subroutines
This commit is contained in:
parent
592f74124c
commit
dc32318cec
@ -100,7 +100,9 @@ class UnusedCodeRemover(private val program: Program,
|
|||||||
if(!subroutine.definingModule.isLibrary && !subroutine.hasBeenInlined) {
|
if(!subroutine.definingModule.isLibrary && !subroutine.hasBeenInlined) {
|
||||||
errors.warn("unused subroutine '${subroutine.name}'", subroutine.position)
|
errors.warn("unused subroutine '${subroutine.name}'", subroutine.position)
|
||||||
}
|
}
|
||||||
program.removeInternedStringsFromRemovedSubroutine(subroutine)
|
if(!subroutine.inline) {
|
||||||
|
program.removeInternedStringsFromRemovedSubroutine(subroutine)
|
||||||
|
}
|
||||||
return listOf(IAstModification.Remove(subroutine, parent as IStatementContainer))
|
return listOf(IAstModification.Remove(subroutine, parent as IStatementContainer))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -764,6 +764,20 @@ main {
|
|||||||
sub start() {
|
sub start() {
|
||||||
sort(cards)
|
sort(cards)
|
||||||
}
|
}
|
||||||
|
}"""
|
||||||
|
compileText(C64Target(), true, text, writeAssembly = false) shouldNotBe null
|
||||||
|
}
|
||||||
|
|
||||||
|
test("no string error when inlining") {
|
||||||
|
val text="""
|
||||||
|
main {
|
||||||
|
sub start() {
|
||||||
|
test()
|
||||||
|
}
|
||||||
|
|
||||||
|
sub test() {
|
||||||
|
cx16.r0 = "abc"
|
||||||
|
}
|
||||||
}"""
|
}"""
|
||||||
compileText(C64Target(), true, text, writeAssembly = false) shouldNotBe null
|
compileText(C64Target(), true, text, writeAssembly = false) shouldNotBe null
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user