@@ -8,39 +8,27 @@ namespace Semmle.Extraction.CSharp.Entities
88 internal abstract class Statement < TSyntax > : Statement where TSyntax : CSharpSyntaxNode
99 {
1010 protected readonly TSyntax Stmt ;
11- private readonly int child ;
12- private readonly Kinds . StmtKind kind ;
13- private readonly IStatementParentEntity parent ;
1411 private readonly Location location ;
1512
16- protected override CSharpSyntaxNode GetStatementSyntax ( ) => Stmt ;
17-
1813 protected Statement ( Context cx , TSyntax stmt , Kinds . StmtKind kind , IStatementParentEntity parent , int child , Location location )
19- : base ( cx )
14+ : base ( cx , kind , parent , child )
2015 {
2116 Stmt = stmt ;
22- this . parent = parent ;
23- this . child = child ;
2417 this . location = location ;
25- this . kind = kind ;
2618 cx . BindComments ( this , location . symbol ) ;
2719 }
2820
21+ protected Statement ( Context cx , TSyntax stmt , Kinds . StmtKind kind , IStatementParentEntity parent , int child )
22+ : this ( cx , stmt , kind , parent , child , cx . CreateLocation ( stmt . FixedLocation ( ) ) ) { }
23+
2924 protected sealed override void Populate ( TextWriter trapFile )
3025 {
31- trapFile . statements ( this , kind ) ;
32- if ( parent . IsTopLevelParent )
33- trapFile . stmt_parent_top_level ( this , child , parent ) ;
34- else
35- trapFile . stmt_parent ( this , child , parent ) ;
26+ base . Populate ( trapFile ) ;
27+
3628 trapFile . stmt_location ( this , location ) ;
37- PopulateStatement ( trapFile ) ;
3829 }
3930
40- protected abstract void PopulateStatement ( TextWriter trapFile ) ;
41-
42- protected Statement ( Context cx , TSyntax stmt , Kinds . StmtKind kind , IStatementParentEntity parent , int child )
43- : this ( cx , stmt , kind , parent , child , cx . CreateLocation ( stmt . FixedLocation ( ) ) ) { }
31+ public override Microsoft . CodeAnalysis . Location ReportingLocation => Stmt . GetLocation ( ) ;
4432
4533 public override string ToString ( ) => Label . ToString ( ) ;
4634 }
0 commit comments