Today I saw a V8 test case [1] which took me a long time to figure out why it
runs like this:
class Test {
m() {
super.length = 10; // `super.length' here has the same effect as
`this.length'
console.log(super.length); // but `super.length' here is
`Test.prototype.__proto__.length' (i.e. `Object.prototype.length') which still
remains `undefined'
}
}
var array = [];
Test.prototype.m.call(array);
assertEquals(10, array.length);
This syntax is so confusing and I couldn't think of any real use case for it,
so should we make `SuperProperty = AssignmentExpression' an early error?
Also, I found an old es-bug thread [2] discussed about this.
[1]
https://chromium.googlesource.com/v8/v8/+/77e30f013a221527bb4ab955188aec44f10fee7f/test/mjsunit/es6/classes-super.js
[2] https://bugs.ecmascript.org/show_bug.cgi?id=3246
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss