archives

« Bugzilla Issues Index

#4155 — 13.2.3.6 IteratorBindingInitialization, 13.2.3.7 KeyedBindingInitialization: Incorrect use for ResolveBinding


13.2.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
- step 2

BindingRestElement : ... BindingIdentifier
- step 2

13.2.3.7 Runtime Semantics: KeyedBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
- step 2


ResolveBinding cannot be used here because of the parameter eval environment (ResolveBinding uses the current lexical environment!).


Step 2 needs to be replaced with:
---
2. If environment is undefined, then
a. Let lhs be ResolveBinding(bindingId).
b. ReturnIfAbrupt(lhs).
---

And step 8/5.b.ii/8 needs to be changed from:
---
8. Return InitializeReferencedBinding(lhs, v)
---

To:
---
8. Return InitializeBoundName(bindingId, v, environment).
---

Resp. to:
---
5.b.ii. Return InitializeBoundName(StringValue of BindingIdentifier, A, environment).
---


fixed in rev36 editor's dcraft

but I took a different approach. I added an optional environment parameter to ResolveBinding. If it is missing or undefined, the current LexicalEnvironment is used.

environment is now passed in the ResolveBinding step of the three algorithms you identified.

This preserves the left to right evaluation order.


in rev36