@@ -69,7 +69,8 @@ sealed class Expression {
6969 override fun toString () = " [${args.joinToString(" , " )} ]"
7070 }
7171
72- class SwitchCases (val lhs : ExpressionNode , val cases : Array <CaseOp >, val defaultBlock : ExpressionNode ? ) : ExpressionNode {
72+ class SwitchCases (val lhs : ExpressionNode , val cases : Array <CaseOp >, val defaultBlock : ExpressionNode ? ) :
73+ ExpressionNode {
7374 override fun toString (): String {
7475 val casesStr = cases.joinToString(" \n " ) { " case ${it.condition} : ${it.thenBlock} " }
7576 val defaultStr = if (defaultBlock != null ) {
@@ -84,14 +85,37 @@ sealed class Expression {
8485 class RangeOp (val lhs : ExpressionNode , val rhs : ExpressionNode ) : ExpressionNode {
8586 override fun toString () = " $lhs ..$rhs "
8687 }
87-
88+
8889 class CaseOp (val condition : ExpressionNode , val thenBlock : ExpressionNode ) : ExpressionNode {
8990 override fun toString () = " $condition -> $thenBlock "
9091 }
91-
92+
9293 class Value (val value : Any ) : ExpressionNode {
9394 override fun toString () = value.toString()
9495 }
96+
97+ class JumpOp (val op : JumpOpKind ) : ExpressionNode {
98+ override fun toString () = op.toString()
99+ }
100+ }
101+
102+ // Throw, Return, Break, Continue
103+ sealed class JumpOpKind {
104+ class Throw (val expr : ExpressionNode ) : JumpOpKind() {
105+ override fun toString () = " throw $expr "
106+ }
107+
108+ class Return (val expr : ExpressionNode ) : JumpOpKind() {
109+ override fun toString () = " return $expr "
110+ }
111+
112+ class Break (val expr : ExpressionNode ) : JumpOpKind() {
113+ override fun toString () = " break $expr "
114+ }
115+
116+ class Continue (val expr : ExpressionNode ) : JumpOpKind() {
117+ override fun toString () = " continue $expr "
118+ }
95119}
96120
97121sealed class AssignOpKind {
@@ -146,6 +170,7 @@ sealed class ComparisonOpKind {
146170 object Equal : ComparisonOpKind() {
147171 override fun toString () = " =="
148172 }
173+
149174 object NotEqual : ComparisonOpKind() {
150175 override fun toString () = " !="
151176 }
0 commit comments