packages/core/parcel-bundler/src/scope-hoisting/shake.js
function getUnusedBinding(path, name) {
  let binding = path.scope.getBinding(name);
  if (!binding) {
    return null;
  }

  let pure = isPure(binding);
  if (!binding.referenced && pure) {
    return binding;
  }

  // Is there any references which aren't simple assignments?
  let bailout = binding.referencePaths.some(
    path => !isExportAssignment(path) && !isUnusedWildcard(path)
  );

  if (!bailout && pure) {
    return binding;
  }

  return null;
}
function getUnusedBinding(path, name) {
  let binding = path.scope.getBinding(name);
  if (!binding) {
    return null;
  }

  let pure = isPure(binding);
  if (!binding.referenced && pure) {
    return binding;
  }

  // Is there any references which aren't simple assignments?
  let bailout = binding.referencePaths.some(
    path => !isExportAssignment(path) && !isUnusedWildcard(path)
  );

  if (!bailout && pure) {
    return binding;
  }

  return null;
}
function getUnusedBinding ( path , name ) { let binding = path . scope . getBinding ( name ) ; if ( ! binding ) { return null ; } let pure = isPure ( binding ) ; if ( ! binding . referenced && pure ) { return binding ; } // Is there any references which aren't simple assignments? let bailout = binding . referencePaths . some ( path => ! isExportAssignment ( path ) && ! isUnusedWildcard ( path ) ) ; if ( ! bailout && pure ) { return binding ; } return null ; }
Check if a binding is safe to remove and returns it if it is.
Check if a binding is safe to remove and returns it if it is .