Skip to content

Commit b3d5e40

Browse files
committed
C#: Fix violations
1 parent 97522c5 commit b3d5e40

File tree

3 files changed

+7
-33
lines changed

3 files changed

+7
-33
lines changed

csharp/extractor/Semmle.Extraction.CIL/Factories.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public T Populate<T>(T e) where T : ILabelledEntity
5656
}
5757

5858
#if DEBUG_LABELS
59-
Dictionary<string, ILabelledEntity> debugLabels = new Dictionary<string, ILabelledEntity>();
59+
private readonly Dictionary<string, ILabelledEntity> debugLabels = new Dictionary<string, ILabelledEntity>();
6060
#endif
6161

6262
public IExtractedEntity Create(Handle h)
@@ -66,7 +66,7 @@ public IExtractedEntity Create(Handle h)
6666
}
6767

6868
// Lazily cache primitive types.
69-
PrimitiveType[] primitiveTypes = new PrimitiveType[(int)PrimitiveTypeCode.Object + 1];
69+
private readonly PrimitiveType[] primitiveTypes = new PrimitiveType[(int)PrimitiveTypeCode.Object + 1];
7070

7171
public PrimitiveType Create(PrimitiveTypeCode code)
7272
{

csharp/extractor/Semmle.Extraction/FreshEntity.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ public string DebugTuples
4343
{
4444
get
4545
{
46-
var writer = new StringWriter();
47-
Populate(writer);
48-
return writer.ToString();
46+
using (var writer = new StringWriter())
47+
{
48+
Populate(writer);
49+
return writer.ToString();
50+
}
4951
}
5052
}
5153

csharp/extractor/Semmle.Extraction/Id.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -103,34 +103,6 @@ public void AppendTo(TextWriter tb)
103103
tb.Write(TrapBuilder.ToString());
104104
tb.Write("\"");
105105
}
106-
107-
class IdTrapBuilder
108-
{
109-
public readonly List<string> Fragments = new List<string>();
110-
111-
public void Append(object arg)
112-
{
113-
if (arg is IEntity)
114-
{
115-
var key = ((IEntity)arg).Label;
116-
Fragments.Add("{#");
117-
Fragments.Add(key.Value.ToString());
118-
Fragments.Add("}");
119-
}
120-
else
121-
Fragments.Add(arg.ToString());
122-
}
123-
124-
public void Append(string arg)
125-
{
126-
Fragments.Add(arg);
127-
}
128-
129-
public void AppendLine()
130-
{
131-
throw new NotImplementedException();
132-
}
133-
}
134106
}
135107

136108
/// <summary>

0 commit comments

Comments
 (0)