Browse Source

Merge remote-tracking branch 'upstream/master' into themes

# Conflicts:
#	ILSpy/TextView/ILAsm-Mode-Dark.xshd
#	ILSpy/TextView/ILAsm-Mode.xshd
pull/2906/head
Lucas Trzesniewski 2 years ago
parent
commit
4b9c9b9c40
  1. 6
      ICSharpCode.Decompiler.Tests/DisassemblerPrettyTestRunner.cs
  2. 1
      ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
  3. 75
      ICSharpCode.Decompiler.Tests/TestCases/Disassembler/Pretty/InterfaceImplAttributes.il
  4. 5
      ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs
  5. 4
      ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpAmbience.cs
  6. 14
      ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs
  7. 7
      ICSharpCode.Decompiler/Util/ResXResourceWriter.cs
  8. 2
      ILSpy.Installer/ILSpy.Installer.csproj
  9. 6
      ILSpy/TextView/ILAsm-Mode.xshd

6
ICSharpCode.Decompiler.Tests/DisassemblerPrettyTestRunner.cs

@ -64,6 +64,12 @@ namespace ICSharpCode.Decompiler.Tests @@ -64,6 +64,12 @@ namespace ICSharpCode.Decompiler.Tests
await Run(ilExpectedFile: Path.Combine(TestCasePath, "SortMembers.expected.il"), asmOptions: AssemblerOptions.SortedOutput);
}
[Test]
public async Task InterfaceImplAttributes()
{
await Run();
}
async Task Run([CallerMemberName] string testName = null, string ilExpectedFile = null, AssemblerOptions asmOptions = AssemblerOptions.None)
{
var ilInputFile = Path.Combine(TestCasePath, testName + ".il");

1
ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj

@ -73,6 +73,7 @@ @@ -73,6 +73,7 @@
<None Include="TestCases\Correctness\StackTests.il" />
<None Include="TestCases\Correctness\StackTypes.il" />
<None Include="TestCases\Correctness\Uninit.vb" />
<None Include="TestCases\Disassembler\Pretty\InterfaceImplAttributes.il" />
<None Include="TestCases\Disassembler\Pretty\SortMembers.expected.il" />
<None Include="TestCases\Disassembler\Pretty\SortMembers.il" />
<None Include="TestCases\ILPretty\GuessAccessors.cs" />

75
ICSharpCode.Decompiler.Tests/TestCases/Disassembler/Pretty/InterfaceImplAttributes.il

@ -0,0 +1,75 @@ @@ -0,0 +1,75 @@
.assembly extern mscorlib
{
.publickeytoken = (
b7 7a 5c 56 19 34 e0 89
)
.ver 4:0:0:0
}
.assembly InterfaceImplAttributes
{
.custom instance void [mscorlib]System.Reflection.AssemblyFileVersionAttribute::.ctor(string) = (
01 00 07 31 2e 30 2e 30 2e 30 00 00
)
.hash algorithm 0x00008004 // SHA1
.ver 1:0:0:0
}
.module InterfaceImplAttributes.dll
.imagebase 0x10000000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WindowsCui
.corflags 0x00000001 // ILOnly
.class private auto ansi '<Module>'
{
} // end of class <Module>
.class public auto ansi beforefieldinit TestType
extends [mscorlib]System.Object
implements ITestInterfaceA
{
.interfaceimpl type ITestInterfaceA
.custom instance void TestAttributeA::.ctor() = (
01 00 00 00
)
// Methods
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Method begins at RVA 0x2050
// Header size: 1
// Code size: 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method TestType::.ctor
} // end of class TestType
.class interface public auto ansi abstract ITestInterfaceA
{
} // end of class ITestInterfaceA
.class public auto ansi beforefieldinit TestAttributeA
extends [mscorlib]System.Attribute
{
// Methods
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Method begins at RVA 0x2058
// Header size: 1
// Code size: 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Attribute::.ctor()
IL_0006: ret
} // end of method TestAttributeA::.ctor
} // end of class TestAttributeA

5
ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

