source: trip-planner-front/node_modules/@webassemblyjs/wasm-gen/lib/index.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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