File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77const compareLocations = require ( "./compareLocations" ) ;
88let debugId = 1000 ;
9- const removeAndDo = require ( "./removeAndDo" ) ;
109
1110const byId = ( a , b ) => {
1211 if ( a . id < b . id ) return - 1 ;
@@ -97,15 +96,33 @@ class Chunk {
9796 }
9897
9998 removeModule ( module ) {
100- removeAndDo ( this . modules , module , "removeChunk" , this ) ;
99+ var idx = this . modules . indexOf ( module ) ;
100+ if ( idx >= 0 ) {
101+ this . modules . splice ( idx , 1 ) ;
102+ module . removeChunk ( this ) ;
103+ return true ;
104+ }
105+ return false ;
101106 }
102107
103108 removeChunk ( chunk ) {
104- removeAndDo ( this . chunks , chunk , "removeParent" , this ) ;
109+ var idx = this . chunks . indexOf ( chunk ) ;
110+ if ( idx >= 0 ) {
111+ this . chunks . splice ( idx , 1 ) ;
112+ chunk . removeParent ( this ) ;
113+ return true ;
114+ }
115+ return false ;
105116 }
106117
107118 removeParent ( chunk ) {
108- removeAndDo ( this . parents , chunk , "removeChunk" , this ) ;
119+ var idx = this . parents . indexOf ( chunk ) ;
120+ if ( idx >= 0 ) {
121+ this . parents . splice ( idx , 1 ) ;
122+ chunk . removeChunk ( this ) ;
123+ return true ;
124+ }
125+ return false ;
109126 }
110127
111128 addOrigin ( module , loc ) {
Original file line number Diff line number Diff line change 55var DependenciesBlock = require ( "./DependenciesBlock" ) ;
66var ModuleReason = require ( "./ModuleReason" ) ;
77var Template = require ( "./Template" ) ;
8- var removeAndDo = require ( "./removeAndDo" ) ;
98
109var debugId = 1000 ;
1110
@@ -77,7 +76,13 @@ Module.prototype.addChunk = function(chunk) {
7776} ;
7877
7978Module . prototype . removeChunk = function ( chunk ) {
80- return removeAndDo ( this . chunks , chunk , "removeModule" , this ) ;
79+ var idx = this . chunks . indexOf ( chunk ) ;
80+ if ( idx >= 0 ) {
81+ this . chunks . splice ( idx , 1 ) ;
82+ chunk . removeModule ( this ) ;
83+ return true ;
84+ }
85+ return false ;
8186} ;
8287
8388Module . prototype . addReason = function ( module , dependency ) {
You can’t perform that action at this time.
0 commit comments