Skip to content

Commit 9a46c15

Browse files
committed
Always flush the pattern cache when switching astral mode.
1 parent d8cf371 commit 9a46c15

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/xregexp.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,9 @@ var XRegExp = (function(undefined) {
364364
* @param {Boolean} on `true` to enable; `false` to disable.
365365
*/
366366
function setAstral(on) {
367-
if (on) {
368-
// Reset the pattern cache used by the `XRegExp` constructor, since the same pattern
369-
// and flags might now produce different results
370-
self.cache.flush('patterns');
371-
}
367+
// Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and
368+
// flags might now produce different results
369+
self.cache.flush('patterns');
372370

373371
features.astral = on;
374372
}

xregexp-all.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,9 @@ var XRegExp = (function(undefined) {
391391
* @param {Boolean} on `true` to enable; `false` to disable.
392392
*/
393393
function setAstral(on) {
394-
if (on) {
395-
// Reset the pattern cache used by the `XRegExp` constructor, since the same pattern
396-
// and flags might now produce different results
397-
self.cache.flush('patterns');
398-
}
394+
// Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and
395+
// flags might now produce different results
396+
self.cache.flush('patterns');
399397

400398
features.astral = on;
401399
}

0 commit comments

Comments
 (0)