Skip to content

Commit

Permalink
Workarounds for bugs
Browse files Browse the repository at this point in the history
--HG--
branch : com.mozilla.es4.smlnj
extra : convert_revision : b6d49af9a49ae4dbdb7c986e60ef0b921e34cc86
  • Loading branch information
[email protected] committed Apr 25, 2007
1 parent 3abcb3d commit d568cd8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions builtins/RegExp.es
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ package
throw new TypeError("Illegal construction of regular expression");
}
else {
source = pattern === undefined ? "" : ToString(pattern);
flags = flags === undefined ? "" : ToString(flags);
source = pattern === undefined ? "" : String(pattern);
flags = flags === undefined ? "" : String(flags);
}

let usedflags : Object! = { m: false, i: false, g: false, x: false, y: false };

for each ( let f : string in explodeString(flags) ) {
if (!(f in usedflags))
throw new SyntaxError("Invalid flag: " + f);
/* FIXME: uncomment when enumerability works right */
/*if (!(f in usedflags))
throw new SyntaxError("Invalid flag: " + f); */
if (usedflags.f)
throw new SyntaxError("Duplicated flag: " + f);
usedflags[f] = true;
Expand Down

0 comments on commit d568cd8

Please sign in to comment.