Browse Source

Fix formatting in ExpressionBuilder.

pull/1600/head
Siegfried Pammer 7 years ago
parent
commit
2b6c0c3892
  1. 27
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

27
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -441,7 +441,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -441,7 +441,7 @@ namespace ICSharpCode.Decompiler.CSharp
.WithILInstruction(inst);
} finally {
astBuilder.PrintIntegralValuesAsHex = false;
}
}
}
protected internal override TranslatedExpression VisitLdcI8(LdcI8 inst, TranslationContext context)
@ -465,7 +465,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -465,7 +465,7 @@ namespace ICSharpCode.Decompiler.CSharp
.WithILInstruction(inst);
} finally {
astBuilder.PrintIntegralValuesAsHex = false;
}
}
}
private bool ShouldDisplayAsHex(long value, ILInstruction parent)
@ -556,7 +556,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -556,7 +556,7 @@ namespace ICSharpCode.Decompiler.CSharp
var argUType = NullableType.GetUnderlyingType(argument.Type);
if (argUType.GetStackType().GetSize() < inst.UnderlyingResultType.GetSize()
|| argUType.Kind == TypeKind.Enum && argUType.IsSmallIntegerType()
|| argUType.Kind == TypeKind.Enum && argUType.IsSmallIntegerType()
|| argUType.GetStackType() == StackType.I
|| argUType.IsKnownType(KnownTypeCode.Boolean)
|| argUType.IsKnownType(KnownTypeCode.Char))
@ -1939,8 +1939,8 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1939,8 +1939,8 @@ namespace ICSharpCode.Decompiler.CSharp
// When accessing members on value types, ensure we use a reference of the correct type,
// and not a pointer or a reference to a different type (issue #1333)
if (!(translatedTarget.Type is ByReferenceType brt && NormalizeTypeVisitor.TypeErasure.EquivalentTypes(brt.ElementType, memberDeclaringType))) {
translatedTarget = translatedTarget.ConvertTo(new ByReferenceType(memberDeclaringType), this);
}
translatedTarget = translatedTarget.ConvertTo(new ByReferenceType(memberDeclaringType), this);
}
}
if (translatedTarget.Expression is DirectionExpression) {
// (ref x).member => x.member
@ -2040,7 +2040,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2040,7 +2040,7 @@ namespace ICSharpCode.Decompiler.CSharp
pointer = pointer.ConvertTo(new PointerType(value.Type), this);
} else {
pointer = pointer.ConvertTo(new PointerType(inst.Type), this);
}
}
}
if (pointer.Expression is UnaryOperatorExpression uoe && uoe.Operator == UnaryOperatorType.AddressOf) {
// *&ptr -> ptr
@ -2053,7 +2053,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2053,7 +2053,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
if (value.Expression == null) {
value = Translate(inst.Value, typeHint: target.Type);
}
}
return Assignment(target, value).WithILInstruction(inst);
}
@ -2138,7 +2138,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2138,7 +2138,7 @@ namespace ICSharpCode.Decompiler.CSharp
TranslatedExpression arrayExpr = Translate(inst.Array);
var arrayType = arrayExpr.Type as ArrayType;
if (arrayType == null || !TypeUtils.IsCompatibleTypeForMemoryAccess(arrayType.ElementType, inst.Type)) {
arrayType = new ArrayType(compilation, inst.Type, inst.Indices.Count);
arrayType = new ArrayType(compilation, inst.Type, inst.Indices.Count);
arrayExpr = arrayExpr.ConvertTo(arrayType, this);
}
TranslatedExpression expr = new IndexerExpression(
@ -2185,8 +2185,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2185,8 +2185,7 @@ namespace ICSharpCode.Decompiler.CSharp
// try via its effective base class.
arg = arg.ConvertTo(((ITypeParameter)targetType).EffectiveBaseClass, this);
}
}
else {
} else {
// Before unboxing arg must be a object
arg = arg.ConvertTo(compilation.FindType(KnownTypeCode.Object), this);
}
@ -2445,9 +2444,9 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2445,9 +2444,9 @@ namespace ICSharpCode.Decompiler.CSharp
if (memberPath.Member is IProperty property) {
index = new CallBuilder(this, typeSystem, settings)
.BuildDictionaryInitializerExpression(valuePath.OpCode, property.Setter, rr, GetIndices(valuePath.Indices, indexVariables).ToList());
} else {
} else {
index = new IndexerExpression(null, GetIndices(valuePath.Indices, indexVariables).Select(i => Translate(i).Expression));
}
}
return new AssignmentExpression(index, value)
.WithRR(new MemberResolveResult(rr, memberPath.Member))
.WithoutILInstruction();
@ -2455,7 +2454,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2455,7 +2454,7 @@ namespace ICSharpCode.Decompiler.CSharp
return new NamedExpression(valuePath.Member.Name, value)
.WithRR(new MemberResolveResult(rr, valuePath.Member))
.WithoutILInstruction();
}
}
}
class ArrayInitializer
@ -2469,7 +2468,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2469,7 +2468,7 @@ namespace ICSharpCode.Decompiler.CSharp
public ArrayInitializerExpression Expression;
// HACK: avoid using Expression.Elements.Count: https://github.com/icsharpcode/ILSpy/issues/1202
public int CurrentElementCount;
}
}
TranslatedExpression TranslateArrayInitializer(Block block)
{

Loading…
Cancel
Save