diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:31:11 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:31:11 +0800 |
| commit | aa773172311dcada759dfbaac485f4bc6e00bc21 (patch) | |
| tree | ca6d9a5eff3ab8f689f9acb4f0df791d9486813d /node_modules/regenerator-transform/lib/util.js | |
| parent | c5a5384e846f242e901e859fe600d695d8990a9a (diff) | |
added babel
Diffstat (limited to 'node_modules/regenerator-transform/lib/util.js')
| -rw-r--r-- | node_modules/regenerator-transform/lib/util.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/node_modules/regenerator-transform/lib/util.js b/node_modules/regenerator-transform/lib/util.js new file mode 100644 index 00000000..535cbed4 --- /dev/null +++ b/node_modules/regenerator-transform/lib/util.js @@ -0,0 +1,49 @@ +"use strict"; + +exports.__esModule = true; +exports.getTypes = getTypes; +exports.isReference = isReference; +exports.replaceWithOrRemove = replaceWithOrRemove; +exports.runtimeProperty = runtimeProperty; +exports.wrapWithTypes = wrapWithTypes; +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +var currentTypes = null; +function wrapWithTypes(types, fn) { + return function () { + var oldTypes = currentTypes; + currentTypes = types; + try { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + return fn.apply(this, args); + } finally { + currentTypes = oldTypes; + } + }; +} +function getTypes() { + return currentTypes; +} +function runtimeProperty(name) { + var t = getTypes(); + return t.memberExpression(t.identifier("regeneratorRuntime"), t.identifier(name), false); +} +function isReference(path) { + return path.isReferenced() || path.parentPath.isAssignmentExpression({ + left: path.node + }); +} +function replaceWithOrRemove(path, replacement) { + if (replacement) { + path.replaceWith(replacement); + } else { + path.remove(); + } +}
\ No newline at end of file |
