v8intrinsic.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _types = require("../tokenizer/types");
  7. var N = _interopRequireWildcard(require("../types"));
  8. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
  9. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  10. var _default = superClass => class extends superClass {
  11. parseV8Intrinsic() {
  12. if (this.match(_types.types.modulo)) {
  13. const v8IntrinsicStart = this.state.start;
  14. const node = this.startNode();
  15. this.eat(_types.types.modulo);
  16. if (this.match(_types.types.name)) {
  17. const name = this.parseIdentifierName(this.state.start);
  18. const identifier = this.createIdentifier(node, name);
  19. identifier.type = "V8IntrinsicIdentifier";
  20. if (this.match(_types.types.parenL)) {
  21. return identifier;
  22. }
  23. }
  24. this.unexpected(v8IntrinsicStart);
  25. }
  26. }
  27. parseExprAtom() {
  28. return this.parseV8Intrinsic() || super.parseExprAtom(...arguments);
  29. }
  30. };
  31. exports.default = _default;