Assignment of global variables deleted by their RHS in strict mode
André Bargull
andre.bargull at udo.edu
Thu Aug 27 08:03:40 UTC 2015
> A fix for this would be in 8.1.1.4.5, insert between the current steps 4 and 5:
>
> 4.5 If S is true, then
> a. Let stillHasBinding be ObjRec.HasBinding(N).
> b. ReturnIfAbrupt(stillHasBinding).
> c. If stillHasBinding is false, throw a ReferenceError exception.
I think the check should go into 8.1.1.2.5 SetMutableBinding. That way the similar issue for object
environment records gets also fixed:
```
var scope = {x: 1};
with (scope) {
(function() {
"use strict";
x = (delete scope.x, 2);
})();
}
```
Except for SpiderMonkey, all other engines tested (Edge, Nashorn, JSC, V8) already throw a
ReferenceError for the above snippet. But that's probably because engines don't implement the
'correct' Reference type semantics (https://bugs.ecmascript.org/show_bug.cgi?id=4379).
- André
More information about the es-discuss
mailing list