1 | var BlockStatement = require('./BlockStatement');
|
2 |
|
3 | var SwitchStatement = module.exports = function(discriminant, cases) {
|
4 | this.type = 'SwitchStatement';
|
5 | this.discriminant = discriminant;
|
6 | this.cases = cases;
|
7 | };
|
8 |
|
9 | SwitchStatement.prototype.normalize = function (body) {
|
10 | if (this.cases) {
|
11 | this.cases.forEach(function (sCase) {
|
12 | var block = new BlockStatement(sCase.consequent);
|
13 | block.normalize();
|
14 | sCase.consequent = block.body;
|
15 | });
|
16 | }
|
17 | body.push(this);
|
18 | };
|