c2034034e2d3c401c617f96c07acb0a5276976b103c9b2bde1364829f4ffb6e22ccfb9dfec1ff543201df0bb338bb3c07946ba16f8ca240da098818ba0dc11 780 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Copyright (c) 2014, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
  7. * additional grant of patent rights can be found in the PATENTS file in
  8. * the same directory.
  9. */
  10. import * as t from "babel-types";
  11. export function runtimeProperty(name) {
  12. return t.memberExpression(
  13. t.identifier("regeneratorRuntime"),
  14. t.identifier(name),
  15. false
  16. );
  17. }
  18. export function isReference(path) {
  19. return path.isReferenced() || path.parentPath.isAssignmentExpression({ left: path.node });
  20. }
  21. export function replaceWithOrRemove(path, replacement) {
  22. if (replacement) {
  23. path.replaceWith(replacement)
  24. } else {
  25. path.remove();
  26. }
  27. }