From 4222de90348f8cb9b6fe7e192a052adddd13e69e Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 19 Nov 2023 10:18:37 +0100 Subject: [PATCH] Avoiding one invalid error message --- src/lym/lym/gsiDeclLymMacro.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lym/lym/gsiDeclLymMacro.cc b/src/lym/lym/gsiDeclLymMacro.cc index 4555c562e..ed40812bc 100644 --- a/src/lym/lym/gsiDeclLymMacro.cc +++ b/src/lym/lym/gsiDeclLymMacro.cc @@ -123,10 +123,12 @@ public: void register_gsi (const char *name) { + m_name = name; + // do not register an interpreter again (this is important as registration code // may be executed again and we do not want to have two interpreters for the same thing) for (tl::Registrar::iterator cls = tl::Registrar::begin (); cls != tl::Registrar::end (); ++cls) { - if (cls.current_name () == name) { + if (cls.current_name () == m_name) { return; } } @@ -137,8 +139,6 @@ public: // cancel any previous registration and register (again) delete mp_registration; mp_registration = new tl::RegisteredClass (this, 0 /*position*/, name, false /*does not own object*/); - - m_name = name; } virtual tl::Executable *executable (const lym::Macro *macro) const @@ -212,7 +212,7 @@ public: lym::Macro *create_template (const std::string &url) { - if (! mp_registration) { + if (m_name.empty ()) { throw std::runtime_error (tl::to_string (tr ("MacroInterpreter::create_template must be called after register"))); }