source: imaps-frontend/node_modules/regenerator-transform/lib/util.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.3 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports.getTypes = getTypes;
5exports.isReference = isReference;
6exports.replaceWithOrRemove = replaceWithOrRemove;
7exports.runtimeProperty = runtimeProperty;
8exports.wrapWithTypes = wrapWithTypes;
9/**
10 * Copyright (c) 2014-present, Facebook, Inc.
11 *
12 * This source code is licensed under the MIT license found in the
13 * LICENSE file in the root directory of this source tree.
14 */
15
16var currentTypes = null;
17function wrapWithTypes(types, fn) {
18 return function () {
19 var oldTypes = currentTypes;
20 currentTypes = types;
21 try {
22 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
23 args[_key] = arguments[_key];
24 }
25 return fn.apply(this, args);
26 } finally {
27 currentTypes = oldTypes;
28 }
29 };
30}
31function getTypes() {
32 return currentTypes;
33}
34function runtimeProperty(name) {
35 var t = getTypes();
36 return t.memberExpression(t.identifier("regeneratorRuntime"), t.identifier(name), false);
37}
38function isReference(path) {
39 return path.isReferenced() || path.parentPath.isAssignmentExpression({
40 left: path.node
41 });
42}
43function replaceWithOrRemove(path, replacement) {
44 if (replacement) {
45 path.replaceWith(replacement);
46 } else {
47 path.remove();
48 }
49}
Note: See TracBrowser for help on using the repository browser.