2ee43006ab
Tbr: jgruber@chromium.org Bug: chromium:944971 Change-Id: I2dcbfae638848c11eac4e262c3d636f33c3f24a4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1541477 Commit-Queue: Igor Sheludko <ishell@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Cr-Commit-Position: refs/heads/master@{#60490}
20 lines
425 B
JavaScript
20 lines
425 B
JavaScript
// Copyright 2019 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
let re = /x/y;
|
|
let cnt = 0;
|
|
let str = re[Symbol.replace]("x", {
|
|
toString: () => {
|
|
cnt++;
|
|
if (cnt == 2) {
|
|
re.lastIndex = {valueOf: () => {
|
|
re.x = 42;
|
|
return 0;
|
|
}};
|
|
}
|
|
return 'y$';
|
|
}
|
|
});
|
|
assertEquals("y$", str);
|