Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

nodes.js 41KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  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) {
  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. var node = {
  545. type: "Limit",
  546. min: min
  547. };
  548. if (typeof max !== "undefined") {
  549. node.max = max;
  550. }
  551. return node;
  552. }
  553. function signature(params, results) {
  554. if (!(_typeof(params) === "object" && typeof params.length !== "undefined")) {
  555. throw new Error('typeof params === "object" && typeof params.length !== "undefined"' + " error: " + (undefined || "unknown"));
  556. }
  557. if (!(_typeof(results) === "object" && typeof results.length !== "undefined")) {
  558. throw new Error('typeof results === "object" && typeof results.length !== "undefined"' + " error: " + (undefined || "unknown"));
  559. }
  560. var node = {
  561. type: "Signature",
  562. params: params,
  563. results: results
  564. };
  565. return node;
  566. }
  567. function program(body) {
  568. if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
  569. throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
  570. }
  571. var node = {
  572. type: "Program",
  573. body: body
  574. };
  575. return node;
  576. }
  577. function identifier(value, raw) {
  578. if (!(typeof value === "string")) {
  579. throw new Error('typeof value === "string"' + " error: " + ("Argument value must be of type string, given: " + _typeof(value) || "unknown"));
  580. }
  581. if (raw !== null && raw !== undefined) {
  582. if (!(typeof raw === "string")) {
  583. throw new Error('typeof raw === "string"' + " error: " + ("Argument raw must be of type string, given: " + _typeof(raw) || "unknown"));
  584. }
  585. }
  586. var node = {
  587. type: "Identifier",
  588. value: value
  589. };
  590. if (typeof raw !== "undefined") {
  591. node.raw = raw;
  592. }
  593. return node;
  594. }
  595. function blockInstruction(label, instr, result) {
  596. if (!(_typeof(instr) === "object" && typeof instr.length !== "undefined")) {
  597. throw new Error('typeof instr === "object" && typeof instr.length !== "undefined"' + " error: " + (undefined || "unknown"));
  598. }
  599. var node = {
  600. type: "BlockInstruction",
  601. id: "block",
  602. label: label,
  603. instr: instr,
  604. result: result
  605. };
  606. return node;
  607. }
  608. function callInstruction(index, instrArgs, numeric) {
  609. if (instrArgs !== null && instrArgs !== undefined) {
  610. if (!(_typeof(instrArgs) === "object" && typeof instrArgs.length !== "undefined")) {
  611. throw new Error('typeof instrArgs === "object" && typeof instrArgs.length !== "undefined"' + " error: " + (undefined || "unknown"));
  612. }
  613. }
  614. var node = {
  615. type: "CallInstruction",
  616. id: "call",
  617. index: index
  618. };
  619. if (typeof instrArgs !== "undefined" && instrArgs.length > 0) {
  620. node.instrArgs = instrArgs;
  621. }
  622. if (typeof numeric !== "undefined") {
  623. node.numeric = numeric;
  624. }
  625. return node;
  626. }
  627. function callIndirectInstruction(signature, intrs) {
  628. if (intrs !== null && intrs !== undefined) {
  629. if (!(_typeof(intrs) === "object" && typeof intrs.length !== "undefined")) {
  630. throw new Error('typeof intrs === "object" && typeof intrs.length !== "undefined"' + " error: " + (undefined || "unknown"));
  631. }
  632. }
  633. var node = {
  634. type: "CallIndirectInstruction",
  635. id: "call_indirect",
  636. signature: signature
  637. };
  638. if (typeof intrs !== "undefined" && intrs.length > 0) {
  639. node.intrs = intrs;
  640. }
  641. return node;
  642. }
  643. function byteArray(values) {
  644. if (!(_typeof(values) === "object" && typeof values.length !== "undefined")) {
  645. throw new Error('typeof values === "object" && typeof values.length !== "undefined"' + " error: " + (undefined || "unknown"));
  646. }
  647. var node = {
  648. type: "ByteArray",
  649. values: values
  650. };
  651. return node;
  652. }
  653. function func(name, signature, body, isExternal, metadata) {
  654. if (!(_typeof(body) === "object" && typeof body.length !== "undefined")) {
  655. throw new Error('typeof body === "object" && typeof body.length !== "undefined"' + " error: " + (undefined || "unknown"));
  656. }
  657. if (isExternal !== null && isExternal !== undefined) {
  658. if (!(typeof isExternal === "boolean")) {
  659. throw new Error('typeof isExternal === "boolean"' + " error: " + ("Argument isExternal must be of type boolean, given: " + _typeof(isExternal) || "unknown"));
  660. }
  661. }
  662. var node = {
  663. type: "Func",
  664. name: name,
  665. signature: signature,
  666. body: body
  667. };
  668. if (isExternal === true) {
  669. node.isExternal = true;
  670. }
  671. if (typeof metadata !== "undefined") {
  672. node.metadata = metadata;
  673. }
  674. return node;
  675. }
  676. function internalBrUnless(target) {
  677. if (!(typeof target === "number")) {
  678. throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));
  679. }
  680. var node = {
  681. type: "InternalBrUnless",
  682. target: target
  683. };
  684. return node;
  685. }
  686. function internalGoto(target) {
  687. if (!(typeof target === "number")) {
  688. throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));
  689. }
  690. var node = {
  691. type: "InternalGoto",
  692. target: target
  693. };
  694. return node;
  695. }
  696. function internalCallExtern(target) {
  697. if (!(typeof target === "number")) {
  698. throw new Error('typeof target === "number"' + " error: " + ("Argument target must be of type number, given: " + _typeof(target) || "unknown"));
  699. }
  700. var node = {
  701. type: "InternalCallExtern",
  702. target: target
  703. };
  704. return node;
  705. }
  706. function internalEndAndReturn() {
  707. var node = {
  708. type: "InternalEndAndReturn"
  709. };
  710. return node;
  711. }
  712. var isModule = isTypeOf("Module");
  713. exports.isModule = isModule;
  714. var isModuleMetadata = isTypeOf("ModuleMetadata");
  715. exports.isModuleMetadata = isModuleMetadata;
  716. var isModuleNameMetadata = isTypeOf("ModuleNameMetadata");
  717. exports.isModuleNameMetadata = isModuleNameMetadata;
  718. var isFunctionNameMetadata = isTypeOf("FunctionNameMetadata");
  719. exports.isFunctionNameMetadata = isFunctionNameMetadata;
  720. var isLocalNameMetadata = isTypeOf("LocalNameMetadata");
  721. exports.isLocalNameMetadata = isLocalNameMetadata;
  722. var isBinaryModule = isTypeOf("BinaryModule");
  723. exports.isBinaryModule = isBinaryModule;
  724. var isQuoteModule = isTypeOf("QuoteModule");
  725. exports.isQuoteModule = isQuoteModule;
  726. var isSectionMetadata = isTypeOf("SectionMetadata");
  727. exports.isSectionMetadata = isSectionMetadata;
  728. var isProducersSectionMetadata = isTypeOf("ProducersSectionMetadata");
  729. exports.isProducersSectionMetadata = isProducersSectionMetadata;
  730. var isProducerMetadata = isTypeOf("ProducerMetadata");
  731. exports.isProducerMetadata = isProducerMetadata;
  732. var isProducerMetadataVersionedName = isTypeOf("ProducerMetadataVersionedName");
  733. exports.isProducerMetadataVersionedName = isProducerMetadataVersionedName;
  734. var isLoopInstruction = isTypeOf("LoopInstruction");
  735. exports.isLoopInstruction = isLoopInstruction;
  736. var isInstr = isTypeOf("Instr");
  737. exports.isInstr = isInstr;
  738. var isIfInstruction = isTypeOf("IfInstruction");
  739. exports.isIfInstruction = isIfInstruction;
  740. var isStringLiteral = isTypeOf("StringLiteral");
  741. exports.isStringLiteral = isStringLiteral;
  742. var isNumberLiteral = isTypeOf("NumberLiteral");
  743. exports.isNumberLiteral = isNumberLiteral;
  744. var isLongNumberLiteral = isTypeOf("LongNumberLiteral");
  745. exports.isLongNumberLiteral = isLongNumberLiteral;
  746. var isFloatLiteral = isTypeOf("FloatLiteral");
  747. exports.isFloatLiteral = isFloatLiteral;
  748. var isElem = isTypeOf("Elem");
  749. exports.isElem = isElem;
  750. var isIndexInFuncSection = isTypeOf("IndexInFuncSection");
  751. exports.isIndexInFuncSection = isIndexInFuncSection;
  752. var isValtypeLiteral = isTypeOf("ValtypeLiteral");
  753. exports.isValtypeLiteral = isValtypeLiteral;
  754. var isTypeInstruction = isTypeOf("TypeInstruction");
  755. exports.isTypeInstruction = isTypeInstruction;
  756. var isStart = isTypeOf("Start");
  757. exports.isStart = isStart;
  758. var isGlobalType = isTypeOf("GlobalType");
  759. exports.isGlobalType = isGlobalType;
  760. var isLeadingComment = isTypeOf("LeadingComment");
  761. exports.isLeadingComment = isLeadingComment;
  762. var isBlockComment = isTypeOf("BlockComment");
  763. exports.isBlockComment = isBlockComment;
  764. var isData = isTypeOf("Data");
  765. exports.isData = isData;
  766. var isGlobal = isTypeOf("Global");
  767. exports.isGlobal = isGlobal;
  768. var isTable = isTypeOf("Table");
  769. exports.isTable = isTable;
  770. var isMemory = isTypeOf("Memory");
  771. exports.isMemory = isMemory;
  772. var isFuncImportDescr = isTypeOf("FuncImportDescr");
  773. exports.isFuncImportDescr = isFuncImportDescr;
  774. var isModuleImport = isTypeOf("ModuleImport");
  775. exports.isModuleImport = isModuleImport;
  776. var isModuleExportDescr = isTypeOf("ModuleExportDescr");
  777. exports.isModuleExportDescr = isModuleExportDescr;
  778. var isModuleExport = isTypeOf("ModuleExport");
  779. exports.isModuleExport = isModuleExport;
  780. var isLimit = isTypeOf("Limit");
  781. exports.isLimit = isLimit;
  782. var isSignature = isTypeOf("Signature");
  783. exports.isSignature = isSignature;
  784. var isProgram = isTypeOf("Program");
  785. exports.isProgram = isProgram;
  786. var isIdentifier = isTypeOf("Identifier");
  787. exports.isIdentifier = isIdentifier;
  788. var isBlockInstruction = isTypeOf("BlockInstruction");
  789. exports.isBlockInstruction = isBlockInstruction;
  790. var isCallInstruction = isTypeOf("CallInstruction");
  791. exports.isCallInstruction = isCallInstruction;
  792. var isCallIndirectInstruction = isTypeOf("CallIndirectInstruction");
  793. exports.isCallIndirectInstruction = isCallIndirectInstruction;
  794. var isByteArray = isTypeOf("ByteArray");
  795. exports.isByteArray = isByteArray;
  796. var isFunc = isTypeOf("Func");
  797. exports.isFunc = isFunc;
  798. var isInternalBrUnless = isTypeOf("InternalBrUnless");
  799. exports.isInternalBrUnless = isInternalBrUnless;
  800. var isInternalGoto = isTypeOf("InternalGoto");
  801. exports.isInternalGoto = isInternalGoto;
  802. var isInternalCallExtern = isTypeOf("InternalCallExtern");
  803. exports.isInternalCallExtern = isInternalCallExtern;
  804. var isInternalEndAndReturn = isTypeOf("InternalEndAndReturn");
  805. exports.isInternalEndAndReturn = isInternalEndAndReturn;
  806. var isNode = function isNode(node) {
  807. 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);
  808. };
  809. exports.isNode = isNode;
  810. var isBlock = function isBlock(node) {
  811. return isLoopInstruction(node) || isBlockInstruction(node) || isFunc(node);
  812. };
  813. exports.isBlock = isBlock;
  814. var isInstruction = function isInstruction(node) {
  815. return isLoopInstruction(node) || isInstr(node) || isIfInstruction(node) || isTypeInstruction(node) || isBlockInstruction(node) || isCallInstruction(node) || isCallIndirectInstruction(node);
  816. };
  817. exports.isInstruction = isInstruction;
  818. var isExpression = function isExpression(node) {
  819. return isInstr(node) || isStringLiteral(node) || isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node) || isValtypeLiteral(node) || isIdentifier(node);
  820. };
  821. exports.isExpression = isExpression;
  822. var isNumericLiteral = function isNumericLiteral(node) {
  823. return isNumberLiteral(node) || isLongNumberLiteral(node) || isFloatLiteral(node);
  824. };
  825. exports.isNumericLiteral = isNumericLiteral;
  826. var isImportDescr = function isImportDescr(node) {
  827. return isGlobalType(node) || isTable(node) || isMemory(node) || isFuncImportDescr(node);
  828. };
  829. exports.isImportDescr = isImportDescr;
  830. var isIntrinsic = function isIntrinsic(node) {
  831. return isInternalBrUnless(node) || isInternalGoto(node) || isInternalCallExtern(node) || isInternalEndAndReturn(node);
  832. };
  833. exports.isIntrinsic = isIntrinsic;
  834. var assertModule = assertTypeOf("Module");
  835. exports.assertModule = assertModule;
  836. var assertModuleMetadata = assertTypeOf("ModuleMetadata");
  837. exports.assertModuleMetadata = assertModuleMetadata;
  838. var assertModuleNameMetadata = assertTypeOf("ModuleNameMetadata");
  839. exports.assertModuleNameMetadata = assertModuleNameMetadata;
  840. var assertFunctionNameMetadata = assertTypeOf("FunctionNameMetadata");
  841. exports.assertFunctionNameMetadata = assertFunctionNameMetadata;
  842. var assertLocalNameMetadata = assertTypeOf("LocalNameMetadata");
  843. exports.assertLocalNameMetadata = assertLocalNameMetadata;
  844. var assertBinaryModule = assertTypeOf("BinaryModule");
  845. exports.assertBinaryModule = assertBinaryModule;
  846. var assertQuoteModule = assertTypeOf("QuoteModule");
  847. exports.assertQuoteModule = assertQuoteModule;
  848. var assertSectionMetadata = assertTypeOf("SectionMetadata");
  849. exports.assertSectionMetadata = assertSectionMetadata;
  850. var assertProducersSectionMetadata = assertTypeOf("ProducersSectionMetadata");
  851. exports.assertProducersSectionMetadata = assertProducersSectionMetadata;
  852. var assertProducerMetadata = assertTypeOf("ProducerMetadata");
  853. exports.assertProducerMetadata = assertProducerMetadata;
  854. var assertProducerMetadataVersionedName = assertTypeOf("ProducerMetadataVersionedName");
  855. exports.assertProducerMetadataVersionedName = assertProducerMetadataVersionedName;
  856. var assertLoopInstruction = assertTypeOf("LoopInstruction");
  857. exports.assertLoopInstruction = assertLoopInstruction;
  858. var assertInstr = assertTypeOf("Instr");
  859. exports.assertInstr = assertInstr;
  860. var assertIfInstruction = assertTypeOf("IfInstruction");
  861. exports.assertIfInstruction = assertIfInstruction;
  862. var assertStringLiteral = assertTypeOf("StringLiteral");
  863. exports.assertStringLiteral = assertStringLiteral;
  864. var assertNumberLiteral = assertTypeOf("NumberLiteral");
  865. exports.assertNumberLiteral = assertNumberLiteral;
  866. var assertLongNumberLiteral = assertTypeOf("LongNumberLiteral");
  867. exports.assertLongNumberLiteral = assertLongNumberLiteral;
  868. var assertFloatLiteral = assertTypeOf("FloatLiteral");
  869. exports.assertFloatLiteral = assertFloatLiteral;
  870. var assertElem = assertTypeOf("Elem");
  871. exports.assertElem = assertElem;
  872. var assertIndexInFuncSection = assertTypeOf("IndexInFuncSection");
  873. exports.assertIndexInFuncSection = assertIndexInFuncSection;
  874. var assertValtypeLiteral = assertTypeOf("ValtypeLiteral");
  875. exports.assertValtypeLiteral = assertValtypeLiteral;
  876. var assertTypeInstruction = assertTypeOf("TypeInstruction");
  877. exports.assertTypeInstruction = assertTypeInstruction;
  878. var assertStart = assertTypeOf("Start");
  879. exports.assertStart = assertStart;
  880. var assertGlobalType = assertTypeOf("GlobalType");
  881. exports.assertGlobalType = assertGlobalType;
  882. var assertLeadingComment = assertTypeOf("LeadingComment");
  883. exports.assertLeadingComment = assertLeadingComment;
  884. var assertBlockComment = assertTypeOf("BlockComment");
  885. exports.assertBlockComment = assertBlockComment;
  886. var assertData = assertTypeOf("Data");
  887. exports.assertData = assertData;
  888. var assertGlobal = assertTypeOf("Global");
  889. exports.assertGlobal = assertGlobal;
  890. var assertTable = assertTypeOf("Table");
  891. exports.assertTable = assertTable;
  892. var assertMemory = assertTypeOf("Memory");
  893. exports.assertMemory = assertMemory;
  894. var assertFuncImportDescr = assertTypeOf("FuncImportDescr");
  895. exports.assertFuncImportDescr = assertFuncImportDescr;
  896. var assertModuleImport = assertTypeOf("ModuleImport");
  897. exports.assertModuleImport = assertModuleImport;
  898. var assertModuleExportDescr = assertTypeOf("ModuleExportDescr");
  899. exports.assertModuleExportDescr = assertModuleExportDescr;
  900. var assertModuleExport = assertTypeOf("ModuleExport");
  901. exports.assertModuleExport = assertModuleExport;
  902. var assertLimit = assertTypeOf("Limit");
  903. exports.assertLimit = assertLimit;
  904. var assertSignature = assertTypeOf("Signature");
  905. exports.assertSignature = assertSignature;
  906. var assertProgram = assertTypeOf("Program");
  907. exports.assertProgram = assertProgram;
  908. var assertIdentifier = assertTypeOf("Identifier");
  909. exports.assertIdentifier = assertIdentifier;
  910. var assertBlockInstruction = assertTypeOf("BlockInstruction");
  911. exports.assertBlockInstruction = assertBlockInstruction;
  912. var assertCallInstruction = assertTypeOf("CallInstruction");
  913. exports.assertCallInstruction = assertCallInstruction;
  914. var assertCallIndirectInstruction = assertTypeOf("CallIndirectInstruction");
  915. exports.assertCallIndirectInstruction = assertCallIndirectInstruction;
  916. var assertByteArray = assertTypeOf("ByteArray");
  917. exports.assertByteArray = assertByteArray;
  918. var assertFunc = assertTypeOf("Func");
  919. exports.assertFunc = assertFunc;
  920. var assertInternalBrUnless = assertTypeOf("InternalBrUnless");
  921. exports.assertInternalBrUnless = assertInternalBrUnless;
  922. var assertInternalGoto = assertTypeOf("InternalGoto");
  923. exports.assertInternalGoto = assertInternalGoto;
  924. var assertInternalCallExtern = assertTypeOf("InternalCallExtern");
  925. exports.assertInternalCallExtern = assertInternalCallExtern;
  926. var assertInternalEndAndReturn = assertTypeOf("InternalEndAndReturn");
  927. exports.assertInternalEndAndReturn = assertInternalEndAndReturn;
  928. var unionTypesMap = {
  929. Module: ["Node"],
  930. ModuleMetadata: ["Node"],
  931. ModuleNameMetadata: ["Node"],
  932. FunctionNameMetadata: ["Node"],
  933. LocalNameMetadata: ["Node"],
  934. BinaryModule: ["Node"],
  935. QuoteModule: ["Node"],
  936. SectionMetadata: ["Node"],
  937. ProducersSectionMetadata: ["Node"],
  938. ProducerMetadata: ["Node"],
  939. ProducerMetadataVersionedName: ["Node"],
  940. LoopInstruction: ["Node", "Block", "Instruction"],
  941. Instr: ["Node", "Expression", "Instruction"],
  942. IfInstruction: ["Node", "Instruction"],
  943. StringLiteral: ["Node", "Expression"],
  944. NumberLiteral: ["Node", "NumericLiteral", "Expression"],
  945. LongNumberLiteral: ["Node", "NumericLiteral", "Expression"],
  946. FloatLiteral: ["Node", "NumericLiteral", "Expression"],
  947. Elem: ["Node"],
  948. IndexInFuncSection: ["Node"],
  949. ValtypeLiteral: ["Node", "Expression"],
  950. TypeInstruction: ["Node", "Instruction"],
  951. Start: ["Node"],
  952. GlobalType: ["Node", "ImportDescr"],
  953. LeadingComment: ["Node"],
  954. BlockComment: ["Node"],
  955. Data: ["Node"],
  956. Global: ["Node"],
  957. Table: ["Node", "ImportDescr"],
  958. Memory: ["Node", "ImportDescr"],
  959. FuncImportDescr: ["Node", "ImportDescr"],
  960. ModuleImport: ["Node"],
  961. ModuleExportDescr: ["Node"],
  962. ModuleExport: ["Node"],
  963. Limit: ["Node"],
  964. Signature: ["Node"],
  965. Program: ["Node"],
  966. Identifier: ["Node", "Expression"],
  967. BlockInstruction: ["Node", "Block", "Instruction"],
  968. CallInstruction: ["Node", "Instruction"],
  969. CallIndirectInstruction: ["Node", "Instruction"],
  970. ByteArray: ["Node"],
  971. Func: ["Node", "Block"],
  972. InternalBrUnless: ["Node", "Intrinsic"],
  973. InternalGoto: ["Node", "Intrinsic"],
  974. InternalCallExtern: ["Node", "Intrinsic"],
  975. InternalEndAndReturn: ["Node", "Intrinsic"]
  976. };
  977. exports.unionTypesMap = unionTypesMap;
  978. 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"];
  979. exports.nodeAndUnionTypes = nodeAndUnionTypes;