Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.shrinkPaddedLEB128 = shrinkPaddedLEB128;
  6. var _wasmParser = require("@webassemblyjs/wasm-parser");
  7. var _leb = require("./leb128.js");
  8. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  10. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  11. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  12. var OptimizerError =
  13. /*#__PURE__*/
  14. function (_Error) {
  15. _inherits(OptimizerError, _Error);
  16. function OptimizerError(name, initalError) {
  17. var _this;
  18. _classCallCheck(this, OptimizerError);
  19. _this = _possibleConstructorReturn(this, (OptimizerError.__proto__ || Object.getPrototypeOf(OptimizerError)).call(this, "Error while optimizing: " + name + ": " + initalError.message));
  20. _this.stack = initalError.stack;
  21. return _this;
  22. }
  23. return OptimizerError;
  24. }(Error);
  25. var decoderOpts = {
  26. ignoreCodeSection: true,
  27. ignoreDataSection: true
  28. };
  29. function shrinkPaddedLEB128(uint8Buffer) {
  30. try {
  31. var ast = (0, _wasmParser.decode)(uint8Buffer.buffer, decoderOpts);
  32. return (0, _leb.shrinkPaddedLEB128)(ast, uint8Buffer);
  33. } catch (e) {
  34. throw new OptimizerError("shrinkPaddedLEB128", e);
  35. }
  36. }