@@ -72,7 +72,12 @@ function prependListener(emitter, event, fn) {
7272 emitter . _events [ event ] = [ fn , emitter . _events [ event ] ] ;
7373}
7474
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.
7681 if ( typeof isDuplex !== 'boolean' )
7782 isDuplex = stream instanceof Stream . Duplex ;
7883
@@ -161,16 +166,11 @@ function Readable(options) {
161166 if ( ! ( this instanceof Readable ) )
162167 return new Readable ( options ) ;
163168
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.
169169 // Checking for a Stream.Duplex instance is faster here instead of inside
170170 // the ReadableState constructor, at least with V8 6.5
171171 const isDuplex = this instanceof Stream . Duplex ;
172172
173- this . _readableState = new ReadableState ( options , isDuplex ) ;
173+ this . _readableState = new ReadableState ( options , this , isDuplex ) ;
174174
175175 // legacy
176176 this . readable = true ;
0 commit comments