From 7e8cc06c766c83b0e308ff6c01ece7213a9eb379 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Thu, 10 Jul 2014 19:58:59 +0200 Subject: [PATCH] Don't declare variables in primary ctors --- ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs | 7 +++++-- ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj | 11 ----------- ICSharpCode.Decompiler/IL/BlockBuilder.cs | 2 +- ICSharpCode.Decompiler/IL/ILReader.cs | 2 +- ICSharpCode.Decompiler/IL/ILVariable.cs | 6 +++++- .../IL/Instructions/ILInstruction.cs | 4 +++- ICSharpCode.Decompiler/Util/Interval.cs | 4 +++- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs b/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs index 9a41b38b2..f3a69c0c4 100644 --- a/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs @@ -12,9 +12,12 @@ namespace ICSharpCode.Decompiler.CSharp /// /// Translates from ILAst to C# expressions. /// - class ExpressionBuilder(private readonly ICompilation compilation) + class ExpressionBuilder(ICompilation compilation) { - struct ConvertedExpression(public readonly Expression Expression, public readonly IType Type) { } + struct ConvertedExpression(Expression expression, IType type) { + public readonly Expression Expression = expression; + public readonly IType Type = type; + } public Expression Convert(ILInstruction inst) { diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj index 315f9e78e..ed6f50d1a 100644 --- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj +++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj @@ -73,7 +73,6 @@ - @@ -86,18 +85,8 @@ - - - - - - - - - - diff --git a/ICSharpCode.Decompiler/IL/BlockBuilder.cs b/ICSharpCode.Decompiler/IL/BlockBuilder.cs index b1e13c7b4..1f4d28944 100644 --- a/ICSharpCode.Decompiler/IL/BlockBuilder.cs +++ b/ICSharpCode.Decompiler/IL/BlockBuilder.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace ICSharpCode.Decompiler.IL { - class BlockBuilder(private readonly Mono.Cecil.Cil.MethodBody body, bool instructionInlining) + class BlockBuilder(Mono.Cecil.Cil.MethodBody body, bool instructionInlining) { BlockContainer currentContainer; Block currentBlock; diff --git a/ICSharpCode.Decompiler/IL/ILReader.cs b/ICSharpCode.Decompiler/IL/ILReader.cs index 233ba74a5..2b1a66efc 100644 --- a/ICSharpCode.Decompiler/IL/ILReader.cs +++ b/ICSharpCode.Decompiler/IL/ILReader.cs @@ -11,7 +11,7 @@ using System.Threading; namespace ICSharpCode.Decompiler.IL { - public class ILReader(private readonly Mono.Cecil.Cil.MethodBody body, private readonly CancellationToken cancellationToken) + public class ILReader(Mono.Cecil.Cil.MethodBody body, CancellationToken cancellationToken) { internal static ILOpCode ReadOpCode(ref BlobReader reader) { diff --git a/ICSharpCode.Decompiler/IL/ILVariable.cs b/ICSharpCode.Decompiler/IL/ILVariable.cs index ef1bc6b65..b91b9011b 100644 --- a/ICSharpCode.Decompiler/IL/ILVariable.cs +++ b/ICSharpCode.Decompiler/IL/ILVariable.cs @@ -14,8 +14,12 @@ namespace ICSharpCode.Decompiler.IL Parameter, } - class ILVariable(public readonly VariableKind Kind, public readonly TypeReference Type, public readonly int Index) + class ILVariable(VariableKind kind, TypeReference type, int index) { + public readonly VariableKind Kind = kind; + public readonly TypeReference Type = type; + public readonly int Index = index; + readonly object CecilObject; public ILVariable(VariableDefinition v) diff --git a/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs b/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs index 12be67b87..3440612aa 100644 --- a/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs +++ b/ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs @@ -9,10 +9,12 @@ namespace ICSharpCode.Decompiler.IL /// /// Represents a decoded IL instruction /// - public abstract class ILInstruction(public readonly OpCode OpCode) + public abstract class ILInstruction(OpCode opCode) { public static readonly ILInstruction Pop = new Pop(); + public readonly OpCode OpCode = opCode; + /// /// Gets the ILRange for this instruction alone, ignoring the operands. /// diff --git a/ICSharpCode.Decompiler/Util/Interval.cs b/ICSharpCode.Decompiler/Util/Interval.cs index 9e9072150..7b76659c6 100644 --- a/ICSharpCode.Decompiler/Util/Interval.cs +++ b/ICSharpCode.Decompiler/Util/Interval.cs @@ -48,8 +48,10 @@ namespace ICSharpCode.Decompiler /// /// An immutable set of integers, that is implemented as a list of intervals. /// - struct IntegerSet(public readonly ImmutableArray Intervals) + struct IntegerSet(ImmutableArray intervals) { + public readonly ImmutableArray Intervals = intervals; + public bool IsEmpty { get { return Intervals.IsDefaultOrEmpty; }