1 | var helpers = require('../helpers');
|
2 | var BlockStatement = require('./BlockStatement');
|
3 | var VariableDeclaration = require('./VariableDeclaration');
|
4 |
|
5 | var Program = module.exports = function(body, comments) {
|
6 | this.type = 'Program';
|
7 | this.body = body;
|
8 | this.comments = comments;
|
9 | };
|
10 |
|
11 | Program.prototype.normalize = function (place) {
|
12 | BlockStatement.prototype.normalize.call(this, place);
|
13 |
|
14 | var dec = helpers.extractVariableDeclarations(this);
|
15 | if (dec.declarations.length > 0) {
|
16 | this.body.unshift(dec);
|
17 | }
|
18 |
|
19 | };
|
20 |
|
21 | Program.prototype.transform = BlockStatement.prototype.transform;
|