Status: New
Owner: ----

New issue 3758 by [email protected]: LiveEdit closure.toString() returns '[native]' after patching
https://code.google.com/p/v8/issues/detail?id=3758

// Flags: --expose_debug_as=D

var Debug = D.Debug;
var LiveEdit = Debug.LiveEdit;

var assert = {
  equal: function(a, b) { if (a != b) throw Error(a + ' != ' + b); }
};

var source = '(function() {' +
             '  var x = 42;' +
             '  var y = 1337;' +
             '  return function() { return x };' +
             '})';
var f = eval(source);
var g = f();
assert.equal(g(), 42);
assert.equal('' + g, 'function () { return x }');
var diff = [62, 62, 71];
var script = Debug.findScript(f);
var replacement = source.replace(' return x', 'return y; return x');
LiveEdit.ApplyPatchMultiChunk(script, diff, replacement, false, []);
assert.equal(g(), 42);  // Old closure still returns the old value.
assert.equal('' + g, 'function () { return x }');
var g = f();
assert.equal(g(), 1337);  // New closure returns the new value.
assert.equal('' + g, 'function () {return y; return x }');

The last assert fails:

$ out/x64.debug/d8 --expose_debug_as=D liveedit.js
liveedit.js:24: Error: function () { [native code] } != function () {return y; return x }
  equal: function(a, b) { if (a != b) throw Error(a + ' != ' + b); }
                                                             ^
Error: function () { [native code] } != function () {return y; return x }
    at Error (native)
    at Object.assert.equal (liveedit.js:24:62)
    at liveedit.js:44:8

Observed with today's HEAD, 3.30.37 and 3.26.33, suggesting it's not new. It works as expected with 3.14.5.9.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to