C#: Don't extract expanded assignments and swap child indices for assignments.

This commit is contained in:
Michael Nebel
2026-03-20 12:21:21 +01:00
parent 70d8c1c76e
commit c8169f576f
7 changed files with 33 additions and 97 deletions

View File

@@ -41,11 +41,11 @@ namespace Semmle.Extraction.CSharp.Entities.Expressions
var loc = Context.CreateLocation(init.GetLocation());
var assignment = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.SIMPLE_ASSIGN, objectInitializer, child++, isCompilerGenerated: false, null));
Create(Context, init.Expression, assignment, 0);
Property.Create(Context, property);
var access = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.PROPERTY_ACCESS, assignment, 1, isCompilerGenerated: false, null));
var access = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.PROPERTY_ACCESS, assignment, 0, isCompilerGenerated: false, null));
trapFile.expr_access(access, propEntity);
Create(Context, init.Expression, assignment, 1);
}
}
}