1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | var Node = require('./node');
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | var Ternary = module.exports = function Ternary(cond, trueExpr, falseExpr){
|
24 | Node.call(this);
|
25 | this.cond = cond;
|
26 | this.trueExpr = trueExpr;
|
27 | this.falseExpr = falseExpr;
|
28 | };
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | Ternary.prototype.__proto__ = Node.prototype;
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | Ternary.prototype.clone = function(parent){
|
44 | var clone = new Ternary();
|
45 | clone.cond = this.cond.clone(parent, clone);
|
46 | clone.trueExpr = this.trueExpr.clone(parent, clone);
|
47 | clone.falseExpr = this.falseExpr.clone(parent, clone);
|
48 | clone.lineno = this.lineno;
|
49 | clone.column = this.column;
|
50 | clone.filename = this.filename;
|
51 | return clone;
|
52 | };
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | Ternary.prototype.toJSON = function(){
|
62 | return {
|
63 | __type: 'Ternary',
|
64 | cond: this.cond,
|
65 | trueExpr: this.trueExpr,
|
66 | falseExpr: this.falseExpr,
|
67 | lineno: this.lineno,
|
68 | column: this.column,
|
69 | filename: this.filename
|
70 | };
|
71 | };
|