[Webkit-unassigned] [Bug 163208] [ES6]. Implement Annex B.3.3 function hoisting rules for eval
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Apr 6 10:31:36 PDT 2017
https://bugs.webkit.org/show_bug.cgi?id=163208
GSkachkov <gskachkov at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |adamk at chromium.org
--- Comment #68 from GSkachkov <gskachkov at gmail.com> ---
(In reply to Caitlin Potter (:caitp) from comment #66)
> (In reply to GSkachkov from comment #65)
> > (In reply to Caitlin Potter (:caitp) from comment #63)
> > > (In reply to Saam Barati from comment #46)
> > > > If you run this program in Chrome Canary, you can see V8's behavior here
> > > > w.r.t the specification. It looks like the eval does indeed perform `has` on
> > > > the thing inside the with scope.
> > > >
> > > > ```
> > > > function foo() {
> > > > let p2 = new Proxy({}, {
> > > > has(t, p) {
> > > > console.log(p)
> > > > return Reflect.has(t, p);
> > > > }
> > > > });
> > > > with (p2) {
> > > > eval("Reflect.has(p2, 'bar'); { function baz() { }; }");
> > > > }
> > > > }
> > > > foo();
> > > > ```
> > > >
> > > > I'm not sure if V8 is correct here, but we should verify the correct
> > > > behavior and try to get that landed. V8 will have the following output:
> > > >
> > > > ```
> > > > eval
> > > > Reflect
> > > > p2
> > > > bar
> > > > baz
> > > > ```
> > >
> > > I believe this is correct, per
> > > https://tc39.github.io/ecma262/#sec-object-environment-records-hasbinding-n
> > > and
> > > https://tc39.github.io/ecma262/#sec-object-environment-records-
> > > getbindingvalue-n-s
> >
> > Hmm, I stil think that it should not be printed 'baz', because according to
> > the p.B.3.3.3.1.d.ii.4.b('If thisEnvRec is not an object Environment Record,
> > then') we don't invoke hasBinding, and just go to outer env recode
> > https://tc39.github.io/ecma262/#sec-web-compat-evaldeclarationinstantiation
>
> As I said on IRC, I wasn't commenting on the hoisting of baz, because the
> behaviour of block scoping of functions and annex B changes to that are
> somewhat hard to follow.
>
> It looks like you're right about that HasProperty() not occurring from step
> 5, but it may occur further down in the algorithm, from `Let fobj be !
> benvRec.GetBindingValue(F, false).`, as I believe in this instance, benv
> still refers to the with block.
>
> I could be wrong about this, Adam Klein is much more knowledgable about the
> block-scoping of functions than I am.
Oh sorry, I misunderstood your message in IRC. I'll try to chat with Adam Klein.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170406/77cfe9eb/attachment-0001.html>
More information about the webkit-unassigned
mailing list