Skip to content

Commit

Permalink
Use both compilers for JS (#37)
Browse files Browse the repository at this point in the history
* Use BOTH compilers for js
  • Loading branch information
CommanderTvis authored Mar 13, 2021
1 parent f710ecd commit db8d94d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ kotlin {
}
}

js {
js(BOTH) {
browser()
nodejs()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ public actual class RegexToken : Token {
js(
"""
var r = regex.nativePattern_0;
regex.nativePattern_0 = new RegExp(r.source, r.flags + (r.sticky ? "" : "y"));
if (typeof r === 'undefined' || r === null) {
r = regex._nativePattern;
regex._nativePattern = new RegExp(r.source, r.flags + (r.sticky ? "" : "y"));
} else {
regex.nativePattern_0 = new RegExp(r.source, r.flags + (r.sticky ? "" : "y"));
}
"""
)
}
Expand Down

0 comments on commit db8d94d

Please sign in to comment.