Don't relocate temporary variable which receives property access, unless it's provable that this property don't have side effects
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
var log = "";
|
||||
|
||||
A = {};
|
||||
Object.defineProperty(A, "x", {
|
||||
get: function() {
|
||||
log += "A.x;";
|
||||
return 23;
|
||||
}
|
||||
});
|
||||
|
||||
function b() {
|
||||
log += "b();";
|
||||
return 42;
|
||||
}
|
||||
|
||||
function box() {
|
||||
var $tmp = A.x;
|
||||
var result = b() + ";" + $tmp;
|
||||
|
||||
if (result != "42;23") return "fail1: " + result;
|
||||
if (log != "A.x;b();") return "fail2: " + log;
|
||||
|
||||
return "OK";
|
||||
}
|
||||
Reference in New Issue
Block a user