4 ms·
It's not that simple, because you can't find where super is called in the general case. Consider: `var foo = { bar: super }; foo['b' + 'a' + 'r']();` - you need
by klntsky 4y ago
It's not that simple, because you can't find where super is called in the general case. Consider: `var foo = { bar: super }; foo['b' + 'a' + 'r']();` - you need to evaluate it in order to define scoping. But JS has lexical scoping as a design choice...
- adrianmsmith 4y agoThis article is about Java, your comment is about JavaScript.
- klntsky 4y agoOoof. Didn't realize it. Still, I believe the same applies, we can't dynamically analyze pointers at the time scoping must be settled.
- int_19h 4y agoWhat does it have to do with pointers? super() in Java is a special language construct, it's not a method that you can have a pointer to. Thus it can be analyzed exactly the same as e.g. definitive variable assignment, and "this" be unavailable on any codepath on which super() has not been definitively called.