Skip to content

Commit 66379b9

Browse files
Merge pull request #43 from Guillermo-Santos/feature/ilc
Feature/ilc
2 parents 568d0e1 + 43b2155 commit 66379b9

36 files changed

+770
-416
lines changed

.github/workflows/dotnet.yml

+16-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
matrix:
16-
os: [ windows-latest ]
16+
os: [ ubuntu-latest ]
1717
dotnet-version: [ 8.0.x ]
1818

1919
steps:
@@ -28,6 +28,12 @@ jobs:
2828
- name: Restore Dependencies
2929
run: dotnet restore ./tests/Liquip.Patcher.Tests/Liquip.Patcher.Tests.csproj
3030

31+
- name: Build Liquip.Patcher
32+
run: dotnet build ./src/Liquip.Patcher/Liquip.Patcher.csproj
33+
34+
- name: Build Liquip.Patcher.Build
35+
run: dotnet build ./src/Liquip.Patcher.Build/Liquip.Patcher.Build.csproj
36+
3137
- name: Build Liquip.Patcher.Tests
3238
run: dotnet build ./tests/Liquip.Patcher.Tests/Liquip.Patcher.Tests.csproj --configuration Debug --no-restore
3339

@@ -45,7 +51,7 @@ jobs:
4551
runs-on: ${{ matrix.os }}
4652
strategy:
4753
matrix:
48-
os: [ windows-latest ]
54+
os: [ ubuntu-latest ]
4955
dotnet-version: [ 8.0.x ]
5056

5157
steps:
@@ -60,6 +66,12 @@ jobs:
6066
- name: Restore Dependencies
6167
run: dotnet restore ./tests/Liquip.Scanner.Tests/Liquip.Scanner.Tests.csproj
6268

69+
- name: Build Liquip.Patcher
70+
run: dotnet build ./src/Liquip.Patcher/Liquip.Patcher.csproj
71+
72+
- name: Build Liquip.Patcher.Build
73+
run: dotnet build ./src/Liquip.Patcher.Build/Liquip.Patcher.Build.csproj
74+
6375
- name: Build Liquip.Scanner.Tests
6476
run: dotnet build ./tests/Liquip.Scanner.Tests/Liquip.Scanner.Tests.csproj --configuration Debug --no-restore
6577

@@ -77,7 +89,7 @@ jobs:
7789
runs-on: ${{ matrix.os }}
7890
strategy:
7991
matrix:
80-
os: [ windows-latest ]
92+
os: [ ubuntu-latest ]
8193
dotnet-version: [ 8.0.x ]
8294

8395
steps:
@@ -102,4 +114,4 @@ jobs:
102114
uses: actions/upload-artifact@v4
103115
with:
104116
name: Liquip.Patcher.Analyzer.Tests-Results
105-
path: ./tests/Liquip.Patcher.Analyzer.Tests/TestResults/Liquip.Patcher.Analyzer.Tests.trx
117+
path: ./tests/Liquip.Patcher.Analyzer.Tests/TestResults/Liquip.Patcher.Analyzer.Tests.trx

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ StyleCopReport.xml
7575
*.ilk
7676
*.meta
7777
*.obj
78+
*.o
7879
*.iobj
7980
*.pch
8081
*.pdb
@@ -97,6 +98,7 @@ StyleCopReport.xml
9798
*.pidb
9899
*.svclog
99100
*.scc
101+
*.d
100102

101103
# Chutzpah Test files
102104
_Chutzpah*

Directory.Packages.props

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
<PackageVersion Include="Microsoft.VSSDK.BuildTools" Version="17.5.4072" />
2525
<PackageVersion Include="Mono.Cecil" Version="0.11.5" />
2626
<PackageVersion Include="MonoMod.Utils" Version="25.0.6" />
27-
<PackageVersion Include="Polyfill" Version="7.16.1" />
2827
<PackageVersion Include="Spectre.Console.Cli" Version="0.49.1" />
2928
<PackageVersion Include="unit" Version="1.0.0" />
3029
<PackageVersion Include="xunit" Version="2.9.3" />

nativeaot-patcher.sln