@ -1288,6 +1288,11 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1288,6 +1288,11 @@ namespace ICSharpCode.Decompiler.CSharp
{
typeSystemAstBuilder = CreateAstBuilder(decompileRun.Settings);
var entityDecl = typeSystemAstBuilder.ConvertEntity(typeDef);
if (entityDecl is DelegateDeclaration delegateDeclaration)
{
// Fix empty parameter names in delegate declarations
FixParameterNames(delegateDeclaration);
}
var typeDecl = entityDecl as TypeDeclaration;
if (typeDecl == null)
{

4
ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpAmbience.cs

@ -83,6 +83,10 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -83,6 +83,10 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
case ClassType.RecordClass:
writer.WriteKeyword(Roles.RecordKeyword, "record");
break;
case ClassType.RecordStruct:
writer.WriteKeyword(Roles.RecordKeyword, "record");
writer.WriteKeyword(Roles.StructKeyword, "struct");
break;
default:
throw new Exception("Invalid value for ClassType");
}

14
ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs

@ -1577,7 +1577,6 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -1577,7 +1577,6 @@ namespace ICSharpCode.Decompiler.Disassembler
output.Write(" ");
first = false;
var iface = module.Metadata.GetInterfaceImplementation(i);
WriteAttributes(module, iface.GetCustomAttributes());
iface.Interface.WriteTo(module, output, genericContext, ILNameSyntax.TypeName);
}
output.WriteLine();
@ -1601,6 +1600,19 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -1601,6 +1600,19 @@ namespace ICSharpCode.Decompiler.Disassembler
output.WriteLine(".size {0}", layout.Size);
output.WriteLine();
}
foreach (var ifaceHandle in interfaces)
{
var iface = module.Metadata.GetInterfaceImplementation(ifaceHandle);
var customAttributes = iface.GetCustomAttributes();
if (customAttributes.Count != 0)
{
output.Write(".interfaceimpl type ");
iface.Interface.WriteTo(module, output, genericContext, ILNameSyntax.TypeName);
output.WriteLine();
WriteAttributes(module, customAttributes);
output.WriteLine();
}
}
var nestedTypes = Process(module, typeDefinition.GetNestedTypes());
if (nestedTypes.Any())
{

7
ICSharpCode.Decompiler/Util/ResXResourceWriter.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
// Copyright (c) 2018 Daniel Grunwald
// Copyright (c) 2018 Daniel Grunwald
// This file is based on the Mono implementation of ResXResourceWriter.
// It is modified to add support for "ResourceSerializedObject" values.
//
@ -263,6 +263,11 @@ namespace ICSharpCode.Decompiler.Util @@ -263,6 +263,11 @@ namespace ICSharpCode.Decompiler.Util
WriteBytes(name, value.GetType(), (byte[])value, comment);
return;
}
if (value is MemoryStream memoryStream)
{
WriteBytes(name, null, memoryStream.ToArray(), comment);
return;
}
if (value is ResourceSerializedObject rso)
{
var bytes = rso.GetBytes();

2
ILSpy.Installer/ILSpy.Installer.csproj

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="WixSharp" Version="1.20.1" />
<PackageReference Include="WixSharp" Version="1.20.3" />
<PackageReference Include="WixSharp.wix.bin" Version="3.11.2" />
</ItemGroup>

6
ILSpy/TextView/ILAsm-Mode.xshd

@ -357,6 +357,7 @@ @@ -357,6 +357,7 @@
<Word>true</Word>
<Word>false</Word>
<Word>strict</Word>
<Word>type</Word>
</Keywords>
<Keywords color="Directives">
<Word>.class</Word>
@ -386,6 +387,7 @@ @@ -386,6 +387,7 @@
<Word>.permissionset</Word>
<Word>.line</Word>
<Word>.language</Word>
<Word>.interfaceimpl</Word>
<Word>#line</Word>
</Keywords>
<Keywords color="Security">
@ -517,6 +519,10 @@ @@ -517,6 +519,10 @@
<Begin>"</Begin>
<End>"</End>
</Span>
<Span>
<Begin>'</Begin>
<End>'</End>
</Span>
<Rule color="Label">
^ \s* \w+ :
</Rule>

Loading…
Cancel
Save