Closed Bug 1230710 Opened 10 years ago Closed 10 years ago

Reenable arrow functions and eval inside derived class constructors

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: efaust, Assigned: efaust)

References

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
Thanks to Jan, this should just work. the patch was pretty straightforward.
Attachment #8696150 - Flags: review?(shu)
Attachment #8696150 - Flags: review?(jorendorff)
Assignee: nobody → efaustbmo
Status: NEW → ASSIGNED
Blocks: 1169734
Comment on attachment 8696150 [details] [diff] [review] Patch Review of attachment 8696150 [details] [diff] [review]: ----------------------------------------------------------------- nice. ::: js/src/frontend/BytecodeEmitter.cpp @@ +3451,5 @@ > + // Handle the eval case. Only accept the strict variant, as eval in a > + // derived class constructor must be strict. > + if (setOp == JSOP_STRICTSETNAME) { > + if (!emitAtomOp(name, JSOP_GETNAME)) > + return false; Do you know how we prevent `with ({".this": blah})` from capturing this GETNAME? Test? ::: js/src/vm/Interpreter-inl.h @@ +205,5 @@ > } > > + // We do our own explicit checking for |this| > + if (name == cx->names().dotThis) > + return true; The comment should say "The bytecode" rather than "We" ...I guess I kind of wish we did it the other way, got rid of JSOP_CHECKTHISREINIT, and just use JSOP_CHECKLEXICAL and CHECKALIASEDLEXICAL, and the CheckUninitializedLexical call below. Go ahead and take the benefit of `.this` being less special. Your call though.
Attachment #8696150 - Flags: review?(jorendorff) → review+
Comment on attachment 8696150 [details] [diff] [review] Patch Review of attachment 8696150 [details] [diff] [review]: ----------------------------------------------------------------- This looks fine to me. Just fine. ::: js/src/frontend/BytecodeEmitter.cpp @@ +3451,5 @@ > + // Handle the eval case. Only accept the strict variant, as eval in a > + // derived class constructor must be strict. > + if (setOp == JSOP_STRICTSETNAME) { > + if (!emitAtomOp(name, JSOP_GETNAME)) > + return false; In response to Jason's question, there's special magic in WithObjects to prevent .this from leaking into the scope. ::: js/src/vm/Interpreter-inl.h @@ +205,5 @@ > } > > + // We do our own explicit checking for |this| > + if (name == cx->names().dotThis) > + return true; Also in response to Jason's comment. I don't care too much either way. More uniformity the better, sure, but better error messages for "this" TDZ errors already demand some specialty.
Attachment #8696150 - Flags: review?(shu) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: