mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +00:00
LibJS: Parse the RegExp.prototype.hasIndices flag
This commit is contained in:
parent
e801cc7afd
commit
d1e06b00e3
6 changed files with 12 additions and 3 deletions
|
@ -16,7 +16,7 @@ namespace JS {
|
|||
static Flags options_from(GlobalObject& global_object, const String& flags)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
bool g = false, i = false, m = false, s = false, u = false, y = false;
|
||||
bool d = false, g = false, i = false, m = false, s = false, u = false, y = false;
|
||||
Flags options {
|
||||
// JS regexps are all 'global' by default as per our definition, but the "global" flag enables "stateful".
|
||||
// FIXME: Enable 'BrowserExtended' only if in a browser context.
|
||||
|
@ -26,6 +26,11 @@ static Flags options_from(GlobalObject& global_object, const String& flags)
|
|||
|
||||
for (auto ch : flags) {
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
if (d)
|
||||
vm.throw_exception<SyntaxError>(global_object, ErrorType::RegExpObjectRepeatedFlag, ch);
|
||||
d = true;
|
||||
break;
|
||||
case 'g':
|
||||
if (g)
|
||||
vm.throw_exception<SyntaxError>(global_object, ErrorType::RegExpObjectRepeatedFlag, ch);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue