* Inherit the prototype methods from one constructor into another. * * The Function.prototype.inherits from lang.js rewritten as a standalone * function (not on Function.prototype). NOTE: If this file is to be loaded * during bootstrapping this function needs to be rewritten using some native *
(ctor, superCtor)
| 341 | * the super constructor lacks a prototype. |
| 342 | */ |
| 343 | function inherits(ctor, superCtor) { |
| 344 | |
| 345 | if (ctor === undefined || ctor === null) |
| 346 | throw new ERR_INVALID_ARG_TYPE('ctor', 'Function', ctor); |
| 347 | |
| 348 | if (superCtor === undefined || superCtor === null) |
| 349 | throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function', superCtor); |
| 350 | |
| 351 | if (superCtor.prototype === undefined) { |
| 352 | throw new ERR_INVALID_ARG_TYPE('superCtor.prototype', |
| 353 | 'Object', superCtor.prototype); |
| 354 | } |
| 355 | ObjectDefineProperty(ctor, 'super_', { |
| 356 | __proto__: null, |
| 357 | value: superCtor, |
| 358 | writable: true, |
| 359 | configurable: true, |
| 360 | }); |
| 361 | ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype); |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * @deprecated since v6.0.0 |
no outgoing calls
no test coverage detected