summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/slicer/modelPartsTypes.cpp5
-rw-r--r--slicer/slicer/modelPartsTypes.h1
-rw-r--r--slicer/tool/parser.cpp4
3 files changed, 8 insertions, 2 deletions
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp
index 8cc8656..8ebe127 100644
--- a/slicer/slicer/modelPartsTypes.cpp
+++ b/slicer/slicer/modelPartsTypes.cpp
@@ -199,6 +199,11 @@ namespace Slicer {
{
return type;
}
+ void
+ ModelPartForConvertedBase::conversion_fail(std::string_view typeName)
+ {
+ throw NoConversionFound(std::string {typeName});
+ }
const ModelPartType ModelPartForConvertedBase::type = ModelPartType::Simple;
ModelPartType
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index 9cc8ac9..ecc965a 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -58,6 +58,7 @@ namespace Slicer {
static const ModelPartType type;
protected:
+ [[noreturn]] void conversion_fail(std::string_view typeName);
template<typename ET, typename MT, typename Conv>
inline static bool tryConvertFrom(ValueSource & vsp, MT * model, const Conv & conv);
template<typename ET, typename MT> inline static bool tryConvertFrom(ValueSource & vsp, MT * model);
diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp
index e1cc988..73ace40 100644
--- a/slicer/tool/parser.cpp
+++ b/slicer/tool/parser.cpp
@@ -163,7 +163,7 @@ namespace Slicer {
Slice::typeToString(type));
}
// Failed to convert
- fprintbf(cpp, "\tthrow NoConversionFound(\"%s\");\n", Slice::typeToString(type));
+ fprintbf(cpp, "\tconversion_fail(\"%s\");\n", Slice::typeToString(type));
fprintbf(cpp, "}\n\n");
fprintbf(cpp, "template<> DLL_PUBLIC\nbool\n");
@@ -188,7 +188,7 @@ namespace Slicer {
Slice::typeToString(type));
}
// Failed to convert
- fprintbf(cpp, "\tthrow NoConversionFound(\"%s\");\n", Slice::typeToString(type));
+ fprintbf(cpp, "\tconversion_fail(\"%s\");\n", Slice::typeToString(type));
fprintbf(cpp, "}\n\n");
}
}