@@ -72,7 +72,12 @@ function prependListener(emitter, event, fn) {
72
72
emitter . _events [ event ] = [ fn , emitter . _events [ event ] ] ;
73
73
}
74
74
75
- function ReadableState ( options , isDuplex ) {
75
+ function ReadableState ( options , stream , isDuplex ) {
76
+ // Duplex streams are both readable and writable, but share
77
+ // the same options object.
78
+ // However, some cases require setting options to different
79
+ // values for the readable and the writable sides of the duplex stream.
80
+ // These options can be provided separately as readableXXX and writableXXX.
76
81
if ( typeof isDuplex !== 'boolean' )
77
82
isDuplex = stream instanceof Stream . Duplex ;
78
83
@@ -161,16 +166,11 @@ function Readable(options) {
161
166
if ( ! ( this instanceof Readable ) )
162
167
return new Readable ( options ) ;
163
168
164
- // Duplex streams are both readable and writable, but share
165
- // the same options object.
166
- // However, some cases require setting options to different
167
- // values for the readable and the writable sides of the duplex stream.
168
- // These options can be provided separately as readableXXX and writableXXX.
169
169
// Checking for a Stream.Duplex instance is faster here instead of inside
170
170
// the ReadableState constructor, at least with V8 6.5
171
171
const isDuplex = this instanceof Stream . Duplex ;
172
172
173
- this . _readableState = new ReadableState ( options , isDuplex ) ;
173
+ this . _readableState = new ReadableState ( options , this , isDuplex ) ;
174
174
175
175
// legacy
176
176
this . readable = true ;
0 commit comments