@@ -143,15 +143,12 @@ public IAnalyzable AddPackageJson(string filePath, string entryPoint, List<strin
143143
144144 tree . DefaultPackage = entryPoint ;
145145
146- var requireAnalysisUnits = new List < RequireAnalysisUnit > ( ) ;
146+ ProjectEntry projectEntry = null ;
147147 if ( dependencies != null ) {
148- var projectEntry = new ProjectEntry ( this , filePath , null ) ;
149- requireAnalysisUnits . AddRange ( dependencies . Select (
150- dependency => { return new RequireAnalysisUnit ( tree , Modules , projectEntry , dependency ) ;
151- } ) ) ;
148+ projectEntry = new ProjectEntry ( this , filePath , null ) ;
152149 }
153150
154- return new TreeUpdateAnalysis ( tree , requireAnalysisUnits ) ;
151+ return new TreeUpdateAnalysis ( tree , dependencies , projectEntry , Modules ) ;
155152 }
156153
157154 /// <summary>
@@ -162,22 +159,33 @@ public IAnalyzable AddPackageJson(string filePath, string entryPoint, List<strin
162159 [ Serializable ]
163160 internal class TreeUpdateAnalysis : IAnalyzable {
164161 private readonly ModuleTree _tree ;
165- private readonly IEnumerable < RequireAnalysisUnit > _requireAnalysisUnits ;
162+ private readonly IEnumerable < string > _dependencies ;
163+ private readonly ProjectEntry _projectEntry ;
164+ private readonly ModuleTable _modules ;
166165
167- public TreeUpdateAnalysis ( ModuleTree tree , IEnumerable < RequireAnalysisUnit > requireAnalysisUnits = null ) {
166+ public TreeUpdateAnalysis ( ModuleTree tree , IEnumerable < string > dependencies = null , ProjectEntry projectEntry = null , ModuleTable modules = null ) {
168167 _tree = tree ;
169- _requireAnalysisUnits = requireAnalysisUnits ;
168+ _dependencies = dependencies ;
169+ _projectEntry = projectEntry ;
170+ _modules = modules ;
170171 }
171172
172173 public void Analyze ( CancellationToken cancel ) {
173174 if ( _tree != null ) {
174175 _tree . EnqueueDependents ( ) ;
175176 }
176- if ( _requireAnalysisUnits != null ) {
177- foreach ( var unit in _requireAnalysisUnits ) {
177+
178+ if ( _dependencies != null ) {
179+ var requireAnalysisUnits = new List < RequireAnalysisUnit > ( ) ;
180+ requireAnalysisUnits . AddRange ( _dependencies . Select (
181+ dependency => {
182+ return new RequireAnalysisUnit ( _tree , _modules , _projectEntry , dependency ) ;
183+ } ) ) ;
184+
185+ foreach ( var unit in requireAnalysisUnits ) {
178186 unit . AnalyzeWorker ( null , cancel ) ;
179187 }
180- }
188+ }
181189 }
182190 }
183191
0 commit comments