Merge pull request #3477 from mattkrick/patch-1

turn transform into a simple `for` loop
This commit is contained in:
Logan Smyth 2016-04-24 16:47:31 -07:00
commit 27bd5c6719

View File

@ -438,13 +438,14 @@ export default class File extends Store {
transform(): BabelFileResult { transform(): BabelFileResult {
// In the "pass per preset" mode, we have grouped passes. // In the "pass per preset" mode, we have grouped passes.
// Otherwise, there is only one plain pluginPasses array. // Otherwise, there is only one plain pluginPasses array.
this.pluginPasses.forEach((pluginPasses, index) => { for (let i = 0; i < this.pluginPasses.length; i++) {
const pluginPasses = this.pluginPasses[i];
this.call("pre", pluginPasses); this.call("pre", pluginPasses);
this.log.debug("Start transform traverse"); this.log.debug("Start transform traverse");
traverse(this.ast, traverse.visitors.merge(this.pluginVisitors[index], pluginPasses), this.scope); traverse(this.ast, traverse.visitors.merge(this.pluginVisitors[i], pluginPasses), this.scope);
this.log.debug("End transform traverse"); this.log.debug("End transform traverse");
this.call("post", pluginPasses); this.call("post", pluginPasses);
}); }
return this.generate(); return this.generate();
} }