2323
2424const  { 
2525  ArrayIsArray, 
26+   ArrayPrototypeIndexOf, 
27+   ArrayPrototypePush, 
28+   ArrayPrototypeSplice, 
2629  Boolean, 
2730  Error, 
31+   FunctionPrototype, 
32+   FunctionPrototypeCall, 
2833  Number, 
2934  NumberIsNaN, 
3035  NumberParseInt, 
3136  ObjectDefineProperty, 
3237  ObjectSetPrototypeOf, 
38+   ReflectApply, 
3339  Symbol, 
3440}  =  primordials ; 
3541
@@ -123,7 +129,7 @@ const DEFAULT_IPV6_ADDR = '::';
123129
124130const  isWindows  =  process . platform  ===  'win32' ; 
125131
126- function  noop ( )   { } 
132+ const  noop   =   FunctionPrototype ; 
127133
128134function  getFlags ( ipv6Only )  { 
129135  return  ipv6Only  ===  true  ? TCPConstants . UV_TCP_IPV6ONLY  : 0 ; 
@@ -298,7 +304,7 @@ function Socket(options) {
298304  options . autoDestroy  =  false ; 
299305  // Handle strings directly. 
300306  options . decodeStrings  =  false ; 
301-   stream . Duplex . call ( this ,  options ) ; 
307+   ReflectApply ( stream . Duplex ,   this ,  [ options ] ) ; 
302308
303309  // Default to *not* allowing half open sockets. 
304310  this . allowHalfOpen  =  Boolean ( allowHalfOpen ) ; 
@@ -588,7 +594,7 @@ Socket.prototype._read = function(n) {
588594
589595
590596Socket . prototype . end  =  function ( data ,  encoding ,  callback )  { 
591-   stream . Duplex . prototype . end . call ( this ,  data ,  encoding ,  callback ) ; 
597+   ReflectApply ( stream . Duplex . prototype . end ,   this ,  [ data ,  encoding ,  callback ] ) ; 
592598  DTRACE_NET_STREAM_END ( this ) ; 
593599  return  this ; 
594600} ; 
@@ -604,7 +610,7 @@ Socket.prototype.pause = function() {
604610        this . destroy ( errnoException ( err ,  'read' ) ) ; 
605611    } 
606612  } 
607-   return  stream . Duplex . prototype . pause . call ( this ) ; 
613+   return  FunctionPrototypeCall ( stream . Duplex . prototype . pause ,   this ) ; 
608614} ; 
609615
610616
@@ -613,7 +619,7 @@ Socket.prototype.resume = function() {
613619      ! this . _handle . reading )  { 
614620    tryReadStart ( this ) ; 
615621  } 
616-   return  stream . Duplex . prototype . resume . call ( this ) ; 
622+   return  FunctionPrototypeCall ( stream . Duplex . prototype . resume ,   this ) ; 
617623} ; 
618624
619625
@@ -622,7 +628,7 @@ Socket.prototype.read = function(n) {
622628      ! this . _handle . reading )  { 
623629    tryReadStart ( this ) ; 
624630  } 
625-   return  stream . Duplex . prototype . read . call ( this ,  n ) ; 
631+   return  ReflectApply ( stream . Duplex . prototype . read ,   this ,  [ n ] ) ; 
626632} ; 
627633
628634
@@ -1161,7 +1167,7 @@ function Server(options, connectionListener) {
11611167  if  ( ! ( this  instanceof  Server ) ) 
11621168    return  new  Server ( options ,  connectionListener ) ; 
11631169
1164-   EventEmitter . call ( this ) ; 
1170+   FunctionPrototypeCall ( EventEmitter ,   this ) ; 
11651171
11661172  if  ( typeof  options  ===  'function' )  { 
11671173    connectionListener  =  options ; 
@@ -1687,10 +1693,10 @@ ObjectDefineProperty(Socket.prototype, '_handle', {
16871693
16881694Server . prototype . _setupWorker  =  function ( socketList )  { 
16891695  this . _usingWorkers  =  true ; 
1690-   this . _workers . push ( socketList ) ; 
1696+   ArrayPrototypePush ( this . _workers ,   socketList ) ; 
16911697  socketList . once ( 'exit' ,  ( socketList )  =>  { 
1692-     const  index  =  this . _workers . indexOf ( socketList ) ; 
1693-     this . _workers . splice ( index ,  1 ) ; 
1698+     const  index  =  ArrayPrototypeIndexOf ( this . _workers ,   socketList ) ; 
1699+     ArrayPrototypeSplice ( this . _workers ,   index ,  1 ) ; 
16941700  } ) ; 
16951701} ; 
16961702
0 commit comments