Skip to content

Commit c63c699

Browse files
Make readonly
1 parent c4a884e commit c63c699

13 files changed

Lines changed: 17 additions & 17 deletions

CodeConverter/CSharp/ExpressionNodeVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ internal class ExpressionNodeVisitor : VBasic.VisualBasicSyntaxVisitor<Task<CSha
4040
private readonly Lazy<IDictionary<ITypeSymbol, string>> _convertMethodsLookupByReturnType;
4141
private readonly Compilation _csCompilation;
4242
private readonly LambdaConverter _lambdaConverter;
43-
private INamedTypeSymbol _vbBooleanTypeSymbol;
43+
private readonly INamedTypeSymbol _vbBooleanTypeSymbol;
4444

4545
public ExpressionNodeVisitor(SemanticModel semanticModel,
4646
VisualBasicEqualityComparison visualBasicEqualityComparison,

CodeConverter/CSharp/MethodBodyExecutableStatementVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal class MethodBodyExecutableStatementVisitor : VBasic.VisualBasicSyntaxVi
3131
private readonly MethodsWithHandles _methodsWithHandles;
3232
private readonly HashSet<string> _generatedNames = new HashSet<string>();
3333
private readonly HashSet<VBSyntax.StatementSyntax> _redundantSourceStatements = new HashSet<VBSyntax.StatementSyntax>();
34-
private INamedTypeSymbol _vbBooleanTypeSymbol;
34+
private readonly INamedTypeSymbol _vbBooleanTypeSymbol;
3535
private readonly HashSet<ILocalSymbol> _localsToInlineInLoop;
3636

3737
public bool IsIterator { get; set; }

CodeConverter/CSharp/MethodWithHandles.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace ICSharpCode.CodeConverter.CSharp
1313
{
1414
internal class MethodWithHandles
1515
{
16-
private IdentifierNameSyntax _methodId;
16+
private readonly IdentifierNameSyntax _methodId;
1717
private readonly SyntaxGenerator _csSyntaxGenerator;
1818

1919
public SyntaxToken MethodCSharpId { get; }

CodeConverter/CSharp/MethodsWithHandles.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ namespace ICSharpCode.CodeConverter.CSharp
1212
/// </summary>
1313
internal class MethodsWithHandles
1414
{
15-
private List<MethodWithHandles> _methodWithHandleses;
16-
private ILookup<string, MethodWithHandles> _handledMethodsFromPropertyWithEventName;
15+
private readonly List<MethodWithHandles> _methodWithHandleses;
16+
private readonly ILookup<string, MethodWithHandles> _handledMethodsFromPropertyWithEventName;
1717

1818

1919
public MethodsWithHandles(List<MethodWithHandles> methodWithHandleses, ILookup<string, MethodWithHandles> handledMethodsFromPropertyWithEventName)

CodeConverter/CSharp/ProjectExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ICSharpCode.CodeConverter.CSharp
88
{
99
internal static class ProjectExtensions
1010
{
11-
private static char[] DirSeparators = new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar };
11+
private static readonly char[] DirSeparators = new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar };
1212

1313
public static Project CreateReferenceOnlyProjectFromAnyOptions(this Project project, CompilationOptions baseOptions, ParseOptions parseOptions)
1414
{

CodeConverter/CSharp/QueryConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace ICSharpCode.CodeConverter.CSharp
1919
internal class QueryConverter
2020
{
2121
private readonly CommentConvertingVisitorWrapper _triviaConvertingVisitor;
22-
private SemanticModel _semanticModel;
22+
private readonly SemanticModel _semanticModel;
2323

2424
public QueryConverter(CommonConversions commonConversions, SemanticModel semanticModel, CommentConvertingVisitorWrapper triviaConvertingExpressionVisitor)
2525
{

CodeConverter/Shared/DefaultReferences.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static class DefaultReferences
3535
new[] { Assembly.Load("System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") }
3636
).ToArray();
3737

38-
private static Dictionary<string, (string Location, string[] ReferenceNames)> _assemblyInfoCache = new Dictionary<string, (string Location, string[] ReferenceNames)>();
38+
private static readonly Dictionary<string, (string Location, string[] ReferenceNames)> _assemblyInfoCache = new Dictionary<string, (string Location, string[] ReferenceNames)>();
3939

4040
public static IReadOnlyCollection<PortableExecutableReference> NetStandard2 { get; } =
4141
With(Enumerable.Empty<Assembly>()).ToArray();

CodeConverter/Util/FromRoslyn/SpecializedCollections.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ private static partial class Singleton
517517
{
518518
internal sealed class Collection<T> : ICollection<T>, IReadOnlyCollection<T>
519519
{
520-
private T _loneValue;
520+
private readonly T _loneValue;
521521

522522
public Collection(T value)
523523
{
@@ -569,7 +569,7 @@ IEnumerator IEnumerable.GetEnumerator()
569569
}
570570
internal class Enumerator<T> : IEnumerator<T>
571571
{
572-
private T _loneValue;
572+
private readonly T _loneValue;
573573
private bool _moveNextCalled;
574574

575575
public Enumerator(T value)

CodeConverter/VB/CSharpHelperMethodDefinition.CSharpHelperMethodDefinition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Return value
2828
Throw e
2929
End Function";
3030

31-
private static ICompiler _compiler = new VisualBasicCompiler();
31+
private static readonly ICompiler _compiler = new VisualBasicCompiler();
3232

3333
public bool AddThrowMethod { get; set; }
3434
public bool AddInlineAssignMethod { get; set; }

CommandLine/CodeConv.NetFramework/CodeConvProgram.NetFramework.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ namespace ICSharpCode.CodeConverter.CommandLine
22
{
33
public partial class CodeConvProgram
44
{
5-
private static bool _runningInNetCore = false;
5+
private static readonly bool _runningInNetCore = false;
66
}
77
}

0 commit comments

Comments
 (0)