| | |
| | | Object.defineProperty(exports, "__esModule", { |
| | | value: true |
| | | }); |
| | | exports.skipAllButComputedKey = skipAllButComputedKey; |
| | | exports.default = exports.environmentVisitor = void 0; |
| | | exports.default = void 0; |
| | | Object.defineProperty(exports, "environmentVisitor", { |
| | | enumerable: true, |
| | | get: function () { |
| | | return _helperEnvironmentVisitor.default; |
| | | } |
| | | }); |
| | | Object.defineProperty(exports, "skipAllButComputedKey", { |
| | | enumerable: true, |
| | | get: function () { |
| | | return _helperEnvironmentVisitor.skipAllButComputedKey; |
| | | } |
| | | }); |
| | | |
| | | var _traverse = require("@babel/traverse"); |
| | | |
| | |
| | | |
| | | var _helperOptimiseCallExpression = require("@babel/helper-optimise-call-expression"); |
| | | |
| | | var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor"); |
| | | |
| | | var _t = require("@babel/types"); |
| | | |
| | | const { |
| | | VISITOR_KEYS, |
| | | assignmentExpression, |
| | | booleanLiteral, |
| | | callExpression, |
| | |
| | | identifier, |
| | | memberExpression, |
| | | sequenceExpression, |
| | | staticBlock, |
| | | stringLiteral, |
| | | thisExpression |
| | | } = _t; |
| | |
| | | return callExpression(file.addHelper("getPrototypeOf"), [targetRef]); |
| | | } |
| | | |
| | | function skipAllButComputedKey(path) { |
| | | if (!path.node.computed) { |
| | | path.skip(); |
| | | return; |
| | | } |
| | | |
| | | const keys = VISITOR_KEYS[path.type]; |
| | | |
| | | for (const key of keys) { |
| | | if (key !== "key") path.skipKey(key); |
| | | } |
| | | } |
| | | |
| | | const environmentVisitor = { |
| | | [`${staticBlock ? "StaticBlock|" : ""}ClassPrivateProperty|TypeAnnotation`](path) { |
| | | path.skip(); |
| | | }, |
| | | |
| | | Function(path) { |
| | | if (path.isMethod()) return; |
| | | if (path.isArrowFunctionExpression()) return; |
| | | path.skip(); |
| | | }, |
| | | |
| | | "Method|ClassProperty"(path) { |
| | | skipAllButComputedKey(path); |
| | | } |
| | | |
| | | }; |
| | | exports.environmentVisitor = environmentVisitor; |
| | | |
| | | const visitor = _traverse.default.visitors.merge([environmentVisitor, { |
| | | const visitor = _traverse.default.visitors.merge([_helperEnvironmentVisitor.default, { |
| | | Super(path, state) { |
| | | const { |
| | | node, |
| | |
| | | |
| | | }]); |
| | | |
| | | const unshadowSuperBindingVisitor = _traverse.default.visitors.merge([environmentVisitor, { |
| | | const unshadowSuperBindingVisitor = _traverse.default.visitors.merge([_helperEnvironmentVisitor.default, { |
| | | Scopable(path, { |
| | | refName |
| | | }) { |