Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify check if inheriting from a non-Pjs class
If proto.init is truthy but not a function, like 1 or something, you'll get a TypeError: Object 1 has no method 'apply' which I feel like is excellent behavior. If we're inheriting from a Pjs class but `proto.init` is overridden to a falsy value, we'll think we're inheriting from a non-Pjs class and set `proto.init` to the superclass constructor, which isn't the most defensive, fail-early thing to do, but is also what happened prior to this commit. Really, to be defensive in our non-pjs check, we should check `('init' in proto)`, so if `proto.init` is overridden to anything but a function it'll TypeError like above.
- Loading branch information