section.js 515 B

12345678910111213141516171819202122232425262728293031
  1. export function getSectionForNode(n) {
  2. switch (n.type) {
  3. case "ModuleImport":
  4. return "import";
  5. case "CallInstruction":
  6. case "CallIndirectInstruction":
  7. case "Func":
  8. case "Instr":
  9. return "code";
  10. case "ModuleExport":
  11. return "export";
  12. case "Start":
  13. return "start";
  14. case "TypeInstruction":
  15. return "type";
  16. case "IndexInFuncSection":
  17. return "func";
  18. case "Global":
  19. return "global";
  20. // No section
  21. default:
  22. return;
  23. }
  24. }