Skip to content

Commit a198f53

Browse files
committed
C#: Extract compound operator assignments as is.
1 parent 68dfa5c commit a198f53

File tree

1 file changed

+4
-7
lines changed
  • csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions

1 file changed

+4
-7
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Assignment.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,12 @@ public static Assignment Create(ExpressionNodeInfo info)
2323
protected override void PopulateExpression(TextWriter trapFile)
2424
{
2525
var operatorKind = OperatorKind;
26+
// TODO: THIS CHECK CAN BE SIMPLIFIED - As we now always consider this to be an operator invocation.
2627
if (operatorKind.HasValue)
2728
{
28-
// Convert assignment such as `a += b` into `a = a + b`.
29-
var simpleAssignExpr = new Expression(new ExpressionInfo(Context, Type, Location, ExprKind.SIMPLE_ASSIGN, this, 2, isCompilerGenerated: true, null));
30-
Create(Context, Syntax.Left, simpleAssignExpr, 1);
31-
var opexpr = new Expression(new ExpressionInfo(Context, Type, Location, operatorKind.Value, simpleAssignExpr, 0, isCompilerGenerated: true, null));
32-
Create(Context, Syntax.Left, opexpr, 0, isCompilerGenerated: true);
33-
Create(Context, Syntax.Right, opexpr, 1);
34-
opexpr.OperatorCall(trapFile, Syntax);
29+
Create(Context, Syntax.Left, this, 0);
30+
Create(Context, Syntax.Right, this, 1);
31+
OperatorCall(trapFile, Syntax);
3532
}
3633
else
3734
{

0 commit comments

Comments
 (0)