Skip to content

Commit

Permalink
Mark evalScopes for DCE (Fix #366)
Browse files Browse the repository at this point in the history
As DCE is a separate pass and we recalculate path and scope by clearing
the path and scope caches, we need to mark evalscopes again for DCE
  • Loading branch information
boopathi committed Feb 18, 2017
1 parent 31abdc2 commit 9ebc3e1
Showing 1 changed file with 2 additions and 4 deletions.
@@ -1,7 +1,7 @@
"use strict";

const some = require("lodash.some");
const { markEvalScopes, isMarked: isEvalScopesMarked, hasEval } = require("babel-helper-mark-eval-scopes");
const { markEvalScopes, hasEval } = require("babel-helper-mark-eval-scopes");

function prevSiblings(path) {
const parentPath = path.parentPath;
Expand Down Expand Up @@ -773,9 +773,7 @@ module.exports = ({ types: t, traverse }) => {
traverse.clearCache();
path.scope.crawl();

if (!isEvalScopesMarked(path.scope)) {
markEvalScopes(path);
}
markEvalScopes(path);

// We need to run this plugin in isolation.
path.traverse(main, {
Expand Down

0 comments on commit 9ebc3e1

Please sign in to comment.