Skip to content

Commit ebbde9e

Browse files
Merge branch 'main' into alert-autofix-14
Signed-off-by: Phileco <[email protected]>
2 parents f8067de + 658011c commit ebbde9e

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
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
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public override void Populate(TextWriter trapFile)
4444
PopulateNullability(trapFile, Symbol.GetAnnotatedType());
4545
PopulateRefKind(trapFile, Symbol.RefKind);
4646

47-
var type = Type;
48-
trapFile.properties(this, Symbol.GetName(), ContainingType!, type.TypeRef, Create(Context, Symbol.OriginalDefinition));
47+
var propertyType = Type;
48+
trapFile.properties(this, Symbol.GetName(), ContainingType!, propertyType.TypeRef, Create(Context, Symbol.OriginalDefinition));
4949

5050
var getter = BodyDeclaringSymbol.GetMethod;
5151
var setter = BodyDeclaringSymbol.SetMethod;

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

+3-10
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ private TypeMention(Context cx, TypeSyntax syntax, IEntity parent, Type type, Mi
2222
this.loc = loc;
2323
}
2424

25-
private TypeSyntax GetArrayElementType(TypeSyntax type)
25+
private TypeSyntax GetArrayElementType(TypeSyntax typeSyntax)
2626
{
27-
switch (type)
27+
switch (typeSyntax)
2828
{
2929
case ArrayTypeSyntax ats:
3030
return GetArrayElementType(ats.ElementType);
@@ -37,7 +37,7 @@ private TypeSyntax GetArrayElementType(TypeSyntax type)
3737
case PointerTypeSyntax pts:
3838
return GetArrayElementType(pts.ElementType);
3939
default:
40-
return type;
40+
return typeSyntax;
4141
}
4242
}
4343

@@ -117,13 +117,6 @@ protected override void Populate(TextWriter trapFile)
117117
return;
118118
}
119119
}
120-
121-
private void Emit(TextWriter trapFile, Microsoft.CodeAnalysis.Location loc, IEntity parent, Type localType)
122-
{
123-
trapFile.type_mention(this, localType.TypeRef, parent);
124-
trapFile.type_mention_location(this, Context.CreateLocation(loc));
125-
}
126-
127120
public static TypeMention Create(Context cx, TypeSyntax syntax, IEntity parent, Type type, Microsoft.CodeAnalysis.Location? loc = null)
128121
{
129122
var ret = new TypeMention(cx, syntax, parent, type, loc);

0 commit comments

Comments
 (0)