Skip to content

Commit 0feffff

Browse files
BridgeARrefack
authored andcommitted
lib: use ES6 class inheritance style
PR-URL: nodejs#24755 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent 2f443fd commit 0feffff

26 files changed

+43
-0
lines changed

lib/_http_agent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ function Agent(options) {
106106
});
107107
}
108108
Object.setPrototypeOf(Agent.prototype, EventEmitter.prototype);
109+
Object.setPrototypeOf(Agent, EventEmitter);
109110

110111
Agent.defaultMaxSockets = Infinity;
111112

lib/_http_client.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ function ClientRequest(input, options, cb) {
280280
this._deferToConnect(null, null, () => this._flush());
281281
}
282282
Object.setPrototypeOf(ClientRequest.prototype, OutgoingMessage.prototype);
283+
Object.setPrototypeOf(ClientRequest, OutgoingMessage);
283284

284285
ClientRequest.prototype._finish = function _finish() {
285286
DTRACE_HTTP_CLIENT_REQUEST(this, this.connection);

lib/_http_incoming.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function IncomingMessage(socket) {
7272
this._dumped = false;
7373
}
7474
Object.setPrototypeOf(IncomingMessage.prototype, Stream.Readable.prototype);
75+
Object.setPrototypeOf(IncomingMessage, Stream.Readable);
7576

7677
IncomingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
7778
if (callback)

lib/_http_outgoing.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ function OutgoingMessage() {
107107
this._onPendingData = noopPendingOutput;
108108
}
109109
Object.setPrototypeOf(OutgoingMessage.prototype, Stream.prototype);
110+
Object.setPrototypeOf(OutgoingMessage, Stream);
110111

111112

112113
Object.defineProperty(OutgoingMessage.prototype, '_headers', {

lib/_http_server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ function ServerResponse(req) {
138138
}
139139
}
140140
Object.setPrototypeOf(ServerResponse.prototype, OutgoingMessage.prototype);
141+
Object.setPrototypeOf(ServerResponse, OutgoingMessage);
141142

142143
ServerResponse.prototype._finish = function _finish() {
143144
DTRACE_HTTP_SERVER_RESPONSE(this.connection);

lib/_stream_duplex.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const Readable = require('_stream_readable');
3232
const Writable = require('_stream_writable');
3333

3434
Object.setPrototypeOf(Duplex.prototype, Readable.prototype);
35+
Object.setPrototypeOf(Duplex, Readable);
3536

3637
{
3738
// Allow the keys array to be GC'ed.

lib/_stream_passthrough.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module.exports = PassThrough;
2929

3030
const Transform = require('_stream_transform');
3131
Object.setPrototypeOf(PassThrough.prototype, Transform.prototype);
32+
Object.setPrototypeOf(PassThrough, Transform);
3233

3334
function PassThrough(options) {
3435
if (!(this instanceof PassThrough))

lib/_stream_readable.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ let StringDecoder;
4545
let createReadableStreamAsyncIterator;
4646

4747
Object.setPrototypeOf(Readable.prototype, Stream.prototype);
48+
Object.setPrototypeOf(Readable, Stream);
4849

4950
const { errorOrDestroy } = destroyImpl;
5051
const kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];

lib/_stream_transform.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const {
7272
} = require('internal/errors').codes;
7373
const Duplex = require('_stream_duplex');
7474
Object.setPrototypeOf(Transform.prototype, Duplex.prototype);
75+
Object.setPrototypeOf(Transform, Duplex);
7576

7677

7778
function afterTransform(er, data) {

lib/_stream_writable.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const {
4747
const { errorOrDestroy } = destroyImpl;
4848

4949
Object.setPrototypeOf(Writable.prototype, Stream.prototype);
50+
Object.setPrototypeOf(Writable, Stream);
5051

5152
function nop() {}
5253

0 commit comments

Comments
 (0)