diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-08-08 13:15:40 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-15 14:24:23 +0000 |
commit | a1964f0b8e0569ef9ab754e2ec4c4d0559bc7681 (patch) | |
tree | 36416a7583527d87409ce0f9152687750a265e03 /src/qml/compiler/qv4compileddata.cpp | |
parent | 15f56b74dc18c1105c9943f76599dbab5214b8e8 (diff) |
Cleanup RegExpObject
Move properties from RegExpObject to getters in RegExp.prototype
to be compliant with the JS spec.
Implement support for the sticky flags ('y') and correctly parse
the flags in the RegExp constructor.
Change-Id: I5cf05d14e8139cf30d46235b8d466fb96084fcb7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compileddata.cpp')
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 798bfe921e..46034050e0 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -149,19 +149,9 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) memset(runtimeRegularExpressions, 0, data->regexpTableSize * sizeof(QV4::Value)); for (uint i = 0; i < data->regexpTableSize; ++i) { const CompiledData::RegExp *re = data->regexpAt(i); - bool global = false; - bool multiline = false; - bool ignoreCase = false; - bool unicode = false; - if (re->flags & CompiledData::RegExp::RegExp_Global) - global = true; - if (re->flags & CompiledData::RegExp::RegExp_IgnoreCase) - ignoreCase = true; - if (re->flags & CompiledData::RegExp::RegExp_Multiline) - multiline = true; - if (re->flags & CompiledData::RegExp::RegExp_Unicode) - unicode = true; - runtimeRegularExpressions[i] = QV4::RegExp::create(engine, stringAt(re->stringIndex), ignoreCase, multiline, global, unicode); + uint f = re->flags; + const CompiledData::RegExp::Flags flags = static_cast<CompiledData::RegExp::Flags>(f); + runtimeRegularExpressions[i] = QV4::RegExp::create(engine, stringAt(re->stringIndex), flags); } if (data->lookupTableSize) { |