Assignment of global variables deleted by their RHS in strict mode

André Bargull andre.bargull at
Thu Aug 27 08:03:40 UTC 2015

> A fix for this would be in, 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 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 (

- André

More information about the es-discuss mailing list