mirror of
https://github.com/irmen/prog8.git
synced 2025-09-25 08:25:32 +00:00
improvements for inlined subroutines: fix identifier scoping
This commit is contained in:
@@ -137,8 +137,11 @@ class AstToSourceCode(val output: (text: String) -> Unit, val program: Program):
|
||||
|
||||
override fun visit(subroutine: Subroutine) {
|
||||
output("\n")
|
||||
outputi("")
|
||||
if(subroutine.inline)
|
||||
output("inline ")
|
||||
if(subroutine.isAsmSubroutine) {
|
||||
outputi("asmsub ${subroutine.name} (")
|
||||
output("asmsub ${subroutine.name} (")
|
||||
for(param in subroutine.parameters.zip(subroutine.asmParameterRegisters)) {
|
||||
val reg =
|
||||
when {
|
||||
@@ -152,7 +155,7 @@ class AstToSourceCode(val output: (text: String) -> Unit, val program: Program):
|
||||
}
|
||||
}
|
||||
else {
|
||||
outputi("sub ${subroutine.name} (")
|
||||
output("sub ${subroutine.name} (")
|
||||
for(param in subroutine.parameters) {
|
||||
output("${datatypeString(param.type)} ${param.name}")
|
||||
if(param!==subroutine.parameters.last())
|
||||
|
@@ -711,8 +711,7 @@ internal fun makeRange(fromVal: Int, toVal: Int, stepVal: Int): IntProgression {
|
||||
}
|
||||
}
|
||||
|
||||
data class IdentifierReference(val nameInSource: List<String>, override val position: Position) : Expression(),
|
||||
IAssignable {
|
||||
data class IdentifierReference(val nameInSource: List<String>, override val position: Position) : Expression(), IAssignable {
|
||||
override lateinit var parent: Node
|
||||
|
||||
fun targetStatement(program: Program) =
|
||||
|
Reference in New Issue
Block a user