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