diff --git a/ets2panda/util/importPathManager.cpp b/ets2panda/util/importPathManager.cpp index a22a321bea264b23d9c7571dddd5e40ba028ac20..3313a9fa1374b9901b37fb72a0e333bccbd0138a 100644 --- a/ets2panda/util/importPathManager.cpp +++ b/ets2panda/util/importPathManager.cpp @@ -76,7 +76,8 @@ void ImportPathManager::ProcessExternalLibraryImport(ImportMetadata &importData) // process emptry "path" in dependencies, since in interop we allow imports without typecheck if (!Helpers::EndsWith(std::string(externalModuleImportData.Path()), ".abc")) { importData.importFlags |= ImportFlags::EXTERNAL_SOURCE_IMPORT; - importData.ohmUrl.assign(externalModuleImportData.OhmUrl(), externalModuleImportData.OhmUrl().size()); + util::UString ohmUrlLocal {externalModuleImportData.OhmUrl(), allocator_}; + importData.ohmUrl = ohmUrlLocal.View().Utf8(); return; } @@ -99,9 +100,10 @@ void ImportPathManager::ProcessExternalLibraryImport(ImportMetadata &importData) // rely on the following mangling: .ETSGLOBAL auto etsGlobalSuffix = std::string(".") + std::string(compiler::Signatures::ETS_GLOBAL); ES2PANDA_ASSERT(Helpers::EndsWith(etsGlobalRecord->second.name, etsGlobalSuffix)); - auto moduleName = - etsGlobalRecord->second.name.substr(0, etsGlobalRecord->second.name.size() - etsGlobalSuffix.size()); - importData.ohmUrl = moduleName; + util::UString moduleName { + etsGlobalRecord->second.name.substr(0, etsGlobalRecord->second.name.size() - etsGlobalSuffix.size()), + allocator_}; + importData.ohmUrl = moduleName.View().Utf8(); auto annotations = etsGlobalRecord->second.metadata->GetAnnotations(); auto moduleDeclarationAnno = std::find_if(annotations.begin(), annotations.end(), [](auto &anno) { diff --git a/ets2panda/util/importPathManager.h b/ets2panda/util/importPathManager.h index 02273bf0ecc26abf0c5e2a14686dee8727451b2e..5979defc02dffb03ad8774f5ddb4ddd3e82b7b06 100644 --- a/ets2panda/util/importPathManager.h +++ b/ets2panda/util/importPathManager.h @@ -83,7 +83,7 @@ public: Language::Id lang {Language::Id::COUNT}; std::string_view resolvedSource {}; std::string_view declPath {}; - std::string ohmUrl {}; + std::string_view ohmUrl {}; std::string_view declText {}; // NOLINTEND(misc-non-private-member-variables-in-classes)