Closed
Bug 1164777
Opened 11 years ago
Closed 11 years ago
super.prop erroneously disallowed inside eval inside arrow functions
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla41
| Tracking | Status | |
|---|---|---|
| firefox41 | --- | fixed |
People
(Reporter: efaust, Assigned: efaust)
Details
Attachments
(2 files)
|
12.95 KB,
patch
|
shu
:
review+
|
Details | Diff | Splinter Review |
|
4.47 KB,
patch
|
shu
:
review+
|
Details | Diff | Splinter Review |
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.
| Assignee | ||
Comment 1•11 years ago
|
||
Jason, does this interpretation seem correct to you?
Flags: needinfo?(jorendorff)
| Assignee | ||
Comment 2•11 years ago
|
||
Attachment #8605702 -
Flags: review?(shu)
| Assignee | ||
Comment 3•11 years ago
|
||
Attachment #8605704 -
Flags: review?(shu)
| Assignee | ||
Comment 4•11 years ago
|
||
(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 5•11 years ago
|
||
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+
Updated•11 years ago
|
Attachment #8605704 -
Flags: review?(shu) → review+
Comment 6•11 years ago
|
||
(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)
Comment 10•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/18b28733ec14
https://hg.mozilla.org/mozilla-central/rev/893528aa073c
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in
before you can comment on or make changes to this bug.
Description
•