Skip to content

Commit 6db9a02

Browse files
Merge pull request #3686 from icsharpcode/custom-signature-decoder-comparer
Hide compiler-generated accessor methods
2 parents 0a241df + f6b3144 commit 6db9a02

File tree

8 files changed

+689
-39
lines changed

8 files changed

+689
-39
lines changed

ICSharpCode.Decompiler.Tests/Helpers/Tester.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,17 @@ public static async Task<CompilerResults> CompileCSharp(string sourceFileName, C
489489
{
490490
sourceFileNames.Add(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(sourceFileName), match.Groups[1].Value)));
491491
}
492+
493+
List<string> dependencyAssemblies = new List<string>();
494+
string sourceText = File.ReadAllText(sourceFileName);
495+
foreach (Match match in Regex.Matches(sourceText, @"//\s*#dependency\s+([\w\d./\\]+)"))
496+
{
497+
string depSourcePath = Path.GetFullPath(Path.Combine(
498+
Path.GetDirectoryName(sourceFileName), match.Groups[1].Value));
499+
var depResults = await CompileCSharp(depSourcePath, flags | CompilerOptions.Library).ConfigureAwait(false);
500+
dependencyAssemblies.Add(Path.GetFullPath(depResults.PathToAssembly));
501+
}
502+
492503
bool targetNet40 = (flags & CompilerOptions.TargetNet40) != 0;
493504
bool useRoslyn = (flags & CompilerOptions.UseRoslynMask) != 0;
494505

@@ -556,6 +567,11 @@ public static async Task<CompilerResults> CompileCSharp(string sourceFileName, C
556567

557568
references = references.Select(r => "-r:\"" + Path.Combine(refAsmPath, r) + "\"");
558569

570+
foreach (var dependency in dependencyAssemblies)
571+
{
572+
references = references.Append($"-r:\"{dependency}\"");
573+
}
574+
559575
string otherOptions = $"-nologo -noconfig " +
560576
$"-langversion:{languageVersion} " +
561577
$"-unsafe -o{(flags.HasFlag(CompilerOptions.Optimize) ? "+ " : "- ")}";

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@
167167
<Compile Include="TestCases\Pretty\Issue3610.cs" />
168168
<Compile Include="TestCases\Pretty\Issue3611.cs" />
169169
<Compile Include="TestCases\Pretty\Issue3598.cs" />
170+
<Compile Include="Metadata\SignatureBlobComparerTests.cs" />
171+
<None Include="TestCases\Pretty\Issue3684.dep.cs" />
172+
<None Include="TestCases\Pretty\Issue3684.cs" />
170173
<None Include="TestCases\Ugly\NoLocalFunctions.Expected.cs" />
171174
<None Include="TestCases\ILPretty\Issue3504.cs" />
172175
<Compile Include="TestCases\ILPretty\MonoFixed.cs" />

0 commit comments

Comments
 (0)