source: imaps-frontend/node_modules/@webassemblyjs/wasm-gen/lib/index.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 3.1 KB
Line 
1"use strict";
2
3function _typeof(obj) { "@babel/helpers - typeof"; 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); }
4
5Object.defineProperty(exports, "__esModule", {
6 value: true
7});
8exports.encodeNode = encodeNode;
9exports.encodeU32 = void 0;
10
11var encoder = _interopRequireWildcard(require("./encoder"));
12
13function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
15function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
16
17function encodeNode(n) {
18 switch (n.type) {
19 case "ModuleImport":
20 // $FlowIgnore: ModuleImport ensure that the node is well formated
21 return encoder.encodeModuleImport(n);
22
23 case "SectionMetadata":
24 // $FlowIgnore: SectionMetadata ensure that the node is well formated
25 return encoder.encodeSectionMetadata(n);
26
27 case "CallInstruction":
28 // $FlowIgnore: SectionMetadata ensure that the node is well formated
29 return encoder.encodeCallInstruction(n);
30
31 case "CallIndirectInstruction":
32 // $FlowIgnore: SectionMetadata ensure that the node is well formated
33 return encoder.encodeCallIndirectInstruction(n);
34
35 case "TypeInstruction":
36 return encoder.encodeTypeInstruction(n);
37
38 case "Instr":
39 // $FlowIgnore
40 return encoder.encodeInstr(n);
41
42 case "ModuleExport":
43 // $FlowIgnore: SectionMetadata ensure that the node is well formated
44 return encoder.encodeModuleExport(n);
45
46 case "Global":
47 // $FlowIgnore
48 return encoder.encodeGlobal(n);
49
50 case "Func":
51 return encoder.encodeFuncBody(n);
52
53 case "IndexInFuncSection":
54 return encoder.encodeIndexInFuncSection(n);
55
56 case "StringLiteral":
57 return encoder.encodeStringLiteral(n);
58
59 case "Elem":
60 return encoder.encodeElem(n);
61
62 default:
63 throw new Error("Unsupported encoding for node of type: " + JSON.stringify(n.type));
64 }
65}
66
67var encodeU32 = encoder.encodeU32;
68exports.encodeU32 = encodeU32;
Note: See TracBrowser for help on using the repository browser.