diff --git a/lib/6to5/file.js b/lib/6to5/file.js index c41bc96066..bd24298afe 100644 --- a/lib/6to5/file.js +++ b/lib/6to5/file.js @@ -33,6 +33,17 @@ File.normaliseOptions = function (opts) { return opts; }; +File.prototype.parse = function (code) { + // remove shebang + code = code.replace(/^\#\!.*/, ""); + + var self = this; + + return util.parse(this.opts, code, function (tree) { + return self.transform(tree); + }); +}; + File.prototype.transform = function (ast) { this.ast = ast; diff --git a/lib/6to5/transform.js b/lib/6to5/transform.js index 42cd8bfde8..bb2edefffa 100644 --- a/lib/6to5/transform.js +++ b/lib/6to5/transform.js @@ -11,10 +11,7 @@ function transform(code, opts) { code = (code || "") + ""; var file = new File(opts); - - return util.parse(opts, code, function (tree) { - return file.transform(tree); - }); + return util.parse(code); } transform.test = function (task, assert) {