mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1217099 - Stop emitting pointless JSOP_GETLOCAL; JSOP_POP bytecode sequence for var x;
. r=shu.
This commit is contained in:
parent
e4610df25d
commit
e873f751c5
@ -38,7 +38,7 @@ function test_executable_lines() {
|
||||
do_check_true(!error);
|
||||
let source = gThreadClient.source(sources[0]);
|
||||
source.getExecutableLines(function(lines){
|
||||
do_check_true(arrays_equal([2, 3, 5, 6, 7, 8, 12, 14, 16], lines));
|
||||
do_check_true(arrays_equal([2, 5, 7, 8, 12, 14, 16], lines));
|
||||
finishClient(gClient);
|
||||
});
|
||||
});
|
||||
|
@ -4355,6 +4355,9 @@ BytecodeEmitter::emitSingleVariable(ParseNode* pn, ParseNode* binding, ParseNode
|
||||
MOZ_ASSERT(emitOption != DefineVars);
|
||||
if (!emit1(JSOP_UNDEFINED))
|
||||
return false;
|
||||
} else {
|
||||
// The declaration is like `var x;`. Nothing to do.
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we are not initializing, nothing to pop. If we are initializing
|
||||
|
@ -18,4 +18,4 @@ global.eval("function f(n){var w0,x1=3,y2=4,z3=9} debugger;");
|
||||
global.f(3);
|
||||
|
||||
// Should have hit each variable declared.
|
||||
assertEq(global.log, "18 21 26 31 35 ");
|
||||
assertEq(global.log, "21 26 31 35 ");
|
||||
|
15
js/src/tests/ecma_5/Global/bug-320887.js
Normal file
15
js/src/tests/ecma_5/Global/bug-320887.js
Normal file
@ -0,0 +1,15 @@
|
||||
// `var x` should not call the getter of an existing global property.
|
||||
|
||||
var hit = 0;
|
||||
Object.defineProperty(this, "x", {
|
||||
get: function () { return ++hit; },
|
||||
configurable: true
|
||||
});
|
||||
eval("var x;");
|
||||
assertEq(hit, 0);
|
||||
|
||||
// The declaration should not have redefined the global x, either.
|
||||
assertEq(x, 1);
|
||||
assertEq(x, 2);
|
||||
|
||||
reportCompare(0, 0);
|
Loading…
Reference in New Issue
Block a user