PR-URL: https://github.com/nodejs/node/pull/60111 Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
23 lines
786 B
JavaScript
23 lines
786 B
JavaScript
// Copyright 2025 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.
|
|
|
|
// Flags: --allow-natives-syntax --inspector-live-edit
|
|
|
|
Debug = debug.Debug
|
|
|
|
eval("var something1 = 25; "
|
|
+ "function do_eval(s) { return eval(`'${s}'`) };"
|
|
+ " function ChooseAnimal() { return do_eval('Cat'); } "
|
|
+ " ChooseAnimal.Helper = function() { return eval(\"'Help!\"); }");
|
|
|
|
assertEquals("Cat", ChooseAnimal());
|
|
|
|
var orig_animal = "Cat";
|
|
var new_animal_patch = "Cap' + 'y' + 'bara";
|
|
var old_source = Debug.scriptSource(ChooseAnimal);
|
|
var new_source = old_source.replace(orig_animal, new_animal_patch);
|
|
|
|
%LiveEditPatchScript(ChooseAnimal, new_source);
|
|
|
|
assertEquals("Capybara", ChooseAnimal());
|