super.prop erroneously disallowed inside eval inside arrow functions

RESOLVED FIXED in Firefox 41

Status

()

defect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: efaust, Assigned: efaust)

Tracking

unspecified
mozilla41
Points:
---

Firefox Tracking Flags

(firefox41 fixed)

Details

Attachments

(2 attachments)

The specese reads:

It is a Syntax Error if StatementList Contains super unless the source code containing super is eval code that is being processed by a direct eval that is contained in function code that is not the function code of an ArrowFunction.

To my read, this "is contained in" is not a formal function call, but rather means "it is within a non-arrow function". This means that eval inside an arrow function should work.
Jason, does this interpretation seem correct to you?
Flags: needinfo?(jorendorff)
(In reply to Eric Faust [:efaust] from comment #0)
> The specese reads:
> 
> It is a Syntax Error if StatementList Contains super unless the source code
> containing super is eval code that is being processed by a direct eval that
> is contained in function code that is not the function code of an
> ArrowFunction.
> 
> To my read, this "is contained in" is not a formal function call, but rather
> means "it is within a non-arrow function". This means that eval inside an
> arrow function should work.

Rather, this should work as long as the immediately enclosing arrow function is eventually enclosed by a non-arrow function. So eval inside an arrow function inside a method should work, for example.
Comment on attachment 8605702 [details] [diff] [review]
Part 1: Move evalStaticScope from BCE to GlobalSharedContext

Review of attachment 8605702 [details] [diff] [review]:
-----------------------------------------------------------------

Nice refactor.

::: js/src/frontend/Parser.cpp
@@ +699,5 @@
>       */
>      Directives directives(options().strictOption);
> +    GlobalSharedContext globalsc(context, directives,
> +                                 /* evalScope = */ js::NullPtr(),
> +                                 options().extraWarningsOption,

Side question: is this function only used by Reflect.parse?

::: js/src/frontend/SharedContext.h
@@ +235,5 @@
>  
>  class GlobalSharedContext : public SharedContext
>  {
>    private:
> +    Handle<StaticEvalObject*> evalScope_;

Nit: I'd prefer this to be named staticEvalScope_.

@@ +249,5 @@
>      {}
>  
>      ObjectBox* toObjectBox() { return nullptr; }
>      bool allowSuperProperty() const { return allowSuperProperty_; }
> +    HandleObject evalStaticScope() const { return evalScope_; }

Ditto, I'd prefer this to be named staticEvalScope()
Attachment #8605702 - Flags: review?(shu) → review+
Attachment #8605704 - Flags: review?(shu) → review+
(In reply to Eric Faust [:efaust] from comment #1)
> Jason, does this interpretation seem correct to you?

Hmm. The specese looks pretty dubious, but your interpretation is the only thing that makes any sense to me. +1.

super.method() works inside eval inside arrow functions inside methods in anba's es6draft, FWIW.
Flags: needinfo?(jorendorff)
https://hg.mozilla.org/mozilla-central/rev/18b28733ec14
https://hg.mozilla.org/mozilla-central/rev/893528aa073c
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.