mirror of
https://github.com/irmen/prog8.git
synced 2025-11-01 06:16:15 +00:00
allow goto to take any expression, not only an integer or an identifier (part 1)
This commit is contained in:
@@ -68,12 +68,7 @@ fun printAst(root: PtNode, skipLibraries: Boolean, output: (text: String) -> Uni
|
||||
"%asm {{ ...${node.assembly.length} characters... }}"
|
||||
}
|
||||
is PtJump -> {
|
||||
if(node.identifier!=null)
|
||||
"goto ${node.identifier.name}"
|
||||
else if(node.address!=null)
|
||||
"goto ${node.address.toHex()}"
|
||||
else
|
||||
"???"
|
||||
"goto ${txt(node.target)}"
|
||||
}
|
||||
is PtAsmSub -> {
|
||||
val params = node.parameters.joinToString(", ") {
|
||||
|
||||
@@ -116,11 +116,9 @@ class PtIfElse(position: Position) : PtNode(position) {
|
||||
}
|
||||
|
||||
|
||||
class PtJump(val identifier: PtIdentifier?, // note: even ad-hoc labels are wrapped as an Identifier to simplify code. Just use dummy type and position.
|
||||
val address: UInt?,
|
||||
position: Position) : PtNode(position) {
|
||||
class PtJump(val target: PtExpression, position: Position) : PtNode(position) {
|
||||
init {
|
||||
identifier?.let {it.parent = this }
|
||||
target.parent = this
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user