Browse Source

Don't declare variables in primary ctors

pull/728/head
Daniel Grunwald 11 years ago
parent
commit
7e8cc06c76
  1. 7
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs
  2. 11
      ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
  3. 2
      ICSharpCode.Decompiler/IL/BlockBuilder.cs
  4. 2
      ICSharpCode.Decompiler/IL/ILReader.cs
  5. 6
      ICSharpCode.Decompiler/IL/ILVariable.cs
  6. 4
      ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs
  7. 4
      ICSharpCode.Decompiler/Util/Interval.cs

7
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -12,9 +12,12 @@ namespace ICSharpCode.Decompiler.CSharp
/// <summary> /// <summary>
/// Translates from ILAst to C# expressions. /// Translates from ILAst to C# expressions.
/// </summary> /// </summary>
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) public Expression Convert(ILInstruction inst)
{ {

11
ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

@ -73,7 +73,6 @@
<Compile Include="Disassembler\ILStructure.cs" /> <Compile Include="Disassembler\ILStructure.cs" />
<Compile Include="Disassembler\MethodBodyDisassembler.cs" /> <Compile Include="Disassembler\MethodBodyDisassembler.cs" />
<Compile Include="Disassembler\ReflectionDisassembler.cs" /> <Compile Include="Disassembler\ReflectionDisassembler.cs" />
<Compile Include="IL\Instructions\ArrayInstructions.cs" />
<Compile Include="IL\SemanticHelper.cs" /> <Compile Include="IL\SemanticHelper.cs" />
<Compile Include="IL\BlockBuilder.cs" /> <Compile Include="IL\BlockBuilder.cs" />
<Compile Include="IL\ILOpCodes.cs"> <Compile Include="IL\ILOpCodes.cs">
@ -86,18 +85,8 @@
<Compile Include="IL\ILVariable.cs" /> <Compile Include="IL\ILVariable.cs" />
<Compile Include="IL\InstructionFlags.cs" /> <Compile Include="IL\InstructionFlags.cs" />
<Compile Include="IL\InstructionOutputExtensions.cs" /> <Compile Include="IL\InstructionOutputExtensions.cs" />
<Compile Include="IL\Instructions\BinaryInstruction.cs" />
<Compile Include="IL\Instructions\Block.cs" />
<Compile Include="IL\Instructions\BoxInstructions.cs" />
<Compile Include="IL\Instructions\BranchInstruction.cs" />
<Compile Include="IL\Instructions\CallInstruction.cs" />
<Compile Include="IL\Instructions\FieldAccess.cs" />
<Compile Include="IL\Instructions\ILInstruction.cs" /> <Compile Include="IL\Instructions\ILInstruction.cs" />
<Compile Include="IL\Instructions\OpCode.cs" /> <Compile Include="IL\Instructions\OpCode.cs" />
<Compile Include="IL\Instructions\MemoryInstruction.cs" />
<Compile Include="IL\Instructions\SimpleInstruction.cs" />
<Compile Include="IL\Instructions\UnaryInstruction.cs" />
<Compile Include="IL\Instructions\VarInstructions.cs" />
<Compile Include="IL\PrimitiveType.cs" /> <Compile Include="IL\PrimitiveType.cs" />
<Compile Include="IL\StackType.cs" /> <Compile Include="IL\StackType.cs" />
<Compile Include="Output\ITextOutput.cs" /> <Compile Include="Output\ITextOutput.cs" />

2
ICSharpCode.Decompiler/IL/BlockBuilder.cs

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace ICSharpCode.Decompiler.IL 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; BlockContainer currentContainer;
Block currentBlock; Block currentBlock;

2
ICSharpCode.Decompiler/IL/ILReader.cs

@ -11,7 +11,7 @@ using System.Threading;
namespace ICSharpCode.Decompiler.IL 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) internal static ILOpCode ReadOpCode(ref BlobReader reader)
{ {

6
ICSharpCode.Decompiler/IL/ILVariable.cs

@ -14,8 +14,12 @@ namespace ICSharpCode.Decompiler.IL
Parameter, 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; readonly object CecilObject;
public ILVariable(VariableDefinition v) public ILVariable(VariableDefinition v)

4
ICSharpCode.Decompiler/IL/Instructions/ILInstruction.cs

@ -9,10 +9,12 @@ namespace ICSharpCode.Decompiler.IL
/// <summary> /// <summary>
/// Represents a decoded IL instruction /// Represents a decoded IL instruction
/// </summary> /// </summary>
public abstract class ILInstruction(public readonly OpCode OpCode) public abstract class ILInstruction(OpCode opCode)
{ {
public static readonly ILInstruction Pop = new Pop(); public static readonly ILInstruction Pop = new Pop();
public readonly OpCode OpCode = opCode;
/// <summary> /// <summary>
/// Gets the ILRange for this instruction alone, ignoring the operands. /// Gets the ILRange for this instruction alone, ignoring the operands.
/// </summary> /// </summary>

4
ICSharpCode.Decompiler/Util/Interval.cs

@ -48,8 +48,10 @@ namespace ICSharpCode.Decompiler
/// <summary> /// <summary>
/// An immutable set of integers, that is implemented as a list of intervals. /// An immutable set of integers, that is implemented as a list of intervals.
/// </summary> /// </summary>
struct IntegerSet(public readonly ImmutableArray<Interval> Intervals) struct IntegerSet(ImmutableArray<Interval> intervals)
{ {
public readonly ImmutableArray<Interval> Intervals = intervals;
public bool IsEmpty public bool IsEmpty
{ {
get { return Intervals.IsDefaultOrEmpty; } get { return Intervals.IsDefaultOrEmpty; }

Loading…
Cancel
Save