section.js 636 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.getSectionForNode = getSectionForNode;
  6. function getSectionForNode(n) {
  7. switch (n.type) {
  8. case "ModuleImport":
  9. return "import";
  10. case "CallInstruction":
  11. case "CallIndirectInstruction":
  12. case "Func":
  13. case "Instr":
  14. return "code";
  15. case "ModuleExport":
  16. return "export";
  17. case "Start":
  18. return "start";
  19. case "TypeInstruction":
  20. return "type";
  21. case "IndexInFuncSection":
  22. return "func";
  23. case "Global":
  24. return "global";
  25. // No section
  26. default:
  27. return;
  28. }
  29. }