HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/share/nodejs/@webassemblyjs/helper-compiler/esm/printer.js
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

import { kStart } from "./index";

function printInstruction(instruction) {
  var out = "";

  if (typeof instruction.type === "string") {
    // $FlowIgnore
    if (instruction.type === "InternalEndAndReturn") {
      out += "_end_and_return";
    } // $FlowIgnore


    if (instruction.type === "InternalBrUnless") {
      out += "_br_unless";
      out += " " + instruction.target;
    } // $FlowIgnore


    if (instruction.type === "InternalGoto") {
      out += "_goto";
      out += " " + instruction.target;
    } // $FlowIgnore


    if (instruction.type === "InternalCallExtern") {
      out += "_extern_call";
      out += " " + instruction.target;
    }
  }

  if (typeof instruction.object === "string") {
    out += instruction.object;
    out += ".";
  }

  if (typeof instruction.id === "string") {
    out += instruction.id;
  }

  if (instruction.args !== undefined) {
    // $FlowIgnore
    instruction.args.forEach(function (arg) {
      out += " "; // $FlowIgnore

      out += arg.value;
    });
  }

  if (_typeof(instruction.index) === "object") {
    // $FlowIgnore
    out += " @" + String(instruction.index.value);
  }

  return out;
}

export function dumpIR(ir) {
  var out = "";
  out += "Func table:\n";
  ir.funcTable.forEach(function (func) {
    if (func.name === kStart) {
      out += "__start" + " at " + func.startAt + "\n";
      return;
    }

    out += func.name + " at " + func.startAt + "\n";
  });
  out += "\n";

  for (var offset in ir.program) {
    out += offset + " | ";
    out += printInstruction(ir.program[parseInt(offset)]);
    out += "\n";
  }

  return out;
}