Skip to content

Commit 2bd211c

Browse files
committed
Modify JavaHelper.ts and cseMachine/java/components/Control.tsx to be able to run switch statements on the CSEC machine
1 parent b9d33a2 commit 2bd211c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/features/cseMachine/java/components/Control.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ export class Control extends Visible {
130130
return 'deref';
131131
case ECE.InstrType.COND:
132132
return `cond`;
133+
case ECE.InstrType.SWITCH:
134+
return `switch`;
133135
default:
134136
return 'INSTRUCTION';
135137
}
@@ -192,6 +194,9 @@ export class Control extends Visible {
192194
return 'Dereference most recently pushed value from stash';
193195
case ECE.InstrType.COND:
194196
return 'Evaluate condition and push either consequent or alternative to stash';
197+
case ECE.InstrType.SWITCH:
198+
const switchInstr = controlItem as ECE.SwitchInstr;
199+
return `Switch on ${astToString(switchInstr.expr)} and push result of case to stash`;
195200
default:
196201
return 'INSTRUCTION';
197202
}

0 commit comments

Comments
 (0)