allow multiple targets in AssignTarget

This commit is contained in:
Irmen de Jong
2024-01-13 02:05:52 +01:00
parent 66e7c51064
commit edc83305a4
18 changed files with 195 additions and 94 deletions
+11 -2
View File
@@ -41,9 +41,18 @@ class PtSubroutineParameter(name: String, val type: DataType, position: Position
sealed interface IPtAssignment {
val children: MutableList<PtNode>
val target: PtAssignTarget
get() = children[0] as PtAssignTarget
get() {
if(children.size==2)
return children[0] as PtAssignTarget
else if(children.size<2)
throw AssemblyError("incomplete node")
else
throw AssemblyError("no singular target")
}
val value: PtExpression
get() = children[1] as PtExpression
get() = children.last() as PtExpression
val multiTarget: Boolean
get() = children.size>2
}
class PtAssignment(position: Position) : PtNode(position), IPtAssignment