Browse Source

Use enum as case value if possible.

pull/70/head
David Srbecký 15 years ago
parent
commit
3c4b3bf2e9
  1. 2
      ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

2
ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

@ -123,7 +123,7 @@ namespace ICSharpCode.Decompiler.Ast @@ -123,7 +123,7 @@ namespace ICSharpCode.Decompiler.Ast
SwitchStatement switchStmt = new SwitchStatement() { Expression = (Expression)TransformExpression(ilSwitch.Condition) };
foreach (var caseBlock in ilSwitch.CaseBlocks) {
SwitchSection section = new SwitchSection();
section.CaseLabels.AddRange(caseBlock.Values.Select(i => new CaseLabel() { Expression = new PrimitiveExpression(i) }));
section.CaseLabels.AddRange(caseBlock.Values.Select(i => new CaseLabel() { Expression = AstBuilder.MakePrimitive(i, ilSwitch.Condition.InferredType) }));
section.Statements.Add(TransformBlock(caseBlock));
switchStmt.SwitchSections.Add(section);
}

Loading…
Cancel
Save