google/CodeCity

Overriding a method in code editor results in shared .prototype object

Closed this issue · 1 comments

If Object.getPrototypeOf(child) === parent, and parent.method is a function but child.method does not exist, then editing child.method in the code editor will result in child.method being created, but with the unfortunate side effect that child.method.prototype === parent.method.prototype.

In most cases this is kind of innocuous (because rarely do these method .prototype objects have any properties other than .constructor, and that property is rarely used, and nor do we typically invoke new obj.Class where .Class might override or be overridden), but it is certainly not correct or desirable, and could lead to considerable confusion.

Fixed in database. PR for update to core/ coming.