lib/optimiser.js
function removeUnusedAssignmentExpressions (ast) {
  var unused = findUnusedAssignmentExpressions(ast);
  traverse.traverse(ast, {
    enter: function (node, parent) {
      if (node.type !== 'BlockStatement') {
        return;
      }
      node.body = fast.filter(node.body, function (item) {
        return !~fast.indexOf(unused, item);
      });
    }
  });
  return ast;
}
function removeUnusedAssignmentExpressions (ast) {
  var unused = findUnusedAssignmentExpressions(ast);
  traverse.traverse(ast, {
    enter: function (node, parent) {
      if (node.type !== 'BlockStatement') {
        return;
      }
      node.body = fast.filter(node.body, function (item) {
        return !~fast.indexOf(unused, item);
      });
    }
  });
  return ast;
}
function removeUnusedAssignmentExpressions ( ast ) { var unused = findUnusedAssignmentExpressions ( ast ) ; traverse . traverse ( ast , { enter : function ( node , parent ) { if ( node . type !== 'BlockStatement' ) { return ; } node . body = fast . filter ( node . body , function ( item ) { return ! ~ fast . indexOf ( unused , item ) ; } ) ; } } ) ; return ast ; }
If the result of an AssignmentExpression is not used, remove the
expression entirely.
If the result of an AssignmentExpression is not used remove the expression entirely .