@@ -1706,44 +1706,43 @@ void Function::clearDebugInfo() {
17061706}
17071707
17081708template <typename Map>
1709- typename Map::mapped_type&
1710- getModuleElement (Map& m, Name name, std::string_view funcName) {
1709+ auto & getModuleElement (Map& m, Name name, std::string_view funcName) {
17111710 auto iter = m.find (name);
17121711 if (iter == m.end ()) {
17131712 Fatal () << " Module::" << funcName << " : " << name << " does not exist" ;
17141713 }
17151714 return iter->second ;
17161715}
17171716
1718- Export* Module::getExport (Name name) {
1717+ Export* Module::getExport (Name name) const {
17191718 return getModuleElement (exportsMap, name, " getExport" );
17201719}
17211720
1722- Function* Module::getFunction (Name name) {
1721+ Function* Module::getFunction (Name name) const {
17231722 return getModuleElement (functionsMap, name, " getFunction" );
17241723}
17251724
1726- Table* Module::getTable (Name name) {
1725+ Table* Module::getTable (Name name) const {
17271726 return getModuleElement (tablesMap, name, " getTable" );
17281727}
17291728
1730- ElementSegment* Module::getElementSegment (Name name) {
1729+ ElementSegment* Module::getElementSegment (Name name) const {
17311730 return getModuleElement (elementSegmentsMap, name, " getElementSegment" );
17321731}
17331732
1734- Memory* Module::getMemory (Name name) {
1733+ Memory* Module::getMemory (Name name) const {
17351734 return getModuleElement (memoriesMap, name, " getMemory" );
17361735}
17371736
1738- DataSegment* Module::getDataSegment (Name name) {
1737+ DataSegment* Module::getDataSegment (Name name) const {
17391738 return getModuleElement (dataSegmentsMap, name, " getDataSegment" );
17401739}
17411740
1742- Global* Module::getGlobal (Name name) {
1741+ Global* Module::getGlobal (Name name) const {
17431742 return getModuleElement (globalsMap, name, " getGlobal" );
17441743}
17451744
1746- Tag* Module::getTag (Name name) {
1745+ Tag* Module::getTag (Name name) const {
17471746 return getModuleElement (tagsMap, name, " getTag" );
17481747}
17491748
@@ -1756,39 +1755,39 @@ typename Map::mapped_type getModuleElementOrNull(Map& m, Name name) {
17561755 return iter->second ;
17571756}
17581757
1759- Export* Module::getExportOrNull (Name name) {
1758+ Export* Module::getExportOrNull (Name name) const {
17601759 return getModuleElementOrNull (exportsMap, name);
17611760}
17621761
1763- Function* Module::getFunctionOrNull (Name name) {
1762+ Function* Module::getFunctionOrNull (Name name) const {
17641763 return getModuleElementOrNull (functionsMap, name);
17651764}
17661765
1767- Table* Module::getTableOrNull (Name name) {
1766+ Table* Module::getTableOrNull (Name name) const {
17681767 return getModuleElementOrNull (tablesMap, name);
17691768}
17701769
1771- ElementSegment* Module::getElementSegmentOrNull (Name name) {
1770+ ElementSegment* Module::getElementSegmentOrNull (Name name) const {
17721771 return getModuleElementOrNull (elementSegmentsMap, name);
17731772}
17741773
1775- Memory* Module::getMemoryOrNull (Name name) {
1774+ Memory* Module::getMemoryOrNull (Name name) const {
17761775 return getModuleElementOrNull (memoriesMap, name);
17771776}
17781777
1779- DataSegment* Module::getDataSegmentOrNull (Name name) {
1778+ DataSegment* Module::getDataSegmentOrNull (Name name) const {
17801779 return getModuleElementOrNull (dataSegmentsMap, name);
17811780}
17821781
1783- Global* Module::getGlobalOrNull (Name name) {
1782+ Global* Module::getGlobalOrNull (Name name) const {
17841783 return getModuleElementOrNull (globalsMap, name);
17851784}
17861785
1787- Tag* Module::getTagOrNull (Name name) {
1786+ Tag* Module::getTagOrNull (Name name) const {
17881787 return getModuleElementOrNull (tagsMap, name);
17891788}
17901789
1791- Importable* Module::getImport (ModuleItemKind kind, Name name) {
1790+ Importable* Module::getImport (ModuleItemKind kind, Name name) const {
17921791 switch (kind) {
17931792 case ModuleItemKind::Function:
17941793 return getFunction (name);
@@ -1809,7 +1808,7 @@ Importable* Module::getImport(ModuleItemKind kind, Name name) {
18091808 WASM_UNREACHABLE (" unexpected kind" );
18101809}
18111810
1812- Importable* Module::getImportOrNull (ModuleItemKind kind, Name name) {
1811+ Importable* Module::getImportOrNull (ModuleItemKind kind, Name name) const {
18131812 auto doReturn = [](Importable* importable) {
18141813 return importable ? importable->imported () ? importable : nullptr : nullptr ;
18151814 };
0 commit comments