UNPKG

586 BJavaScriptView Raw
1var helpers = require('../helpers');
2var BlockStatement = require('./BlockStatement');
3var VariableDeclaration = require('./VariableDeclaration');
4
5var Program = module.exports = function(body, comments) {
6 this.type = 'Program';
7 this.body = body;
8 this.comments = comments;
9};
10
11Program.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
21Program.prototype.transform = BlockStatement.prototype.transform;