class A {
foo() { return 1; }
}
class B extends A {
foo() { return 2; }
bar() {
console.log(super.foo());
return class {
[super.foo()]() {
return 100;
}
}
}
}
let x = new B().bar();
let y = new x();
console.log(y[1]())
This is legal ES6 code and it should not error