ECMAScript spec assertion fails when binding is deleted?

Jim Blandy jimb at mozilla.com
Sun Mar 20 23:22:15 PDT 2011


When executing this code:

    (function () {
         eval("var x=delete(x)")
    })()

I think the assertion in the ECMAScript description of the declarative 
environment record's SetMutableBinding algorithm, 10.2.1.1.3 step 2, fails.

    * On entry to the function, we create a lexical environment with a
      declarative environment record (10.4.3).
    * When we enter the eval code, we create the binding for 'x' in that
      environment record  (10.5, step 8.c.1). This is a deletable
      binding, as per 10.5 step 2.
    * When we evaluate the declaration, we produce a reference with that
      environment record as its base, delete the binding, and then call
      PutValue (12.2, VariableDeclaration : Identifier Initialiser
      semantics).
    * PutValue calls the environment record's SetMutableBinding concrete
      method (8.7.2 step 5.a).
    * SetMutableBinding's assertion fails, because 'x' is no longer
      bound in that environment record (10.2.1.1.3 step 2).

Have I missed something?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110320/e085566a/attachment-0001.html>


More information about the es-discuss mailing list