diff options
-rw-r--r-- | lib/Core/ExecutionState.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/Core/ExecutionState.cpp b/lib/Core/ExecutionState.cpp index 270a3e16..1e45812c 100644 --- a/lib/Core/ExecutionState.cpp +++ b/lib/Core/ExecutionState.cpp @@ -415,12 +415,9 @@ std::string extractMetaEnvVar(ref<Expr> e) { } const auto& name = read->updates.root->name; - // string::starts_with requires C++20 - if (name.substr(0, 8) != "__choose") + // Skip __choose\d.* + if (name.substr(0, 8) != "__choose" || '0' > name[8] || name[8] > '9') return ""; - for (const auto c : name.substr(8)) - if ('0' > c || c > '9') - return ""; std::string value; constant->toString(value); return "__SWITCH" + name.substr(8, name.size() - 8) + "=" + value; |