Skip to main content

native_parent

Function native_parent 

Source
pub fn native_parent(ctor: &str) -> Option<&'static str>
Expand description

The method names a native instance tagged tag carries, as (its own list, the EventEmitter surface it also gets or empty).

Split out of instance_has_method so the same table can be enumerated, not only queried: host::ensure_ctor_proto builds a native constructor’s real .prototype object from it. A predicate alone would have forced a second, hand-maintained list of the same names — the drift that put listeners on nine dispatchers and not on the three that run. The native class whose prototype ctor’s prototype inherits from, if any.

Only the stream hierarchy has one: node’s is Readable/Writable/Duplex/Transform/PassThrough → Stream → EventEmitter, and every prototype used to hang straight off Object.prototype instead, so new Readable() instanceof Stream and instanceof EventEmitter both read false and an ES5 subclass built on Object.create(Stream.prototype) inherited nothing.