Projekt

Obecné

Profil

Stáhnout (2.12 KB) Statistiky
| Větev: | Revize:
1
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); }
2

    
3
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4

    
5
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; }
6

    
7
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; }
8

    
9
import { decode } from "@webassemblyjs/wasm-parser";
10
import { shrinkPaddedLEB128 as makeShrinkPaddedLEB128 } from "./leb128.js";
11

    
12
var OptimizerError =
13
/*#__PURE__*/
14
function (_Error) {
15
  _inherits(OptimizerError, _Error);
16

    
17
  function OptimizerError(name, initalError) {
18
    var _this;
19

    
20
    _classCallCheck(this, OptimizerError);
21

    
22
    _this = _possibleConstructorReturn(this, (OptimizerError.__proto__ || Object.getPrototypeOf(OptimizerError)).call(this, "Error while optimizing: " + name + ": " + initalError.message));
23
    _this.stack = initalError.stack;
24
    return _this;
25
  }
26

    
27
  return OptimizerError;
28
}(Error);
29

    
30
var decoderOpts = {
31
  ignoreCodeSection: true,
32
  ignoreDataSection: true
33
};
34
export function shrinkPaddedLEB128(uint8Buffer) {
35
  try {
36
    var ast = decode(uint8Buffer.buffer, decoderOpts);
37
    return makeShrinkPaddedLEB128(ast, uint8Buffer);
38
  } catch (e) {
39
    throw new OptimizerError("shrinkPaddedLEB128", e);
40
  }
41
}
(1-1/2)