Fix labeled stmt factory method parameter types

This commit is contained in:
Tamas Vajk
2020-12-08 11:22:34 +01:00
parent 6a4b54ec89
commit b79d5ab44b

View File

@@ -6,17 +6,18 @@ namespace Semmle.Extraction.CSharp.Entities.Statements
{
internal class Labeled : Statement<LabeledStatementSyntax>
{
private readonly Statement parent;
private readonly IStatementParentEntity parent;
private readonly int child;
private Statement labelledStmt;
private Labeled(Context cx, LabeledStatementSyntax stmt, Statement parent, int child)
private Labeled(Context cx, LabeledStatementSyntax stmt, IStatementParentEntity parent, int child)
: base(cx, stmt, StmtKind.LABEL, parent, child)
{
this.parent = parent;
this.child = child;
}
public static Labeled Create(Context cx, LabeledStatementSyntax node, Statement parent, int child)
public static Labeled Create(Context cx, LabeledStatementSyntax node, IStatementParentEntity parent, int child)
{
var ret = new Labeled(cx, node, parent, child);
ret.TryPopulate();
@@ -27,13 +28,11 @@ namespace Semmle.Extraction.CSharp.Entities.Statements
{
trapFile.exprorstmt_name(this, Stmt.Identifier.ToString());
// For compatilibty with the Mono extractor, make insert the labelled statement into the same block
// For compatibility with the Mono extractor, make insert the labelled statement into the same block
// as this one. The parent MUST be a block statement.
labelledStmt = Statement.Create(cx, Stmt.Statement, parent, child + 1);
}
private Statement labelledStmt;
public override int NumberOfStatements => 1 + labelledStmt.NumberOfStatements;
}
}