| 670 | } |
| 671 | |
| 672 | bool CheckImportExport(std::string& s, |
| 673 | ExternalKind kind, |
| 674 | Index index, |
| 675 | std::string_view name) { |
| 676 | // Figure out if this thing is imported, exported, or neither. |
| 677 | auto is_import = mc.module.IsImport(kind, Var(index, Location())); |
| 678 | // TODO: is this the best way to check for export? |
| 679 | // FIXME: this doesn't work for functions that get renamed in some way, |
| 680 | // as the export has the original name.. |
| 681 | auto xport = mc.module.GetExport(name); |
| 682 | auto is_export = xport && xport->kind == kind; |
| 683 | if (is_export) |
| 684 | s += "export "; |
| 685 | if (is_import) |
| 686 | s += "import "; |
| 687 | return is_import; |
| 688 | } |
| 689 | |
| 690 | std::string InitExp(const ExprList& el) { |
| 691 | assert(!el.empty()); |