Browse Source

Fixup 1st commit

ast-source-generator
Siegfried Pammer 2 months ago
parent
commit
71173337fc
  1. 10
      ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/IdentifierExpressionBackreference.cs
  2. 19
      ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

10
ICSharpCode.Decompiler/CSharp/Syntax/IdentifierExpressionBackreference.cs → ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/IdentifierExpressionBackreference.cs

@ -19,12 +19,12 @@ @@ -19,12 +19,12 @@
using System;
using System.Linq;
namespace ICSharpCode.Decompiler.CSharp.Syntax
namespace ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching
{
/// <summary>
/// Matches identifier expressions that have the same identifier as the referenced variable/type definition/method definition.
/// </summary>
public class IdentifierExpressionBackreference : PatternMatching.Pattern
public class IdentifierExpressionBackreference : Pattern
{
readonly string referencedGroupName;
@ -39,12 +39,12 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -39,12 +39,12 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
this.referencedGroupName = referencedGroupName;
}
public override bool DoMatch(PatternMatching.INode other, PatternMatching.Match match)
public override bool DoMatch(INode other, Match match)
{
IdentifierExpression ident = other as IdentifierExpression;
var ident = other as IdentifierExpression;
if (ident == null || ident.TypeArguments.Any())
return false;
AstNode referenced = (AstNode)match.Get(referencedGroupName).Last();
var referenced = (AstNode)match.Get(referencedGroupName).Last();
if (referenced == null)
return false;
return ident.Identifier == referenced.GetChildByRole(Roles.Identifier).Name;

19
ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
<GenerateAssemblyInformationalVersionAttribute>False</GenerateAssemblyInformationalVersionAttribute>
<EnableDefaultItems>false</EnableDefaultItems>
<LangVersion>11</LangVersion>
<LangVersion>preview</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>ICSharpCode.Decompiler.snk</AssemblyOriginatorKeyFile>
@ -99,6 +99,11 @@ @@ -99,6 +99,11 @@
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[8.0.0]" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ICSharpCode.Decompiler.Generators\ICSharpCode.Decompiler.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="..\ICSharpCode.Decompiler.Generators.Attributes\ICSharpCode.Decompiler.Generators.Attributes.csproj" OutputItemType="Analyzer" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<Compile Include="CSharp\Annotations.cs" />
<Compile Include="CSharp\CallBuilder.cs" />
@ -108,6 +113,11 @@ @@ -108,6 +113,11 @@
<Compile Include="Disassembler\IEntityProcessor.cs" />
<Compile Include="Disassembler\SortByNameProcessor.cs" />
<Compile Include="IL\Transforms\RemoveUnconstrainedGenericReferenceTypeCheck.cs" />
<Compile Include="IL\Instructions.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Instructions.tt</DependentUpon>
</Compile>
<Compile Include="Metadata\MetadataFile.cs" />
<Compile Include="Metadata\ModuleReferenceMetadata.cs" />
<Compile Include="NRTAttributes.cs" />
@ -227,7 +237,7 @@ @@ -227,7 +237,7 @@
<Compile Include="CSharp\Syntax\GeneralScope\UsingDeclaration.cs" />
<Compile Include="CSharp\Syntax\IAstVisitor.cs" />
<Compile Include="CSharp\Syntax\Identifier.cs" />
<Compile Include="CSharp\Syntax\IdentifierExpressionBackreference.cs" />
<Compile Include="CSharp\Syntax\PatternMatching\IdentifierExpressionBackreference.cs" />
<Compile Include="CSharp\Syntax\MemberType.cs" />
<Compile Include="CSharp\Syntax\Modifiers.cs" />
<Compile Include="CSharp\Syntax\NodeType.cs" />
@ -505,11 +515,6 @@ @@ -505,11 +515,6 @@
<Compile Include="IL\ControlFlow\LoopDetection.cs" />
<Compile Include="IL\ControlFlow\SwitchAnalysis.cs" />
<Compile Include="IL\ControlFlow\SwitchDetection.cs" />
<Compile Include="IL\Instructions.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Instructions.tt</DependentUpon>
</Compile>
<Compile Include="IL\Instructions\Comp.cs" />
<Compile Include="IL\Instructions\BinaryNumericInstruction.cs" />
<Compile Include="IL\Instructions\Block.cs" />

Loading…
Cancel
Save