23
23
24
24
const {
25
25
ArrayIsArray,
26
+ ArrayPrototypeIndexOf,
27
+ ArrayPrototypePush,
28
+ ArrayPrototypeSplice,
26
29
Boolean,
27
30
Error,
31
+ FunctionPrototype,
32
+ FunctionPrototypeCall,
28
33
Number,
29
34
NumberIsNaN,
30
35
NumberParseInt,
@@ -127,7 +132,7 @@ const DEFAULT_IPV6_ADDR = '::';
127
132
128
133
const isWindows = process . platform === 'win32' ;
129
134
130
- function noop ( ) { }
135
+ const noop = FunctionPrototype ;
131
136
132
137
function getFlags ( ipv6Only ) {
133
138
return ipv6Only === true ? TCPConstants . UV_TCP_IPV6ONLY : 0 ;
@@ -300,7 +305,7 @@ function Socket(options) {
300
305
options . autoDestroy = true ;
301
306
// Handle strings directly.
302
307
options . decodeStrings = false ;
303
- stream . Duplex . call ( this , options ) ;
308
+ ReflectApply ( stream . Duplex , this , [ options ] ) ;
304
309
305
310
if ( options . handle ) {
306
311
this . _handle = options . handle ; // private
@@ -581,7 +586,7 @@ Socket.prototype._read = function(n) {
581
586
582
587
583
588
Socket . prototype . end = function ( data , encoding , callback ) {
584
- stream . Duplex . prototype . end . call ( this , data , encoding , callback ) ;
589
+ ReflectApply ( stream . Duplex . prototype . end , this , [ data , encoding , callback ] ) ;
585
590
DTRACE_NET_STREAM_END ( this ) ;
586
591
return this ;
587
592
} ;
@@ -597,7 +602,7 @@ Socket.prototype.pause = function() {
597
602
this . destroy ( errnoException ( err , 'read' ) ) ;
598
603
}
599
604
}
600
- return stream . Duplex . prototype . pause . call ( this ) ;
605
+ return FunctionPrototypeCall ( stream . Duplex . prototype . pause , this ) ;
601
606
} ;
602
607
603
608
@@ -606,7 +611,7 @@ Socket.prototype.resume = function() {
606
611
! this . _handle . reading ) {
607
612
tryReadStart ( this ) ;
608
613
}
609
- return stream . Duplex . prototype . resume . call ( this ) ;
614
+ return FunctionPrototypeCall ( stream . Duplex . prototype . resume , this ) ;
610
615
} ;
611
616
612
617
@@ -615,7 +620,7 @@ Socket.prototype.read = function(n) {
615
620
! this . _handle . reading ) {
616
621
tryReadStart ( this ) ;
617
622
}
618
- return stream . Duplex . prototype . read . call ( this , n ) ;
623
+ return ReflectApply ( stream . Duplex . prototype . read , this , [ n ] ) ;
619
624
} ;
620
625
621
626
@@ -1148,7 +1153,7 @@ function Server(options, connectionListener) {
1148
1153
if ( ! ( this instanceof Server ) )
1149
1154
return new Server ( options , connectionListener ) ;
1150
1155
1151
- EventEmitter . call ( this ) ;
1156
+ FunctionPrototypeCall ( EventEmitter , this ) ;
1152
1157
1153
1158
if ( typeof options === 'function' ) {
1154
1159
connectionListener = options ;
@@ -1659,10 +1664,10 @@ ObjectDefineProperty(Socket.prototype, '_handle', {
1659
1664
1660
1665
Server . prototype . _setupWorker = function ( socketList ) {
1661
1666
this . _usingWorkers = true ;
1662
- this . _workers . push ( socketList ) ;
1667
+ ArrayPrototypePush ( this . _workers , socketList ) ;
1663
1668
socketList . once ( 'exit' , ( socketList ) => {
1664
- const index = this . _workers . indexOf ( socketList ) ;
1665
- this . _workers . splice ( index , 1 ) ;
1669
+ const index = ArrayPrototypeIndexOf ( this . _workers , socketList ) ;
1670
+ ArrayPrototypeSplice ( this . _workers , index , 1 ) ;
1666
1671
} ) ;
1667
1672
} ;
1668
1673
0 commit comments