+42-41
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{E8477467-2
1818
EndProject
1919
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liquip.Patcher.Build", "src\Liquip.Patcher.Build\Liquip.Patcher.Build.csproj", "{BBA11D4D-B79C-46C1-B479-D7482BE4D8E2}"
2020
EndProject
21-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liquip.NativeWrapper", "tests\Liquip.NativeWrapper\Liquip.NativeWrapper.csproj", "{2DA86403-E320-4B78-A287-63F29D964803}"
22-
EndProject
23-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NativeLibrary", "NativeLibrary", "{7B8F6265-C9FE-4E0C-813E-57068922732B}"
24-
EndProject
2521
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liquip.Patcher.Tests", "tests\Liquip.Patcher.Tests\Liquip.Patcher.Tests.csproj", "{53BDFA0A-62B9-42BB-8C1C-8D2913110B8D}"
2622
EndProject
2723
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liquip.Scanner.Tests", "tests\Liquip.Scanner.Tests\Liquip.Scanner.Tests.csproj", "{336C4576-4738-4BCB-9FE5-3D9DE37DFE7D}"
@@ -36,9 +32,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liquip.Patcher.Analyzer.Tes
3632
EndProject
3733
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analyzer", "Analyzer", "{4E2E1B0F-900C-4DAC-877E-17541E35D5E1}"
3834
EndProject
39-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E86BBA79-5A9E-4EA0-9FB0-1300CC5CAFB0}"
40-
EndProject
41-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testproject", "src\testproject\testproject.csproj", "{AC041A36-A967-4ADF-B29B-574F5CC74A96}"
35+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liquip.ilc.Build", "src\Liquip.ilc.Build\Liquip.ilc.Build.csproj", "{6C5994EA-A9B6-4417-9F31-407FBA96905A}"
4236
EndProject
4337
Global
4438
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -49,6 +43,16 @@ Global
4943
Release|x64 = Release|x64
5044
Release|x86 = Release|x86
5145
EndGlobalSection
46+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
47+
{BFE3B3A6-C530-41CC-B5F6-E1EA50B76173}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
48+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
49+
Debug|Any CPU = Debug|Any CPU
50+
Debug|x64 = Debug|x64
51+
Debug|x86 = Debug|x86
52+
Release|Any CPU = Release|Any CPU
53+
Release|x64 = Release|x64
54+
Release|x86 = Release|x86
55+
EndGlobalSection
5256
GlobalSection(ProjectConfigurationPlatforms) = postSolution
5357
{BFE3B3A6-C530-41CC-B5F6-E1EA50B76173}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
5458
{BFE3B3A6-C530-41CC-B5F6-E1EA50B76173}.Debug|Any CPU.Build.0 = Debug|Any CPU
@@ -86,6 +90,18 @@ Global
8690
{5544B160-9D32-42A8-8EC3-D3DDC72D0FF7}.Release|x64.Build.0 = Release|Any CPU
8791
{5544B160-9D32-42A8-8EC3-D3DDC72D0FF7}.Release|x86.ActiveCfg = Release|Any CPU
8892
{5544B160-9D32-42A8-8EC3-D3DDC72D0FF7}.Release|x86.Build.0 = Release|Any CPU
93+
{5C469314-B579-4913-AC14-47909158E3BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
94+
{5C469314-B579-4913-AC14-47909158E3BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
95+
{5C469314-B579-4913-AC14-47909158E3BE}.Debug|x64.ActiveCfg = Debug|Any CPU
96+
{5C469314-B579-4913-AC14-47909158E3BE}.Debug|x64.Build.0 = Debug|Any CPU
97+
{5C469314-B579-4913-AC14-47909158E3BE}.Debug|x86.ActiveCfg = Debug|Any CPU
98+
{5C469314-B579-4913-AC14-47909158E3BE}.Debug|x86.Build.0 = Debug|Any CPU
99+
{5C469314-B579-4913-AC14-47909158E3BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
100+
{5C469314-B579-4913-AC14-47909158E3BE}.Release|Any CPU.Build.0 = Release|Any CPU
101+
{5C469314-B579-4913-AC14-47909158E3BE}.Release|x64.ActiveCfg = Release|Any CPU
102+
{5C469314-B579-4913-AC14-47909158E3BE}.Release|x64.Build.0 = Release|Any CPU
103+
{5C469314-B579-4913-AC14-47909158E3BE}.Release|x86.ActiveCfg = Release|Any CPU
104+
{5C469314-B579-4913-AC14-47909158E3BE}.Release|x86.Build.0 = Release|Any CPU
89105
{3DAB22BB-91AB-4A30-BEA7-4744F5DA203B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
90106
{3DAB22BB-91AB-4A30-BEA7-4744F5DA203B}.Debug|Any CPU.Build.0 = Debug|Any CPU
91107
{3DAB22BB-91AB-4A30-BEA7-4744F5DA203B}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -110,18 +126,6 @@ Global
110126
{BBA11D4D-B79C-46C1-B479-D7482BE4D8E2}.Release|x64.Build.0 = Release|Any CPU
111127
{BBA11D4D-B79C-46C1-B479-D7482BE4D8E2}.Release|x86.ActiveCfg = Release|Any CPU
112128
{BBA11D4D-B79C-46C1-B479-D7482BE4D8E2}.Release|x86.Build.0 = Release|Any CPU
113-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
114-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
115-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Debug|x64.ActiveCfg = Debug|Any CPU
116-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Debug|x64.Build.0 = Debug|Any CPU
117-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Debug|x86.ActiveCfg = Debug|Any CPU
118-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Debug|x86.Build.0 = Debug|Any CPU
119-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
120-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Release|Any CPU.Build.0 = Release|Any CPU
121-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Release|x64.ActiveCfg = Release|Any CPU
122-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Release|x64.Build.0 = Release|Any CPU
123-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Release|x86.ActiveCfg = Release|Any CPU
124-
{5611344C-B0DF-4A9B-A530-C677F8BD71AC}.Release|x86.Build.0 = Release|Any CPU
125129
{2DA86403-E320-4B78-A287-63F29D964803}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
126130
{2DA86403-E320-4B78-A287-63F29D964803}.Debug|Any CPU.Build.0 = Debug|Any CPU
127131
{2DA86403-E320-4B78-A287-63F29D964803}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -206,34 +210,31 @@ Global
206210
{91348BA3-7914-42EF-9067-EBD663046EB5}.Release|x64.Build.0 = Release|Any CPU
207211
{91348BA3-7914-42EF-9067-EBD663046EB5}.Release|x86.ActiveCfg = Release|Any CPU
208212
{91348BA3-7914-42EF-9067-EBD663046EB5}.Release|x86.Build.0 = Release|Any CPU
209-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
210-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Debug|Any CPU.Build.0 = Debug|Any CPU
211-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Debug|x64.ActiveCfg = Debug|Any CPU
212-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Debug|x64.Build.0 = Debug|Any CPU
213-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Debug|x86.ActiveCfg = Debug|Any CPU
214-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Debug|x86.Build.0 = Debug|Any CPU
215-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Release|Any CPU.ActiveCfg = Release|Any CPU
216-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Release|Any CPU.Build.0 = Release|Any CPU
217-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Release|x64.ActiveCfg = Release|Any CPU
218-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Release|x64.Build.0 = Release|Any CPU
219-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Release|x86.ActiveCfg = Release|Any CPU
220-
{AC041A36-A967-4ADF-B29B-574F5CC74A96}.Release|x86.Build.0 = Release|Any CPU
213+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
214+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Debug|Any CPU.Build.0 = Debug|Any CPU
215+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Debug|x64.ActiveCfg = Debug|Any CPU
216+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Debug|x64.Build.0 = Debug|Any CPU
217+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Debug|x86.ActiveCfg = Debug|Any CPU
218+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Debug|x86.Build.0 = Debug|Any CPU
219+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Release|Any CPU.ActiveCfg = Release|Any CPU
220+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Release|Any CPU.Build.0 = Release|Any CPU
221+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Release|x64.ActiveCfg = Release|Any CPU
222+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Release|x64.Build.0 = Release|Any CPU
223+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Release|x86.ActiveCfg = Release|Any CPU
224+
{6C5994EA-A9B6-4417-9F31-407FBA96905A}.Release|x86.Build.0 = Release|Any CPU
221225
EndGlobalSection
222226
GlobalSection(SolutionProperties) = preSolution
223227
HideSolutionNode = FALSE
224228
EndGlobalSection
225229
GlobalSection(NestedProjects) = preSolution
226-
{BBCE7B79-04E4-471E-9106-93912FD53775} = {4E2E1B0F-900C-4DAC-877E-17541E35D5E1}
227-
{E9E3E2CA-AAA2-4835-9264-8EFD44790A89} = {4E2E1B0F-900C-4DAC-877E-17541E35D5E1}
228-
{2F39381E-D1BA-480F-A4BF-B0DF959C9BA5} = {4E2E1B0F-900C-4DAC-877E-17541E35D5E1}
229-
{336C4576-4738-4BCB-9FE5-3D9DE37DFE7D} = {E8477467-2571-4CD8-A4AF-48C89857AB48}
230-
{53BDFA0A-62B9-42BB-8C1C-8D2913110B8D} = {E8477467-2571-4CD8-A4AF-48C89857AB48}
230+
{D2B9C128-E020-4F6E-959D-EE4A0EB4EF95} = {C42A0E56-F643-4D59-AB26-F580FAC60E01}
231+
{5C469314-B579-4913-AC14-47909158E3BE} = {C42A0E56-F643-4D59-AB26-F580FAC60E01}
231232
{3DAB22BB-91AB-4A30-BEA7-4744F5DA203B} = {E8477467-2571-4CD8-A4AF-48C89857AB48}
233+
{53BDFA0A-62B9-42BB-8C1C-8D2913110B8D} = {E8477467-2571-4CD8-A4AF-48C89857AB48}
234+
{336C4576-4738-4BCB-9FE5-3D9DE37DFE7D} = {E8477467-2571-4CD8-A4AF-48C89857AB48}
235+
{2F39381E-D1BA-480F-A4BF-B0DF959C9BA5} = {4E2E1B0F-900C-4DAC-877E-17541E35D5E1}
236+
{E9E3E2CA-AAA2-4835-9264-8EFD44790A89} = {4E2E1B0F-900C-4DAC-877E-17541E35D5E1}
237+
{BBCE7B79-04E4-471E-9106-93912FD53775} = {4E2E1B0F-900C-4DAC-877E-17541E35D5E1}
232238
{91348BA3-7914-42EF-9067-EBD663046EB5} = {E8477467-2571-4CD8-A4AF-48C89857AB48}
233-
{7B8F6265-C9FE-4E0C-813E-57068922732B} = {E8477467-2571-4CD8-A4AF-48C89857AB48}
234-
{2DA86403-E320-4B78-A287-63F29D964803} = {7B8F6265-C9FE-4E0C-813E-57068922732B}
235-
{5C469314-B579-4913-AC14-47909158E3BE} = {C42A0E56-F643-4D59-AB26-F580FAC60E01}
236-
{D2B9C128-E020-4F6E-959D-EE4A0EB4EF95} = {C42A0E56-F643-4D59-AB26-F580FAC60E01}
237-
{AC041A36-A967-4ADF-B29B-574F5CC74A96} = {E86BBA79-5A9E-4EA0-9FB0-1300CC5CAFB0}
238239
EndGlobalSection
239240
EndGlobal

src/Liquip.Aot.Asm/Liquip.Aot.Asm.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PackageReference Include="Microsoft.Build.Utilities.Core" />
44
</ItemGroup>
55
<ItemGroup>
6-
<None Update="build\Liquip.Aot.Asm.props">
6+
<None Update="build/Liquip.Aot.Asm.props">
77
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
88
</None>
99
</ItemGroup>

src/Liquip.Patcher.Analyzer.CodeFixes/Liquip.Patcher.Analyzer.CodeFixes.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
<ItemGroup>
99
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
1010
<PackageReference Include="Microsoft.CodeAnalysis.Common" />
11-
<PackageReference Include="Polyfill">
12-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
13-
<PrivateAssets>all</PrivateAssets>
14-
</PackageReference>
1511
</ItemGroup>
1612
<ItemGroup>
1713
<ProjectReference Include="..\Liquip.Patcher.Analyzer\Liquip.Patcher.Analyzer.csproj" />

src/Liquip.Patcher.Analyzer.CodeFixes/Models/ProjectInfo.cs

+7-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ namespace Liquip.Patcher.Analyzer.CodeFixes.Models;
44

55
public readonly record struct ProjectInfo(IEnumerable<string> PlugReferences)
66
{
7-
public static ProjectInfo From(XDocument csproj) => new(
8-
PlugReferences: csproj.Descendants("ItemGroup")
9-
.Where(x => x.Name == "PlugsReference")
10-
.Select(x => x.Attribute("Include")!.Value)
11-
);
7+
public readonly IEnumerable<string> PlugReferences = PlugReferences;
128

9+
public static ProjectInfo From(XDocument csproj) => new(
10+
PlugReferences: csproj.Descendants("ItemGroup")
11+
.Elements("PlugsReference")
12+
.Select(x => x.Attribute("Include")!.Value)
13+
.Where(x => x != null)
14+
);
1315
}

src/Liquip.Patcher.Analyzer.CodeFixes/PatcherCodeFixProvider.cs

+7-6
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
3939
if (root == null)
4040
return;
4141

42-
foreach (Diagnostic diagnostic in context.Diagnostics.Where(d => d.Id.StartsWith(PatcherAnalyzer.AnalyzerDiagnosticId)))
42+
foreach (Diagnostic diagnostic in context.Diagnostics)
4343
{
44+
if (!diagnostic.Id.StartsWith(PatcherAnalyzer.DiagnosticId)) continue;
45+
4446
SyntaxNode declaration = root.FindNode(diagnostic.Location.SourceSpan);
4547
switch (diagnostic.Id)
4648
{
@@ -168,11 +170,10 @@ public static async Task<Solution> PlugMethod(Document document, SyntaxNode decl
168170
if (symbol == null) continue;
169171

170172
SyntaxReference? syntaxReference = symbol.DeclaringSyntaxReferences.FirstOrDefault();
171-
if (syntaxReference != null)
172-
{
173-
SyntaxNode syntaxNode = await syntaxReference.GetSyntaxAsync().ConfigureAwait(false);
174-
return ((ClassDeclarationSyntax)syntaxNode, project.GetDocument(syntaxReference.SyntaxTree)!);
175-
}
173+
if (syntaxReference == null) continue;
174+
175+
SyntaxNode syntaxNode = await syntaxReference.GetSyntaxAsync().ConfigureAwait(false);
176+
return ((ClassDeclarationSyntax)syntaxNode, project.GetDocument(syntaxReference.SyntaxTree)!);
176177
}
177178

178179
return null;

src/Liquip.Patcher.Analyzer/Extensions/AttributeExtensions.cs

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System.Diagnostics;
2-
using Liquip.Patcher.Analyzer.Utils;
31
using Microsoft.CodeAnalysis;
42
using Microsoft.CodeAnalysis.CSharp.Syntax;
53
using Microsoft.CodeAnalysis.Diagnostics;
@@ -92,6 +90,4 @@ int index when attribute.ArgumentList?.Arguments.Count > index
9290

9391
private static T? ConvertEnum<T>(object value)
9492
=> (T?)Enum.ToObject(typeof(T), value);
95-
96-
9793
}

src/Liquip.Patcher.Analyzer/Extensions/EnumerableExtensions.cs

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
using Microsoft.CodeAnalysis;
2-
using Microsoft.CodeAnalysis.CSharp;
31
using Microsoft.CodeAnalysis.CSharp.Syntax;
4-
using Microsoft.CodeAnalysis.Text;
52

63
namespace Liquip.Patcher.Analyzer.Utils;
74

8-
public static class Extensions
5+
public static class SyntaxNodeExtensions
96
{
107
public static bool TryGetMemberByName<T>(this ClassDeclarationSyntax declaration, string name, out T? member)
118
where T : MemberDeclarationSyntax
@@ -34,43 +31,4 @@ public static bool TryGetMemberByName<T>(this ClassDeclarationSyntax declaration
3431
.FirstOrDefault()?.Identifier.ValueText,
3532
_ => null
3633
};
37-
38-
39-
40-
public static bool TryFindNode<T>(this SyntaxNode node, TextSpan span, out T? value) where T : SyntaxNode?
41-
{
42-
try
43-
{
44-
value = (T)node.FindNode(span);
45-
return true;
46-
}
47-
catch
48-
{
49-
value = default;
50-
return false;
51-
}
52-
}
53-
54-
public static Location GetFullMethodLocation(this MethodDeclarationSyntax method)
55-
{
56-
int start = method.GetFirstToken().SpanStart;
57-
58-
int end;
59-
if (method.Body != null)
60-
end = method.Body.CloseBraceToken.FullSpan.End;
61-
else if (method.ExpressionBody != null)
62-
end = method.ExpressionBody.Expression.FullSpan.End;
63-
else
64-
end = method.ParameterList.FullSpan.End;
65-
66-
67-
TextSpan span = TextSpan.FromBounds(start, end);
68-
69-
SyntaxTree syntaxTree = method.SyntaxTree;
70-
string filePath = syntaxTree.FilePath;
71-
72-
Location location = Location.Create(filePath, span, syntaxTree.GetLineSpan(span).Span);
73-
74-
return location;
75-
}
7634
}

src/Liquip.Patcher.Analyzer/Liquip.Patcher.Analyzer.csproj

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@
44
<RootNamespace>Liquip.Patcher.Analyzer</RootNamespace>
55
<OutputType>Library</OutputType>
66
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
7+
78
<!-- Avoid ID conflicts with the package project. -->
89
<PackageId>$(MSBuildProjectFile)</PackageId>
910
</PropertyGroup>
11+
1012
<ItemGroup>
1113
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
1214
<PrivateAssets>all</PrivateAssets>
1315
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1416
</PackageReference>
1517
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
16-
<PackageReference Include="Polyfill">
17-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18-
<PrivateAssets>all</PrivateAssets>
19-
</PackageReference>
2018
</ItemGroup>
2119
</Project>

0 commit comments

Comments
 (0)