@@ -190,37 +190,29 @@ private void DoExtractTree(SyntaxTree tree)
190190 var transformedSourcePath = PathTransformer . Transform ( sourcePath ) ;
191191
192192 var trapPath = transformedSourcePath . GetTrapPath ( Logger , options . TrapCompression ) ;
193- var upToDate = false ;
194-
195- // compilation.Clone() is used to allow symbols to be garbage collected.
196193 using var trapWriter = transformedSourcePath . CreateTrapWriter ( Logger , options . TrapCompression , discardDuplicates : false ) ;
197194
198- upToDate = FileIsUpToDate ( sourcePath , trapWriter . TrapFile ) ;
199-
200195 var currentTaskId = IncrementTaskCount ( ) ;
201196 ReportProgressTaskStarted ( currentTaskId , sourcePath ) ;
202197
203- if ( ! upToDate )
198+ var cx = new Context ( ExtractionContext , compilation , trapWriter , new SourceScope ( tree ) , addAssemblyTrapPrefix ) ;
199+ // Ensure that the file itself is populated in case the source file is totally empty
200+ var root = tree . GetRoot ( ) ;
201+ Entities . File . Create ( cx , root . SyntaxTree . FilePath ) ;
202+
203+ var csNode = ( CSharpSyntaxNode ) root ;
204+ var directiveVisitor = new DirectiveVisitor ( cx ) ;
205+ csNode . Accept ( directiveVisitor ) ;
206+ foreach ( var branch in directiveVisitor . BranchesTaken )
204207 {
205- var cx = new Context ( ExtractionContext , compilation , trapWriter , new SourceScope ( tree ) , addAssemblyTrapPrefix ) ;
206- // Ensure that the file itself is populated in case the source file is totally empty
207- var root = tree . GetRoot ( ) ;
208- Entities . File . Create ( cx , root . SyntaxTree . FilePath ) ;
209-
210- var csNode = ( CSharpSyntaxNode ) root ;
211- var directiveVisitor = new DirectiveVisitor ( cx ) ;
212- csNode . Accept ( directiveVisitor ) ;
213- foreach ( var branch in directiveVisitor . BranchesTaken )
214- {
215- cx . TrapStackSuffix . Add ( branch ) ;
216- }
217- csNode . Accept ( new CompilationUnitVisitor ( cx ) ) ;
218- cx . PopulateAll ( ) ;
219- CommentPopulator . ExtractCommentBlocks ( cx , cx . CommentGenerator ) ;
220- cx . PopulateAll ( ) ;
208+ cx . TrapStackSuffix . Add ( branch ) ;
221209 }
210+ csNode . Accept ( new CompilationUnitVisitor ( cx ) ) ;
211+ cx . PopulateAll ( ) ;
212+ CommentPopulator . ExtractCommentBlocks ( cx , cx . CommentGenerator ) ;
213+ cx . PopulateAll ( ) ;
222214
223- ReportProgressTaskDone ( currentTaskId , sourcePath , trapPath , stopwatch . Elapsed , upToDate ? AnalysisAction . UpToDate : AnalysisAction . Extracted ) ;
215+ ReportProgressTaskDone ( currentTaskId , sourcePath , trapPath , stopwatch . Elapsed , AnalysisAction . Extracted ) ;
224216 }
225217 catch ( Exception ex ) // lgtm[cs/catch-of-all-exceptions]
226218 {
0 commit comments