1
3 package jminusminus;
4
5 import static jminusminus.CLConstants.*;
6
7
10 class JConditionalExpression extends JExpression {
11 private JExpression condition;
13
14 private JExpression thenPart;
16
17 private JExpression elsePart;
19
20
28 public JConditionalExpression(int line, JExpression condition, JExpression thenPart,
29 JExpression elsePart) {
30 super(line);
31 this.condition = condition;
32 this.thenPart = thenPart;
33 this.elsePart = elsePart;
34 }
35
36
39 public JExpression analyze(Context context) {
40 return this;
42 }
43
44
47 public void codegen(CLEmitter output) {
48 }
50
51
54 public void toJSON(JSONElement json) {
55 JSONElement e = new JSONElement();
56 json.addChild("JConditionalExpression:" + line, e);
57 JSONElement e1 = new JSONElement();
58 e.addChild("Condition", e1);
59 condition.toJSON(e1);
60 JSONElement e2 = new JSONElement();
61 e.addChild("ThenPart", e2);
62 thenPart.toJSON(e2);
63 JSONElement e3 = new JSONElement();
64 e.addChild("ElsePart", e3);
65 elsePart.toJSON(e3);
66 }
67 }
68