1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-19 17:31:44 +03:00

Regex: Fix use of not-yet-constructed CompiledRegex in TestVM impl

This commit is contained in:
Maxime Coste 2017-10-02 16:50:41 +08:00
parent 5b0c2cbdc2
commit 630d078b6d

View File

@ -812,19 +812,17 @@ CompiledRegex compile_regex(StringView re)
}
auto test_regex = UnitTest{[]{
struct TestVM : ThreadedRegexVM<const char*>
struct TestVM : CompiledRegex, ThreadedRegexVM<const char*>
{
TestVM(StringView re, bool dump = false)
: ThreadedRegexVM{m_program},
m_program{RegexCompiler::compile(re)}
{ if (dump) dump_regex(m_program); }
: CompiledRegex{RegexCompiler::compile(re)},
ThreadedRegexVM{(const CompiledRegex&)*this}
{ if (dump) dump_regex(*this); }
bool exec(StringView re, bool match = true, bool longest = false)
{
return ThreadedRegexVM::exec(re.begin(), re.end(), match, longest);
}
CompiledRegex m_program;
};
{