Closed Bug 1535471 Opened 5 years ago Closed 5 years ago

Class field initializers need to use JSOP_INITPROP and friends, not JSOP_SETPROP

Categories

(Core :: JavaScript Engine, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: jorendorff, Assigned: khyperia)

References

Details

Attachments

(1 file)

Initializing properties should never trigger base-class setters, like:

let id = Symbol();

class Base {
  set x(v) { throw new Error("failed"); }
  set [id](v) { throw new Error("failed"); }
}

class X extends Base {
  x = 1;
  [id] = 2;
}

let x = new X();
assertEq(x.x, 1);
assertEq(x[id], 2);

Right now, we're using JSOP_SETPROP in the initializer for the field x; that needs to be JSOP_INITPROP (but check the spec to make sure). Or in the indexed-property or computed-property-name case, JSOP_INITELEM.

Priority: -- → P1
Assignee: nobody → khyperia
Status: NEW → ASSIGNED
Pushed by ahauck@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8457ce7cc442
Use JSOP_INITPROP for field initializers. r=jorendorff
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: