Skip to content

Commit a23b1c4

Browse files
Potential fix for code scanning alert no. 9: Local scope variable shadows member
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Phileco <[email protected]>
1 parent 2d27765 commit a23b1c4

File tree

1 file changed

+3
-3
lines changed
  • csharp/extractor/Semmle.Extraction.CSharp/Entities

1 file changed

+3
-3
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Entities/Field.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ public override void Populate(TextWriter trapFile)
107107
private Expression AddInitializerAssignment(TextWriter trapFile, ExpressionSyntax initializer, Location loc,
108108
string? constValue, ref int child)
109109
{
110-
var type = Symbol.GetAnnotatedType();
111-
var simpleAssignExpr = new Expression(new ExpressionInfo(Context, type, loc, ExprKind.SIMPLE_ASSIGN, this, child++, isCompilerGenerated: true, constValue));
110+
var annotatedType = Symbol.GetAnnotatedType();
111+
var simpleAssignExpr = new Expression(new ExpressionInfo(Context, annotatedType, loc, ExprKind.SIMPLE_ASSIGN, this, child++, isCompilerGenerated: true, constValue));
112112
Expression.CreateFromNode(new ExpressionNodeInfo(Context, initializer, simpleAssignExpr, 0));
113-
var access = new Expression(new ExpressionInfo(Context, type, Location, ExprKind.FIELD_ACCESS, simpleAssignExpr, 1, isCompilerGenerated: true, constValue));
113+
var access = new Expression(new ExpressionInfo(Context, annotatedType, Location, ExprKind.FIELD_ACCESS, simpleAssignExpr, 1, isCompilerGenerated: true, constValue));
114114
trapFile.expr_access(access, this);
115115
return access;
116116
}

0 commit comments

Comments
 (0)