Browse Source

Add ILStackWasEmpty flag to default.value

pull/927/head
Siegfried Pammer 8 years ago
parent
commit
e48dfb7cb2
  1. 1
      ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj
  2. 4
      ICSharpCode.Decompiler/IL/ILReader.cs
  3. 33
      ICSharpCode.Decompiler/IL/Instructions/DefaultValue.cs

1
ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

@ -273,6 +273,7 @@ @@ -273,6 +273,7 @@
<Compile Include="DotNetCore\DotNetCorePathFinderExtensions.cs" />
<Compile Include="DotNetCore\UnresolvedAssemblyNameReference.cs" />
<Compile Include="IL\Instructions\CallIndirect.cs" />
<Compile Include="IL\Instructions\DefaultValue.cs" />
<Compile Include="IL\Transforms\EarlyExpressionTransforms.cs" />
<Compile Include="IL\Transforms\ProxyCallReplacer.cs" />
<Compile Include="IL\Instructions\StringToInt.cs" />

4
ICSharpCode.Decompiler/IL/ILReader.cs

@ -1010,7 +1010,9 @@ namespace ICSharpCode.Decompiler.IL @@ -1010,7 +1010,9 @@ namespace ICSharpCode.Decompiler.IL
ILInstruction InitObj(ILInstruction target, IType type)
{
return new StObj(target, new DefaultValue(type), type);
var value = new DefaultValue(type);
value.ILStackWasEmpty = currentStack.IsEmpty;
return new StObj(target, value, type);
}
private ILInstruction DecodeConstrainedCall()

33
ICSharpCode.Decompiler/IL/Instructions/DefaultValue.cs

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
// Copyright (c) 2017 Siegfried Pammer
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Text;
namespace ICSharpCode.Decompiler.IL
{
partial class DefaultValue
{
/// <summary>
/// Gets whether the IL stack was empty at the point of this instruction.
/// (not counting the argument of the instruction itself)
/// </summary>
public bool ILStackWasEmpty;
}
}
Loading…
Cancel
Save