nodes.js 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.module = _module;
  6. exports.moduleMetadata = moduleMetadata;
  7. exports.moduleNameMetadata = moduleNameMetadata;
  8. exports.functionNameMetadata = functionNameMetadata;
  9. exports.localNameMetadata = localNameMetadata;
  10. exports.binaryModule = binaryModule;
  11. exports.quoteModule = quoteModule;
  12. exports.sectionMetadata = sectionMetadata;
  13. exports.producersSectionMetadata = producersSectionMetadata;
  14. exports.producerMetadata = producerMetadata;
  15. exports.producerMetadataVersionedName = producerMetadataVersionedName;
  16. exports.loopInstruction = loopInstruction;
  17. exports.instr = instr;
  18. exports.ifInstruction = ifInstruction;
  19. exports.stringLiteral = stringLiteral;
  20. exports.numberLiteral = numberLiteral;
  21. exports.longNumberLiteral = longNumberLiteral;
  22. exports.floatLiteral = floatLiteral;
  23. exports.elem = elem;
  24. exports.indexInFuncSection = indexInFuncSection;
  25. exports.valtypeLiteral = valtypeLiteral;
  26. exports.typeInstruction = typeInstruction;
  27. exports.start = start;
  28. exports.globalType = globalType;
  29. exports.leadingComment = leadingComment;
  30. exports.blockComment = blockComment;
  31. exports.data = data;
  32. exports.global = global;
  33. exports.table = table;
  34. exports.memory = memory;
  35. exports.funcImportDescr = funcImportDescr;
  36. exports.moduleImport = moduleImport;
  37. exports.moduleExportDescr = moduleExportDescr;
  38. exports.moduleExport = moduleExport;
  39. exports.limit = limit;
  40. exports.signature = signature;
  41. exports.program = program;
  42. exports.identifier = identifier;
  43. exports.blockInstruction = blockInstruction;
  44. exports.callInstruction = callInstruction;
  45. exports.callIndirectInstruction = callIndirectInstruction;
  46. exports.byteArray = byteArray;
  47. exports.func = func;
  48. exports.internalBrUnless = internalBrUnless;
  49. exports.internalGoto = internalGoto;
  50. exports.internalCallExtern = internalCallExtern;
  51. exports.internalEndAndReturn = internalEndAndReturn;
  52. exports.assertInternalCallExtern = exports.assertInternalGoto = exports.assertInternalBrUnless = exports.assertFunc = exports.assertByteArray = exports.assertCallIndirectInstruction = exports.assertCallInstruction = exports.assertBlockInstruction = exports.assertIdentifier = exports.assertProgram = exports.assertSignature = exports.assertLimit = exports.assertModuleExport = exports.assertModuleExportDescr = exports.assertModuleImport = exports.assertFuncImportDescr = exports.assertMemory = exports.assertTable = exports.assertGlobal = exports.assertData = exports.assertBlockComment = exports.assertLeadingComment = exports.assertGlobalType = exports.assertStart = exports.assertTypeInstruction = exports.assertValtypeLiteral = exports.assertIndexInFuncSection = exports.assertElem = exports.assertFloatLiteral = exports.assertLongNumberLiteral = exports.assertNumberLiteral = exports.assertStringLiteral = exports.assertIfInstruction = exports.assertInstr = exports.assertLoopInstruction = exports.assertProducerMetadataVersionedName = exports.assertProducerMetadata = exports.assertProducersSectionMetadata = exports.assertSectionMetadata = exports.assertQuoteModule = exports.assertBinaryModule = exports.assertLocalNameMetadata = exports.assertFunctionNameMetadata = exports.assertModuleNameMetadata = exports.assertModuleMetadata = exports.assertModule = exports.isIntrinsic = exports.isImportDescr = exports.isNumericLiteral = exports.isExpression = exports.isInstruction = exports.isBlock = exports.isNode = exports.isInternalEndAndReturn = exports.isInternalCallExtern = exports.isInternalGoto = exports.isInternalBrUnless = exports.isFunc = exports.isByteArray = exports.isCallIndirectInstruction = exports.isCallInstruction = exports.isBlockInstruction = exports.isIdentifier = exports.isProgram = exports.isSignature = exports.isLimit = exports.isModuleExport = exports.isModuleExportDescr = exports.isModuleImport = exports.isFuncImportDescr = exports.isMemory = exports.isTable = exports.isGlobal = exports.isData = exports.isBlockComment = exports.isLeadingComment = exports.isGlobalType = exports.isStart = exports.isTypeInstruction = exports.isValtypeLiteral = exports.isIndexInFuncSection = exports.isElem = exports.isFloatLiteral = exports.isLongNumberLiteral = exports.isNumberLiteral = exports.isStringLiteral = exports.isIfInstruction = exports.isInstr = exports.isLoopInstruction = exports.isProducerMetadataVersionedName = exports.isProducerMetadata = exports.isProducersSectionMetadata = exports.isSectionMetadata = exports.isQuoteModule = exports.isBinaryModule = exports.isLocalNameMetadata = exports.isFunctionNameMetadata = exports.isModuleNameMetadata = exports.isModuleMetadata = exports.isModule = void 0;
  53. exports.nodeAndUnionTypes = exports.unionTypesMap = exports.assertInternalEndAndReturn = void 0;
  54. 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); }
  55. // THIS FILE IS AUTOGENERATED
  56. // see scripts/generateNodeUtils.js
  57. function isTypeOf(t) {
  58. return function (n) {
  59. return n.type === t;
  60. };
  61. }
  62. function assertTypeOf(t) {
  63. return function (n) {
  64. return function () {
  65. if (!(n.type === t)) {
  66. throw new Error('n.type === t' + " error: " + (undefined || "unknown"));
  67. }
  68. }();
  69. };
  70. }
  71. function _module(id, fields, metadata) {
  72. if (id !== null && id !== undefined) {
  73. if (!(typeof id === "string")) {
  74. throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));
  75. }
  76. }
  77. if (!(_typeof(fields) === "object" && typeof fields.length !== "undefined")) {
  78. throw new Error('typeof fields === "object" && typeof fields.length !== "undefined"' + " error: " + (undefined || "unknown"));
  79. }
  80. var node = {
  81. type: "Module",
  82. id: id,
  83. fields: fields
  84. };
  85. if (typeof metadata !== "undefined") {
  86. node.metadata = metadata;
  87. }
  88. return node;
  89. }
  90. function moduleMetadata(sections, functionNames, localNames, producers) {
  91. if (!(_typeof(sections) === "object" && typeof sections.length !== "undefined")) {
  92. throw new Error('typeof sections === "object" && typeof sections.length !== "undefined"' + " error: " + (undefined || "unknown"));
  93. }
  94. if (functionNames !== null && functionNames !== undefined) {
  95. if (!(_typeof(functionNames) === "object" && typeof functionNames.length !== "undefined")) {
  96. throw new Error('typeof functionNames === "object" && typeof functionNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
  97. }
  98. }
  99. if (localNames !== null && localNames !== undefined) {
  100. if (!(_typeof(localNames) === "object" && typeof localNames.length !== "undefined")) {
  101. throw new Error('typeof localNames === "object" && typeof localNames.length !== "undefined"' + " error: " + (undefined || "unknown"));
  102. }
  103. }
  104. if (producers !== null && producers !== undefined) {
  105. if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
  106. throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
  107. }
  108. }
  109. var node = {
  110. type: "ModuleMetadata",
  111. sections: sections
  112. };
  113. if (typeof functionNames !== "undefined" && functionNames.length > 0) {
  114. node.functionNames = functionNames;
  115. }
  116. if (typeof localNames !== "undefined" && localNames.length > 0) {
  117. node.localNames = localNames;
  118. }
  119. if (typeof producers !== "undefined" && producers.length > 0) {
  120. node.producers = producers;
  121. }
  122. return node;
  123. }
  124. function moduleNameMetadata(value) {
  125. if (!(typeof value === "string")) {
  126. throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
  127. }
  128. var node = {
  129. type: "ModuleNameMetadata",
  130. value: value
  131. };
  132. return node;
  133. }
  134. function functionNameMetadata(value, index) {
  135. if (!(typeof value === "string")) {
  136. throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
  137. }
  138. if (!(typeof index === "number")) {
  139. throw new Error('typeof index === "number"' + " error: " + ("Argument index must be of type number, given: " + _typeof(index) || "unknown"));
  140. }
  141. var node = {
  142. type: "FunctionNameMetadata",
  143. value: value,
  144. index: index
  145. };
  146. return node;
  147. }
  148. function localNameMetadata(value, localIndex, functionIndex) {
  149. if (!(typeof value === "string")) {
  150. throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
  151. }
  152. if (!(typeof localIndex === "number")) {
  153. throw new Error('typeof localIndex === "number"' + " error: " + ("Argument localIndex must be of type number, given: " + _typeof(localIndex) || "unknown"));
  154. }
  155. if (!(typeof functionIndex === "number")) {
  156. throw new Error('typeof functionIndex === "number"' + " error: " + ("Argument functionIndex must be of type number, given: " + _typeof(functionIndex) || "unknown"));
  157. }
  158. var node = {
  159. type: "LocalNameMetadata",
  160. value: value,
  161. localIndex: localIndex,
  162. functionIndex: functionIndex
  163. };
  164. return node;
  165. }
  166. function binaryModule(id, blob) {
  167. if (id !== null && id !== undefined) {
  168. if (!(typeof id === "string")) {
  169. throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));
  170. }
  171. }
  172. if (!(_typeof(blob) === "object" && typeof blob.length !== "undefined")) {
  173. throw new Error('typeof blob === "object" && typeof blob.length !== "undefined"' + " error: " + (undefined || "unknown"));
  174. }
  175. var node = {
  176. type: "BinaryModule",
  177. id: id,
  178. blob: blob
  179. };
  180. return node;
  181. }
  182. function quoteModule(id, string) {
  183. if (id !== null && id !== undefined) {
  184. if (!(typeof id === "string")) {
  185. throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));
  186. }
  187. }
  188. if (!(_typeof(string) === "object" && typeof string.length !== "undefined")) {
  189. throw new Error('typeof string === "object" && typeof string.length !== "undefined"' + " error: " + (undefined || "unknown"));
  190. }
  191. var node = {
  192. type: "QuoteModule",
  193. id: id,
  194. string: string
  195. };
  196. return node;
  197. }
  198. function sectionMetadata(section, startOffset, size, vectorOfSize) {
  199. if (!(typeof startOffset === "number")) {
  200. throw new Error('typeof startOffset === "number"' + " error: " + ("Argument startOffset must be of type number, given: " + _typeof(startOffset) || "unknown"));
  201. }
  202. var node = {
  203. type: "SectionMetadata",
  204. section: section,
  205. startOffset: startOffset,
  206. size: size,
  207. vectorOfSize: vectorOfSize
  208. };
  209. return node;
  210. }
  211. function producersSectionMetadata(producers) {
  212. if (!(_typeof(producers) === "object" && typeof producers.length !== "undefined")) {
  213. throw new Error('typeof producers === "object" && typeof producers.length !== "undefined"' + " error: " + (undefined || "unknown"));
  214. }
  215. var node = {
  216. type: "ProducersSectionMetadata",
  217. producers: producers
  218. };
  219. return node;
  220. }
  221. function producerMetadata(language, processedBy, sdk) {
  222. if (!(_typeof(language) === "object" && typeof language.length !== "undefined")) {
  223. throw new Error('typeof language === "object" && typeof language.length !== "undefined"' + " error: " + (undefined || "unknown"));
  224. }
  225. if (!(_typeof(processedBy) === "object" && typeof processedBy.length !== "undefined")) {
  226. throw new Error('typeof processedBy === "object" && typeof processedBy.length !== "undefined"' + " error: " + (undefined || "unknown"));
  227. }
  228. if (!(_typeof(sdk) === "object" && typeof sdk.length !== "undefined")) {
  229. throw new Error('typeof sdk === "object" && typeof sdk.length !== "undefined"' + " error: " + (undefined || "unknown"));
  230. }
  231. var node = {
  232. type: "ProducerMetadata",
  233. language: language,
  234. processedBy: processedBy,
  235. sdk: sdk
  236. };
  237. return node;
  238. }
  239. function producerMetadataVersionedName(name, version) {
  240. if (!(typeof name === "string")) {
  241. throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown"));
  242. }
  243. if (!(typeof version === "string")) {
  244. throw new Error('typeof version === "string"' + " error: " + ("Argument version must be of type string, given: " + _typeof(version) || "unknown"));
  245. }
  246. var node = {
  247. type: "ProducerMetadataVersionedName",
  248. name: name,
  249. version: version
  250. };
  251. return node;
  252. }
  253. function loopInstruction(label, resulttype, instr) {
  254. if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
  255. throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
  256. }
  257. var node = {
  258. type: "LoopInstruction",
  259. id: "loop",
  260. label: label,
  261. resulttype: resulttype,
  262. instr: instr
  263. };
  264. return node;
  265. }
  266. function instr(id, object, args, namedArgs) {
  267. if (!(typeof id === "string")) {
  268. throw new Error('typeof id === "string"' + " error: " + ("Argument id must be of type string, given: " + _typeof(id) || "unknown"));
  269. }
  270. if (!(_typeof(args) === "object" && typeof args.length !== "undefined")) {
  271. throw new Error('typeof args === "object" && typeof args.length !== "undefined"' + " error: " + (undefined || "unknown"));
  272. }
  273. var node = {
  274. type: "Instr",
  275. id: id,
  276. args: args
  277. };
  278. if (typeof object !== "undefined") {
  279. node.object = object;
  280. }
  281. if (typeof namedArgs !== "undefined" && Object.keys(namedArgs).length !== 0) {
  282. node.namedArgs = namedArgs;
  283. }
  284. return node;
  285. }
  286. function ifInstruction(testLabel, test, result, consequent, alternate) {
  287. if (!(_typeof(test) === "object" && typeof test.length !== "undefined")) {
  288. throw new Error('typeof test === "object" && typeof test.length !== "undefined"' + " error: " + (undefined || "unknown"));
  289. }
  290. if (!(_typeof(consequent) === "object" && typeof consequent.length !== "undefined")) {
  291. throw new Error('typeof consequent === "object" && typeof consequent.length !== "undefined"' + " error: " + (undefined || "unknown"));
  292. }
  293. if (!(_typeof(alternate) === "object" && typeof alternate.length !== "undefined")) {
  294. throw new Error('typeof alternate === "object" && typeof alternate.length !== "undefined"' + " error: " + (undefined || "unknown"));
  295. }
  296. var node = {
  297. type: "IfInstruction",
  298. id: "if",
  299. testLabel: testLabel,
  300. test: test,
  301. result: result,
  302. consequent: consequent,
  303. alternate: alternate
  304. };
  305. return node;
  306. }
  307. function stringLiteral(value) {
  308. if (!(typeof value === "string")) {
  309. throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
  310. }
  311. var node = {
  312. type: "StringLiteral",
  313. value: value
  314. };
  315. return node;
  316. }
  317. function numberLiteral(value, raw) {
  318. if (!(typeof value === "number")) {
  319. throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || "unknown"));
  320. }
  321. if (!(typeof raw === "string")) {
  322. throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));
  323. }
  324. var node = {
  325. type: "NumberLiteral",
  326. value: value,
  327. raw: raw
  328. };
  329. return node;
  330. }
  331. function longNumberLiteral(value, raw) {
  332. if (!(typeof raw === "string")) {
  333. throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));
  334. }
  335. var node = {
  336. type: "LongNumberLiteral",
  337. value: value,
  338. raw: raw
  339. };
  340. return node;
  341. }
  342. function floatLiteral(value, nan, inf, raw) {
  343. if (!(typeof value === "number")) {
  344. throw new Error('typeof value === "number"' + " error: " + ("Argument value must be of type number, given: " + _typeof(value) || "unknown"));
  345. }
  346. if (nan !== null && nan !== undefined) {
  347. if (!(typeof nan === "boolean")) {
  348. throw new Error('typeof nan === "boolean"' + " error: " + ("Argument nan must be of type boolean, given: " + _typeof(nan) || "unknown"));
  349. }
  350. }
  351. if (inf !== null && inf !== undefined) {
  352. if (!(typeof inf === "boolean")) {
  353. throw new Error('typeof inf === "boolean"' + " error: " + ("Argument inf must be of type boolean, given: " + _typeof(inf) || "unknown"));
  354. }
  355. }
  356. if (!(typeof raw === "string")) {
  357. throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));
  358. }
  359. var node = {
  360. type: "FloatLiteral",
  361. value: value,
  362. raw: raw
  363. };
  364. if (nan === true) {
  365. node.nan = true;
  366. }
  367. if (inf === true) {
  368. node.inf = true;
  369. }
  370. return node;
  371. }
  372. function elem(table, offset, funcs) {
  373. if (!(_typeof(offset) === "object" && typeof offset.length !== "undefined")) {
  374. throw new Error('typeof offset === "object" && typeof offset.length !== "undefined"' + " error: " + (undefined || "unknown"));
  375. }
  376. if (!(_typeof(funcs) === "object" && typeof funcs.length !== "undefined")) {
  377. throw new Error('typeof funcs === "object" && typeof funcs.length !== "undefined"' + " error: " + (undefined || "unknown"));
  378. }
  379. var node = {
  380. type: "Elem",
  381. table: table,
  382. offset: offset,
  383. funcs: funcs
  384. };
  385. return node;
  386. }
  387. function indexInFuncSection(index) {
  388. var node = {
  389. type: "IndexInFuncSection",
  390. index: index
  391. };
  392. return node;
  393. }
  394. function valtypeLiteral(name) {
  395. var node = {
  396. type: "ValtypeLiteral",
  397. name: name
  398. };
  399. return node;
  400. }
  401. function typeInstruction(id, functype) {
  402. var node = {
  403. type: "TypeInstruction",
  404. id: id,
  405. functype: functype
  406. };
  407. return node;
  408. }
  409. function start(index) {
  410. var node = {
  411. type: "Start",
  412. index: index
  413. };
  414. return node;
  415. }
  416. function globalType(valtype, mutability) {
  417. var node = {
  418. type: "GlobalType",
  419. valtype: valtype,
  420. mutability: mutability
  421. };
  422. return node;
  423. }
  424. function leadingComment(value) {
  425. if (!(typeof value === "string")) {
  426. throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
  427. }
  428. var node = {
  429. type: "LeadingComment",
  430. value: value
  431. };
  432. return node;
  433. }
  434. function blockComment(value) {
  435. if (!(typeof value === "string")) {
  436. throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
  437. }
  438. var node = {
  439. type: "BlockComment",
  440. value: value
  441. };
  442. return node;
  443. }
  444. function data(memoryIndex, offset, init) {
  445. var node = {
  446. type: "Data",
  447. memoryIndex: memoryIndex,
  448. offset: offset,
  449. init: init
  450. };
  451. return node;
  452. }
  453. function global(globalType, init, name) {
  454. if (!(_typeof(init) === "object" && typeof init.length !== "undefined")) {
  455. throw new Error('typeof init === "object" && typeof init.length !== "undefined"' + " error: " + (undefined || "unknown"));
  456. }
  457. var node = {
  458. type: "Global",
  459. globalType: globalType,
  460. init: init,
  461. name: name
  462. };
  463. return node;
  464. }
  465. function table(elementType, limits, name, elements) {
  466. if (!(limits.type === "Limit")) {
  467. throw new Error('limits.type === "Limit"' + " error: " + ("Argument limits must be of type Limit, given: " + limits.type || "unknown"));
  468. }
  469. if (elements !== null && elements !== undefined) {
  470. if (!(_typeof(elements) === "object" && typeof elements.length !== "undefined")) {
  471. throw new Error('typeof elements === "object" && typeof elements.length !== "undefined"' + " error: " + (undefined || "unknown"));
  472. }
  473. }
  474. var node = {
  475. type: "Table",
  476. elementType: elementType,
  477. limits: limits,
  478. name: name
  479. };
  480. if (typeof elements !== "undefined" && elements.length > 0) {
  481. node.elements = elements;
  482. }
  483. return node;
  484. }
  485. function memory(limits, id) {
  486. var node = {
  487. type: "Memory",
  488. limits: limits,
  489. id: id
  490. };
  491. return node;
  492. }
  493. function funcImportDescr(id, signature) {
  494. var node = {
  495. type: "FuncImportDescr",
  496. id: id,
  497. signature: signature
  498. };
  499. return node;
  500. }
  501. function moduleImport(module, name, descr) {
  502. if (!(typeof module === "string")) {
  503. throw new Error('typeof module === "string"' + " error: " + ("Argument module must be of type string, given: " + _typeof(module) || "unknown"));
  504. }
  505. if (!(typeof name === "string")) {
  506. throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown"));
  507. }
  508. var node = {
  509. type: "ModuleImport",
  510. module: module,
  511. name: name,
  512. descr: descr
  513. };
  514. return node;
  515. }
  516. function moduleExportDescr(exportType, id) {
  517. var node = {
  518. type: "ModuleExportDescr",
  519. exportType: exportType,
  520. id: id
  521. };
  522. return node;
  523. }
  524. function moduleExport(name, descr) {
  525. if (!(typeof name === "string")) {
  526. throw new Error('typeof name === "string"' + " error: " + ("Argument name must be of type string, given: " + _typeof(name) || "unknown"));
  527. }
  528. var node = {
  529. type: "ModuleExport",
  530. name: name,
  531. descr: descr
  532. };
  533. return node;
  534. }
  535. function limit(min, max, shared) {
  536. if (!(typeof min === "number")) {
  537. throw new Error('typeof min === "number"' + " error: " + ("Argument min must be of type number, given: " + _typeof(min) || "unknown"));
  538. }
  539. if (max !== null && max !== undefined) {
  540. if (!(typeof max === "number")) {
  541. throw new Error('typeof max === "number"' + " error: " + ("Argument max must be of type number, given: " + _typeof(max) || "unknown"));
  542. }
  543. }
  544. if (shared !== null && shared !== undefined) {
  545. if (!(typeof shared === "boolean")) {
  546. throw new Error('typeof shared === "boolean"' + " error: " + ("Argument shared must be of type boolean, given: " + _typeof(shared) || "unknown"));
  547. }
  548. }
  549. var node = {
  550. type: "Limit",
  551. min: min
  552. };
  553. if (typeof max !== "undefined") {
  554. node.max = max;
  555. }
  556. if (shared === true) {
  557. node.shared = true;
  558. }
  559. return node;
  560. }
  561. function signature(params, results) {
  562. if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) {
  563. throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown"));
  564. }
  565. if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) {
  566. throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown"));
  567. }
  568. var node = {
  569. type: "Signature",
  570. params: params,
  571. results: results
  572. };
  573. return node;
  574. }
  575. function program(body) {
  576. if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
  577. throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
  578. }
  579. var node = {
  580. type: "Program",
  581. body: body
  582. };
  583. return node;
  584. }
  585. function identifier(value, raw) {
  586. if (!(typeof value === "string")) {
  587. throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
  588. }
  589. if (raw !== null && raw !== undefined) {
  590. if (!(typeof raw === "string")) {
  591. throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));
  592. }
  593. }
  594. var node = {
  595. type: "Identifier",
  596. value: value
  597. };
  598. if (typeof raw !== "undefined") {
  599. node.raw = raw;
  600. }
  601. return node;
  602. }
  603. function blockInstruction(label, instr, result) {
  604. if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
  605. throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
  606. }
  607. var node = {
  608. type: "BlockInstruction",
  609. id: "block",
  610. label: label,
  611. instr: instr,
  612. result: result
  613. };
  614. return node;
  615. }
  616. function callInstruction(index, instrArgs, numeric) {
  617. if (instrArgs !== null && instrArgs !== undefined) {
  618. if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) {
  619. throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown"));
  620. }
  621. }
  622. var node = {
  623. type: "CallInstruction",
  624. id: "call",
  625. index: index
  626. };
  627. if (typeof instrArgs !== "undefined" && instrArgs.length > 0) {
  628. node.instrArgs = instrArgs;
  629. }
  630. if (typeof numeric !== "undefined") {
  631. node.numeric = numeric;
  632. }
  633. return node;
  634. }
  635. function callIndirectInstruction(signature, intrs) {
  636. if (intrs !== null && intrs !== undefined) {
  637. if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) {
  638. throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown"));
  639. }
  640. }
  641. var node = {
  642. type: "CallIndirectInstruction",
  643. id: "call_indirect",
  644. signature: signature
  645. };
  646. if (typeof intrs !== "undefined" && intrs.length > 0) {
  647. node.intrs = intrs;
  648. }
  649. return node;
  650. }
  651. function byteArray(values) {
  652. if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) {
  653. throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown"));
  654. }
  655. var node = {
  656. type: "ByteArray",
  657. values: values
  658. };
  659. return node;
  660. }
  661. function func(name, signature, body, isExternal, metadata) {
  662. if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
  663. throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
  664. }
  665. if (isExternal !== null && isExternal !== undefined) {
  666. if (!(typeof isExternal === "boolean")) {
  667. throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || "unknown"));
  668. }
  669. }
  670. var node = {
  671. type: "Func",
  672. name: name,
  673. signature: signature,
  674. body: body
  675. };
  676. if (isExternal === true) {
  677. node.isExternal = true;
  678. }
  679. if (typeof metadata !== "undefined") {
  680. node.metadata = metadata;
  681. }
  682. return node;
  683. }
  684. function internalBrUnless(target) {
  685. if (!(typeof target === "number")) {
  686. throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));
  687. }
  688. var node = {
  689. type: "InternalBrUnless",
  690. target: target
  691. };
  692. return node;
  693. }
  694. function internalGoto(target) {
  695. if (!(typeof target === "number")) {
  696. throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));
  697. }
  698. var node = {
  699. type: "InternalGoto",
  700. target: target
  701. };
  702. return node;
  703. }
  704. function internalCallExtern(target) {
  705. if (!(typeof target === "number")) {
  706. throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));
  707. }
  708. var node = {
  709. type: "InternalCallExtern",
  710. target: target
  711. };
  712. return node;
  713. }
  714. function internalEndAndReturn() {
  715. var node = {
  716. type: "InternalEndAndReturn"
  717. };
  718. return node;
  719. }
  720. var isModule = isTypeOf("Module");
  721. exports.isModule = isModule;
  722. var isModuleMetadata = isTypeOf("ModuleMetadata");
  723. exports.isModuleMetadata = isModuleMetadata;
  724. var isModuleNameMetadata = isTypeOf("ModuleNameMetadata");
  725. exports.isModuleNameMetadata = isModuleNameMetadata;
  726. var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata");
  727. exports.isFunctionNameMetadata = isFunctionNameMetadata;
  728. var isLocalNameMetadata = isTypeOf("LocalNameMetadata");
  729. exports.isLocalNameMetadata = isLocalNameMetadata;
  730. var isBinaryModule = isTypeOf("BinaryModule");
  731. exports.isBinaryModule = isBinaryModule;
  732. var isQuoteModule = isTypeOf("QuoteModule");
  733. exports.isQuoteModule = isQuoteModule;
  734. var isSectionMetadata = isTypeOf("SectionMetadata");
  735. exports.isSectionMetadata = isSectionMetadata;
  736. var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata");
  737. exports.isProducersSectionMetadata = isProducersSectionMetadata;
  738. var isProducerMetadata = isTypeOf("ProducerMetadata");
  739. exports.isProducerMetadata = isProducerMetadata;
  740. var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName");
  741. exports.isProducerMetadataVersionedName = isProducerMetadataVersionedName;
  742. var isLoopInstruction = isTypeOf("LoopInstruction");
  743. exports.isLoopInstruction = isLoopInstruction;
  744. var isInstr = isTypeOf("Instr");
  745. exports.isInstr = isInstr;
  746. var isIfInstruction = isTypeOf("IfInstruction");
  747. exports.isIfInstruction = isIfInstruction;
  748. var isStringLiteral = isTypeOf("StringLiteral");
  749. exports.isStringLiteral = isStringLiteral;
  750. var isNumberLiteral = isTypeOf("NumberLiteral");
  751. exports.isNumberLiteral = isNumberLiteral;
  752. var isLongNumberLiteral = isTypeOf("LongNumberLiteral");
  753. exports.isLongNumberLiteral = isLongNumberLiteral;
  754. var isFloatLiteral = isTypeOf("FloatLiteral");
  755. exports.isFloatLiteral = isFloatLiteral;
  756. var isElem = isTypeOf("Elem");
  757. exports.isElem = isElem;
  758. var isIndexInFuncSection = isTypeOf("IndexInFuncSection");
  759. exports.isIndexInFuncSection = isIndexInFuncSection;
  760. var isValtypeLiteral = isTypeOf("ValtypeLiteral");
  761. exports.isValtypeLiteral = isValtypeLiteral;
  762. var isTypeInstruction = isTypeOf("TypeInstruction");
  763. exports.isTypeInstruction = isTypeInstruction;
  764. var isStart = isTypeOf("Start");
  765. exports.isStart = isStart;
  766. var isGlobalType = isTypeOf("GlobalType");
  767. exports.isGlobalType = isGlobalType;
  768. var isLeadingComment = isTypeOf("LeadingComment");
  769. exports.isLeadingComment = isLeadingComment;
  770. var isBlockComment = isTypeOf("BlockComment");
  771. exports.isBlockComment = isBlockComment;
  772. var isData = isTypeOf("Data");
  773. exports.isData = isData;
  774. var isGlobal = isTypeOf("Global");
  775. exports.isGlobal = isGlobal;
  776. var isTable = isTypeOf("Table");
  777. exports.isTable = isTable;
  778. var isMemory = isTypeOf("Memory");
  779. exports.isMemory = isMemory;
  780. var isFuncImportDescr = isTypeOf("FuncImportDescr");
  781. exports.isFuncImportDescr = isFuncImportDescr;
  782. var isModuleImport = isTypeOf("ModuleImport");
  783. exports.isModuleImport = isModuleImport;
  784. var isModuleExportDescr = isTypeOf("ModuleExportDescr");
  785. exports.isModuleExportDescr = isModuleExportDescr;
  786. var isModuleExport = isTypeOf("ModuleExport");
  787. exports.isModuleExport = isModuleExport;
  788. var isLimit = isTypeOf("Limit");
  789. exports.isLimit = isLimit;
  790. var isSignature = isTypeOf("Signature");
  791. exports.isSignature = isSignature;
  792. var isProgram = isTypeOf("Program");
  793. exports.isProgram = isProgram;
  794. var isIdentifier = isTypeOf("Identifier");
  795. exports.isIdentifier = isIdentifier;
  796. var isBlockInstruction = isTypeOf("BlockInstruction");
  797. exports.isBlockInstruction = isBlockInstruction;
  798. var isCallInstruction = isTypeOf("CallInstruction");
  799. exports.isCallInstruction = isCallInstruction;
  800. var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction");
  801. exports.isCallIndirectInstruction = isCallIndirectInstruction;
  802. var isByteArray = isTypeOf("ByteArray");
  803. exports.isByteArray = isByteArray;
  804. var isFunc = isTypeOf("Func");
  805. exports.isFunc = isFunc;
  806. var isInternalBrUnless = isTypeOf("InternalBrUnless");
  807. exports.isInternalBrUnless = isInternalBrUnless;
  808. var isInternalGoto = isTypeOf("InternalGoto");
  809. exports.isInternalGoto = isInternalGoto;
  810. var isInternalCallExtern = isTypeOf("InternalCallExtern");
  811. exports.isInternalCallExtern = isInternalCallExtern;
  812. var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn");
  813. exports.isInternalEndAndReturn = isInternalEndAndReturn;
  814. var isNode = function isNode(node) {
  815. return isModule(node) || isModuleMetadata(node) || isModuleNameMetadata(node) || isFunctionNameMetadata(node) || isLocalNameMetadata(node) || isBinaryModule(node) || isQuoteModule(node) || isSectionMetadata(node) || isProducersSectionMetadata(node) || isProducerMetadata(node) || isProducerMetadataVersionedName(node) || isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isElem(node) || isIndexInFuncSection(node) || isValtypeLiteral(node) || isTypeInstruction(node) || isStart(node) || isGlobalType(node) || isLeadingComment(node) || isBlockComment(node) || isData(node) || isGlobal(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node) || isModuleImport(node) || isModuleExportDescr(node) || isModuleExport(node) || isLimit(node) || isSignature(node) || isProgram(node) || isIdentifier(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node) || isByteArray(node) || isFunc(node) || isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
  816. };
  817. exports.isNode = isNode;
  818. var isBlock = function isBlock(node) {
  819. return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node);
  820. };
  821. exports.isBlock = isBlock;
  822. var isInstruction = function isInstruction(node) {
  823. return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node);
  824. };
  825. exports.isInstruction = isInstruction;
  826. var isExpression = function isExpression(node) {
  827. return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node);
  828. };
  829. exports.isExpression = isExpression;
  830. var isNumericLiteral = function isNumericLiteral(node) {
  831. return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node);
  832. };
  833. exports.isNumericLiteral = isNumericLiteral;
  834. var isImportDescr = function isImportDescr(node) {
  835. return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node);
  836. };
  837. exports.isImportDescr = isImportDescr;
  838. var isIntrinsic = function isIntrinsic(node) {
  839. return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
  840. };
  841. exports.isIntrinsic = isIntrinsic;
  842. var assertModule = assertTypeOf("Module");
  843. exports.assertModule = assertModule;
  844. var assertModuleMetadata = assertTypeOf("ModuleMetadata");
  845. exports.assertModuleMetadata = assertModuleMetadata;
  846. var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata");
  847. exports.assertModuleNameMetadata = assertModuleNameMetadata;
  848. var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata");
  849. exports.assertFunctionNameMetadata = assertFunctionNameMetadata;
  850. var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata");
  851. exports.assertLocalNameMetadata = assertLocalNameMetadata;
  852. var assertBinaryModule = assertTypeOf("BinaryModule");
  853. exports.assertBinaryModule = assertBinaryModule;
  854. var assertQuoteModule = assertTypeOf("QuoteModule");
  855. exports.assertQuoteModule = assertQuoteModule;
  856. var assertSectionMetadata = assertTypeOf("SectionMetadata");
  857. exports.assertSectionMetadata = assertSectionMetadata;
  858. var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata");
  859. exports.assertProducersSectionMetadata = assertProducersSectionMetadata;
  860. var assertProducerMetadata = assertTypeOf("ProducerMetadata");
  861. exports.assertProducerMetadata = assertProducerMetadata;
  862. var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName");
  863. exports.assertProducerMetadataVersionedName = assertProducerMetadataVersionedName;
  864. var assertLoopInstruction = assertTypeOf("LoopInstruction");
  865. exports.assertLoopInstruction = assertLoopInstruction;
  866. var assertInstr = assertTypeOf("Instr");
  867. exports.assertInstr = assertInstr;
  868. var assertIfInstruction = assertTypeOf("IfInstruction");
  869. exports.assertIfInstruction = assertIfInstruction;
  870. var assertStringLiteral = assertTypeOf("StringLiteral");
  871. exports.assertStringLiteral = assertStringLiteral;
  872. var assertNumberLiteral = assertTypeOf("NumberLiteral");
  873. exports.assertNumberLiteral = assertNumberLiteral;
  874. var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral");
  875. exports.assertLongNumberLiteral = assertLongNumberLiteral;
  876. var assertFloatLiteral = assertTypeOf("FloatLiteral");
  877. exports.assertFloatLiteral = assertFloatLiteral;
  878. var assertElem = assertTypeOf("Elem");
  879. exports.assertElem = assertElem;
  880. var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection");
  881. exports.assertIndexInFuncSection = assertIndexInFuncSection;
  882. var assertValtypeLiteral = assertTypeOf("ValtypeLiteral");
  883. exports.assertValtypeLiteral = assertValtypeLiteral;
  884. var assertTypeInstruction = assertTypeOf("TypeInstruction");
  885. exports.assertTypeInstruction = assertTypeInstruction;
  886. var assertStart = assertTypeOf("Start");
  887. exports.assertStart = assertStart;
  888. var assertGlobalType = assertTypeOf("GlobalType");
  889. exports.assertGlobalType = assertGlobalType;
  890. var assertLeadingComment = assertTypeOf("LeadingComment");
  891. exports.assertLeadingComment = assertLeadingComment;
  892. var assertBlockComment = assertTypeOf("BlockComment");
  893. exports.assertBlockComment = assertBlockComment;
  894. var assertData = assertTypeOf("Data");
  895. exports.assertData = assertData;
  896. var assertGlobal = assertTypeOf("Global");
  897. exports.assertGlobal = assertGlobal;
  898. var assertTable = assertTypeOf("Table");
  899. exports.assertTable = assertTable;
  900. var assertMemory = assertTypeOf("Memory");
  901. exports.assertMemory = assertMemory;
  902. var assertFuncImportDescr = assertTypeOf("FuncImportDescr");
  903. exports.assertFuncImportDescr = assertFuncImportDescr;
  904. var assertModuleImport = assertTypeOf("ModuleImport");
  905. exports.assertModuleImport = assertModuleImport;
  906. var assertModuleExportDescr = assertTypeOf("ModuleExportDescr");
  907. exports.assertModuleExportDescr = assertModuleExportDescr;
  908. var assertModuleExport = assertTypeOf("ModuleExport");
  909. exports.assertModuleExport = assertModuleExport;
  910. var assertLimit = assertTypeOf("Limit");
  911. exports.assertLimit = assertLimit;
  912. var assertSignature = assertTypeOf("Signature");
  913. exports.assertSignature = assertSignature;
  914. var assertProgram = assertTypeOf("Program");
  915. exports.assertProgram = assertProgram;
  916. var assertIdentifier = assertTypeOf("Identifier");
  917. exports.assertIdentifier = assertIdentifier;
  918. var assertBlockInstruction = assertTypeOf("BlockInstruction");
  919. exports.assertBlockInstruction = assertBlockInstruction;
  920. var assertCallInstruction = assertTypeOf("CallInstruction");
  921. exports.assertCallInstruction = assertCallInstruction;
  922. var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction");
  923. exports.assertCallIndirectInstruction = assertCallIndirectInstruction;
  924. var assertByteArray = assertTypeOf("ByteArray");
  925. exports.assertByteArray = assertByteArray;
  926. var assertFunc = assertTypeOf("Func");
  927. exports.assertFunc = assertFunc;
  928. var assertInternalBrUnless = assertTypeOf("InternalBrUnless");
  929. exports.assertInternalBrUnless = assertInternalBrUnless;
  930. var assertInternalGoto = assertTypeOf("InternalGoto");
  931. exports.assertInternalGoto = assertInternalGoto;
  932. var assertInternalCallExtern = assertTypeOf("InternalCallExtern");
  933. exports.assertInternalCallExtern = assertInternalCallExtern;
  934. var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn");
  935. exports.assertInternalEndAndReturn = assertInternalEndAndReturn;
  936. var unionTypesMap = {
  937. Module: ["Node"],
  938. ModuleMetadata: ["Node"],
  939. ModuleNameMetadata: ["Node"],
  940. FunctionNameMetadata: ["Node"],
  941. LocalNameMetadata: ["Node"],
  942. BinaryModule: ["Node"],
  943. QuoteModule: ["Node"],
  944. SectionMetadata: ["Node"],
  945. ProducersSectionMetadata: ["Node"],
  946. ProducerMetadata: ["Node"],
  947. ProducerMetadataVersionedName: ["Node"],
  948. LoopInstruction: ["Node", "Block", "Instruction"],
  949. Instr: ["Node", "Expression", "Instruction"],
  950. IfInstruction: ["Node", "Instruction"],
  951. StringLiteral: ["Node", "Expression"],
  952. NumberLiteral: ["Node", "NumericLiteral", "Expression"],
  953. LongNumberLiteral: ["Node", "NumericLiteral", "Expression"],
  954. FloatLiteral: ["Node", "NumericLiteral", "Expression"],
  955. Elem: ["Node"],
  956. IndexInFuncSection: ["Node"],
  957. ValtypeLiteral: ["Node", "Expression"],
  958. TypeInstruction: ["Node", "Instruction"],
  959. Start: ["Node"],
  960. GlobalType: ["Node", "ImportDescr"],
  961. LeadingComment: ["Node"],
  962. BlockComment: ["Node"],
  963. Data: ["Node"],
  964. Global: ["Node"],
  965. Table: ["Node", "ImportDescr"],
  966. Memory: ["Node", "ImportDescr"],
  967. FuncImportDescr: ["Node", "ImportDescr"],
  968. ModuleImport: ["Node"],
  969. ModuleExportDescr: ["Node"],
  970. ModuleExport: ["Node"],
  971. Limit: ["Node"],
  972. Signature: ["Node"],
  973. Program: ["Node"],
  974. Identifier: ["Node", "Expression"],
  975. BlockInstruction: ["Node", "Block", "Instruction"],
  976. CallInstruction: ["Node", "Instruction"],
  977. CallIndirectInstruction: ["Node", "Instruction"],
  978. ByteArray: ["Node"],
  979. Func: ["Node", "Block"],
  980. InternalBrUnless: ["Node", "Intrinsic"],
  981. InternalGoto: ["Node", "Intrinsic"],
  982. InternalCallExtern: ["Node", "Intrinsic"],
  983. InternalEndAndReturn: ["Node", "Intrinsic"]
  984. };
  985. exports.unionTypesMap = unionTypesMap;
  986. var nodeAndUnionTypes = ["Module", "ModuleMetadata", "ModuleNameMetadata", "FunctionNameMetadata", "LocalNameMetadata", "BinaryModule", "QuoteModule", "SectionMetadata", "ProducersSectionMetadata", "ProducerMetadata", "ProducerMetadataVersionedName", "LoopInstruction", "Instr", "IfInstruction", "StringLiteral", "NumberLiteral", "LongNumberLiteral", "FloatLiteral", "Elem", "IndexInFuncSection", "ValtypeLiteral", "TypeInstruction", "Start", "GlobalType", "LeadingComment", "BlockComment", "Data", "Global", "Table", "Memory", "FuncImportDescr", "ModuleImport", "ModuleExportDescr", "ModuleExport", "Limit", "Signature", "Program", "Identifier", "BlockInstruction", "CallInstruction", "CallIndirectInstruction", "ByteArray", "Func", "InternalBrUnless", "InternalGoto", "InternalCallExtern", "InternalEndAndReturn", "Node", "Block", "Instruction", "Expression", "NumericLiteral", "ImportDescr", "Intrinsic"];
  987. exports.nodeAndUnionTypes = nodeAndUnionTypes;