Closed
Bug 1064204
Opened 10 years ago
Closed 10 years ago
VariableDeclaration without initializer executes getter on WithStatement scope object
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
DUPLICATE
of bug 320887
People
(Reporter: anba, Unassigned)
References
(Blocks 1 open bug)
Details
The getter property on the WithStatement scope object should not be executed in the following test case.
Expected: Prints "pre", then "post"
Actual: Prints "getter" between "pre" and "post"
Test case:
---
(function(){
with({
get x() {
print("getter");
}
}) {
print("pre");
var x;
print("post");
}
})();
---
Comment 1•10 years ago
|
||
This isn't clear to me. Could someone explain, in terms of the spec, what the correct behavior is here and why? Thanks.
Reporter | ||
Comment 2•10 years ago
|
||
When `var x;` is executed, the getter for "x" on the with-object shouldn't be executed.
This is specified in ES6, 13.2.2.4 Runtime Semantics: Evaluation
VariableDeclaration : BindingIdentifier
1. Return NormalCompletion(empty).
Somehow SpiderMonkey treats `var x;` as if it was written like: `var x; x;`.
Comment 3•10 years ago
|
||
This is likely significantly easier now that the getprop/name operation here isn't needed to placate the decompiler. But, in the existing bug, please.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•