avm2: Short circuit the regexp replacement logic if it's a simple (no pattern) string
This commit is contained in:
parent
ef42bba20c
commit
0023062c82
|
@ -159,6 +159,10 @@ impl<'gc> RegExp<'gc> {
|
||||||
text: &AvmString<'gc>,
|
text: &AvmString<'gc>,
|
||||||
m: ®ress::Match,
|
m: ®ress::Match,
|
||||||
) -> WString {
|
) -> WString {
|
||||||
|
if !replacement.contains(b'$') {
|
||||||
|
// Nothing to do if there's no $ replacement symbols
|
||||||
|
return replacement.as_wstr().to_owned();
|
||||||
|
}
|
||||||
let mut ret = WString::new();
|
let mut ret = WString::new();
|
||||||
let s = replacement.as_wstr();
|
let s = replacement.as_wstr();
|
||||||
let mut chars = s.chars().peekable();
|
let mut chars = s.chars().peekable();
|
||||||
|
|
Loading…
Reference in New Issue