Refs: https://github.com/v8/v8/compare/7.4.288.13...7.4.288.17 PR-URL: https://github.com/nodejs/node/pull/27066 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
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);
|