mirror of https://github.com/icsharpcode/ILSpy.git
132 changed files with 943 additions and 3863 deletions
@ -0,0 +1,384 @@
@@ -0,0 +1,384 @@
|
||||
using System.Collections; |
||||
using System.Collections.Immutable; |
||||
using System.Text; |
||||
|
||||
using Microsoft.CodeAnalysis; |
||||
using Microsoft.CodeAnalysis.CSharp; |
||||
using Microsoft.CodeAnalysis.CSharp.Syntax; |
||||
using Microsoft.CodeAnalysis.Text; |
||||
|
||||
namespace ICSharpCode.Decompiler.Generators; |
||||
|
||||
[Generator] |
||||
internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator |
||||
{ |
||||
record AstNodeAdditions(string NodeName, bool NeedsAcceptImpls, bool NeedsVisitor, bool NeedsNullNode, bool NeedsPatternPlaceholder, int NullNodeBaseCtorParamCount, bool IsTypeNode, string VisitMethodName, string VisitMethodParamType, EquatableArray<(string Member, string TypeName, bool RecursiveMatch, bool MatchAny)>? MembersToMatch); |
||||
|
||||
AstNodeAdditions GetAstNodeAdditions(GeneratorAttributeSyntaxContext context, CancellationToken ct) |
||||
{ |
||||
var targetSymbol = (INamedTypeSymbol)context.TargetSymbol; |
||||
var attribute = context.Attributes.SingleOrDefault(ad => ad.AttributeClass?.Name == "DecompilerAstNodeAttribute")!; |
||||
var (visitMethodName, paramTypeName) = targetSymbol.Name switch { |
||||
"ErrorExpression" => ("ErrorNode", "AstNode"), |
||||
string s when s.Contains("AstType") => (s.Replace("AstType", "Type"), s), |
||||
_ => (targetSymbol.Name, targetSymbol.Name), |
||||
}; |
||||
|
||||
List<(string Member, string TypeName, bool RecursiveMatch, bool MatchAny)>? membersToMatch = null; |
||||
|
||||
if (!targetSymbol.MemberNames.Contains("DoMatch")) |
||||
{ |
||||
membersToMatch = new(); |
||||
|
||||
var astNodeType = (INamedTypeSymbol)context.SemanticModel.GetSpeculativeSymbolInfo(context.TargetNode.Span.Start, SyntaxFactory.ParseTypeName("AstNode"), SpeculativeBindingOption.BindAsTypeOrNamespace).Symbol!; |
||||
|
||||
if (targetSymbol.BaseType!.MemberNames.Contains("MatchAttributesAndModifiers")) |
||||
membersToMatch.Add(("MatchAttributesAndModifiers", null!, false, false)); |
||||
|
||||
foreach (var m in targetSymbol.GetMembers()) |
||||
{ |
||||
if (m is not IPropertySymbol property || property.IsIndexer || property.IsOverride) |
||||
continue; |
||||
if (property.GetAttributes().Any(a => a.AttributeClass?.Name == "ExcludeFromMatchAttribute")) |
||||
continue; |
||||
if (property.Type.MetadataName is "CSharpTokenNode" or "TextLocation") |
||||
continue; |
||||
switch (property.Type) |
||||
{ |
||||
case INamedTypeSymbol named when named.IsDerivedFrom(astNodeType) || named.MetadataName == "AstNodeCollection`1": |
||||
membersToMatch.Add((property.Name, named.Name, true, false)); |
||||
break; |
||||
case INamedTypeSymbol { TypeKind: TypeKind.Enum } named when named.GetMembers().Any(_ => _.Name == "Any"): |
||||
membersToMatch.Add((property.Name, named.Name, false, true)); |
||||
break; |
||||
default: |
||||
membersToMatch.Add((property.Name, property.Type.Name, false, false)); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return new(targetSymbol.Name, !targetSymbol.MemberNames.Contains("AcceptVisitor"), |
||||
NeedsVisitor: !targetSymbol.IsAbstract && targetSymbol.BaseType!.IsAbstract, |
||||
NeedsNullNode: (bool)attribute.ConstructorArguments[0].Value!, |
||||
NeedsPatternPlaceholder: (bool)attribute.ConstructorArguments[1].Value!, |
||||
NullNodeBaseCtorParamCount: targetSymbol.InstanceConstructors.Min(m => m.Parameters.Length), |
||||
IsTypeNode: targetSymbol.Name == "AstType" || targetSymbol.BaseType?.Name == "AstType", |
||||
visitMethodName, paramTypeName, membersToMatch?.ToEquatableArray()); |
||||
} |
||||
|
||||
void WriteGeneratedMembers(SourceProductionContext context, AstNodeAdditions source) |
||||
{ |
||||
var builder = new StringBuilder(); |
||||
|
||||
builder.AppendLine("namespace ICSharpCode.Decompiler.CSharp.Syntax;"); |
||||
builder.AppendLine(); |
||||
|
||||
if (source.NeedsPatternPlaceholder) |
||||
{ |
||||
builder.AppendLine("using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching;"); |
||||
} |
||||
|
||||
builder.AppendLine(); |
||||
|
||||
builder.AppendLine("#nullable enable"); |
||||
builder.AppendLine(); |
||||
|
||||
builder.AppendLine($"partial class {source.NodeName}"); |
||||
builder.AppendLine("{"); |
||||
|
||||
if (source.NeedsNullNode) |
||||
{ |
||||
bool needsNew = source.NodeName != "AstNode"; |
||||
|
||||
builder.AppendLine($" {(needsNew ? "new " : "")}public static readonly {source.NodeName} Null = new Null{source.NodeName}();"); |
||||
|
||||
builder.AppendLine($@"
|
||||
sealed class Null{source.NodeName} : {source.NodeName} |
||||
{{ |
||||
public override NodeType NodeType => NodeType.Unknown; |
||||
|
||||
public override bool IsNull => true; |
||||
|
||||
public override void AcceptVisitor(IAstVisitor visitor) |
||||
{{ |
||||
visitor.VisitNullNode(this); |
||||
}} |
||||
|
||||
public override T AcceptVisitor<T>(IAstVisitor<T> visitor) |
||||
{{ |
||||
return visitor.VisitNullNode(this); |
||||
}} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{{ |
||||
return visitor.VisitNullNode(this, data); |
||||
}} |
||||
|
||||
protected internal override bool DoMatch(AstNode? other, PatternMatching.Match match) |
||||
{{ |
||||
return other == null || other.IsNull; |
||||
}}");
|
||||
|
||||
if (source.IsTypeNode) |
||||
{ |
||||
builder.AppendLine( |
||||
$@"
|
||||
|
||||
public override Decompiler.TypeSystem.ITypeReference ToTypeReference(Resolver.NameLookupMode lookupMode, Decompiler.TypeSystem.InterningProvider? interningProvider = null) |
||||
{{ |
||||
return Decompiler.TypeSystem.SpecialType.UnknownType; |
||||
}}"
|
||||
); |
||||
} |
||||
|
||||
if (source.NullNodeBaseCtorParamCount > 0) |
||||
{ |
||||
builder.AppendLine($@"
|
||||
|
||||
public Null{source.NodeName}() : base({string.Join(", ", Enumerable.Repeat("default", source.NullNodeBaseCtorParamCount))}) {{ }}");
|
||||
} |
||||
|
||||
builder.AppendLine($@"
|
||||
}} |
||||
|
||||
");
|
||||
|
||||
} |
||||
|
||||
if (source.NeedsPatternPlaceholder) |
||||
{ |
||||
const string toTypeReferenceCode = @"
|
||||
|
||||
public override Decompiler.TypeSystem.ITypeReference ToTypeReference(Resolver.NameLookupMode lookupMode, Decompiler.TypeSystem.InterningProvider? interningProvider = null) |
||||
{ |
||||
throw new System.NotSupportedException(); |
||||
}";
|
||||
|
||||
builder.Append( |
||||
$@" public static implicit operator {source.NodeName}?(PatternMatching.Pattern? pattern)
|
||||
{{ |
||||
return pattern != null ? new PatternPlaceholder(pattern) : null; |
||||
}} |
||||
|
||||
sealed class PatternPlaceholder : {source.NodeName}, INode |
||||
{{ |
||||
readonly PatternMatching.Pattern child; |
||||
|
||||
public PatternPlaceholder(PatternMatching.Pattern child) |
||||
{{ |
||||
this.child = child; |
||||
}} |
||||
|
||||
public override NodeType NodeType {{ |
||||
get {{ return NodeType.Pattern; }} |
||||
}} |
||||
|
||||
public override void AcceptVisitor(IAstVisitor visitor) |
||||
{{ |
||||
visitor.VisitPatternPlaceholder(this, child); |
||||
}} |
||||
|
||||
public override T AcceptVisitor<T>(IAstVisitor<T> visitor) |
||||
{{ |
||||
return visitor.VisitPatternPlaceholder(this, child); |
||||
}} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{{ |
||||
return visitor.VisitPatternPlaceholder(this, child, data); |
||||
}} |
||||
|
||||
protected internal override bool DoMatch(AstNode? other, PatternMatching.Match match) |
||||
{{ |
||||
return child.DoMatch(other, match); |
||||
}} |
||||
|
||||
bool PatternMatching.INode.DoMatchCollection(Role? role, PatternMatching.INode? pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) |
||||
{{ |
||||
return child.DoMatchCollection(role, pos, match, backtrackingInfo); |
||||
}}{(source.NodeName == "AstType" ? toTypeReferenceCode : "")} |
||||
}} |
||||
"
|
||||
); |
||||
} |
||||
|
||||
if (source.NeedsAcceptImpls && source.NeedsVisitor) |
||||
{ |
||||
builder.Append($@" public override void AcceptVisitor(IAstVisitor visitor)
|
||||
{{ |
||||
visitor.Visit{source.VisitMethodName}(this); |
||||
}} |
||||
|
||||
public override T AcceptVisitor<T>(IAstVisitor<T> visitor) |
||||
{{ |
||||
return visitor.Visit{source.VisitMethodName}(this); |
||||
}} |
||||
|
||||
public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data) |
||||
{{ |
||||
return visitor.Visit{source.VisitMethodName}(this, data); |
||||
}} |
||||
");
|
||||
} |
||||
|
||||
if (source.MembersToMatch != null) |
||||
{ |
||||
builder.Append($@" protected internal override bool DoMatch(AstNode? other, PatternMatching.Match match)
|
||||
{{ |
||||
return other is {source.NodeName} o && !o.IsNull");
|
||||
|
||||
foreach (var (member, typeName, recursive, hasAny) in source.MembersToMatch) |
||||
{ |
||||
if (member == "MatchAttributesAndModifiers") |
||||
{ |
||||
builder.Append($"\r\n\t\t\t&& this.MatchAttributesAndModifiers(o, match)"); |
||||
} |
||||
else if (recursive) |
||||
{ |
||||
builder.Append($"\r\n\t\t\t&& this.{member}.DoMatch(o.{member}, match)"); |
||||
} |
||||
else if (hasAny) |
||||
{ |
||||
builder.Append($"\r\n\t\t\t&& (this.{member} == {typeName}.Any || this.{member} == o.{member})"); |
||||
} |
||||
else if (typeName == "String") |
||||
{ |
||||
builder.Append($"\r\n\t\t\t&& MatchString(this.{member}, o.{member})"); |
||||
} |
||||
else |
||||
{ |
||||
builder.Append($"\r\n\t\t\t&& this.{member} == o.{member}"); |
||||
} |
||||
} |
||||
|
||||
builder.Append(@";
|
||||
} |
||||
");
|
||||
} |
||||
|
||||
builder.AppendLine("}"); |
||||
|
||||
context.AddSource(source.NodeName + ".g.cs", SourceText.From(builder.ToString(), Encoding.UTF8)); |
||||
} |
||||
|
||||
void WriteVisitors(SourceProductionContext context, ImmutableArray<AstNodeAdditions> source) |
||||
{ |
||||
var builder = new StringBuilder(); |
||||
|
||||
builder.AppendLine("namespace ICSharpCode.Decompiler.CSharp.Syntax;"); |
||||
|
||||
source = source |
||||
.Concat([new("NullNode", false, true, false, false, 0, false, "NullNode", "AstNode", null), new("PatternPlaceholder", false, true, false, false, 0, false, "PatternPlaceholder", "AstNode", null)]) |
||||
.ToImmutableArray(); |
||||
|
||||
WriteInterface("IAstVisitor", "void", ""); |
||||
WriteInterface("IAstVisitor<out S>", "S", ""); |
||||
WriteInterface("IAstVisitor<in T, out S>", "S", ", T data"); |
||||
|
||||
context.AddSource("IAstVisitor.g.cs", SourceText.From(builder.ToString(), Encoding.UTF8)); |
||||
|
||||
void WriteInterface(string name, string ret, string param) |
||||
{ |
||||
builder.AppendLine($"public interface {name}"); |
||||
builder.AppendLine("{"); |
||||
|
||||
foreach (var type in source.OrderBy(t => t.VisitMethodName)) |
||||
{ |
||||
if (!type.NeedsVisitor) |
||||
continue; |
||||
|
||||
string extParams, paramName; |
||||
if (type.VisitMethodName == "PatternPlaceholder") |
||||
{ |
||||
paramName = "placeholder"; |
||||
extParams = ", PatternMatching.Pattern pattern" + param; |
||||
} |
||||
else |
||||
{ |
||||
paramName = char.ToLowerInvariant(type.VisitMethodName[0]) + type.VisitMethodName.Substring(1); |
||||
extParams = param; |
||||
} |
||||
|
||||
builder.AppendLine($"\t{ret} Visit{type.VisitMethodName}({type.VisitMethodParamType} {paramName}{extParams});"); |
||||
} |
||||
|
||||
builder.AppendLine("}"); |
||||
} |
||||
} |
||||
|
||||
public void Initialize(IncrementalGeneratorInitializationContext context) |
||||
{ |
||||
var astNodeAdditions = context.SyntaxProvider.ForAttributeWithMetadataName( |
||||
"ICSharpCode.Decompiler.CSharp.Syntax.DecompilerAstNodeAttribute", |
||||
(n, ct) => n is ClassDeclarationSyntax, |
||||
GetAstNodeAdditions); |
||||
|
||||
var visitorMembers = astNodeAdditions.Collect(); |
||||
|
||||
context |
||||
.RegisterPostInitializationOutput(i => i.AddSource("DecompilerSyntaxTreeGeneratorAttributes.g.cs", @"
|
||||
|
||||
using System; |
||||
|
||||
namespace Microsoft.CodeAnalysis |
||||
{ |
||||
internal sealed partial class EmbeddedAttribute : global::System.Attribute |
||||
{ |
||||
} |
||||
} |
||||
|
||||
namespace ICSharpCode.Decompiler.CSharp.Syntax |
||||
{ |
||||
[global::Microsoft.CodeAnalysis.EmbeddedAttribute] |
||||
sealed class DecompilerAstNodeAttribute : global::System.Attribute |
||||
{ |
||||
public DecompilerAstNodeAttribute(bool hasNullNode = false, bool hasPatternPlaceholder = false) { } |
||||
} |
||||
|
||||
[global::Microsoft.CodeAnalysis.EmbeddedAttribute] |
||||
sealed class ExcludeFromMatchAttribute : global::System.Attribute |
||||
{ |
||||
} |
||||
} |
||||
|
||||
"));
|
||||
|
||||
context.RegisterSourceOutput(astNodeAdditions, WriteGeneratedMembers); |
||||
context.RegisterSourceOutput(visitorMembers, WriteVisitors); |
||||
} |
||||
} |
||||
|
||||
readonly struct EquatableArray<T> : IEquatable<EquatableArray<T>>, IEnumerable<T> |
||||
where T : IEquatable<T> |
||||
{ |
||||
readonly T[] array; |
||||
|
||||
public EquatableArray(T[] array) |
||||
{ |
||||
this.array = array ?? throw new ArgumentNullException(nameof(array)); |
||||
} |
||||
|
||||
public bool Equals(EquatableArray<T> other) |
||||
{ |
||||
return other.array.AsSpan().SequenceEqual(this.array); |
||||
} |
||||
|
||||
public IEnumerator<T> GetEnumerator() |
||||
{ |
||||
return ((IEnumerable<T>)array).GetEnumerator(); |
||||
} |
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() |
||||
{ |
||||
return array.GetEnumerator(); |
||||
} |
||||
} |
||||
|
||||
static class EquatableArrayExtensions |
||||
{ |
||||
public static EquatableArray<T> ToEquatableArray<T>(this List<T> array) where T : IEquatable<T> |
||||
{ |
||||
return new EquatableArray<T>(array.ToArray()); |
||||
} |
||||
} |
||||
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
||||
<PropertyGroup> |
||||
<TargetFramework>netstandard2.0</TargetFramework> |
||||
<ImplicitUsings>enable</ImplicitUsings> |
||||
<Nullable>enable</Nullable> |
||||
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> |
||||
<LangVersion>12</LangVersion> |
||||
</PropertyGroup> |
||||
|
||||
<ItemGroup> |
||||
<PackageReference Include="Microsoft.CodeAnalysis" /> |
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" /> |
||||
</ItemGroup> |
||||
|
||||
</Project> |
||||
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
namespace System.Runtime.CompilerServices; |
||||
|
||||
class IsExternalInit { } |
||||
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
using Microsoft.CodeAnalysis; |
||||
|
||||
namespace ICSharpCode.Decompiler.Generators; |
||||
|
||||
public static class RoslynHelpers |
||||
{ |
||||
public static IEnumerable<INamedTypeSymbol> GetTopLevelTypes(this IAssemblySymbol assembly) |
||||
{ |
||||
foreach (var ns in TreeTraversal.PreOrder(assembly.GlobalNamespace, ns => ns.GetNamespaceMembers())) |
||||
{ |
||||
foreach (var t in ns.GetTypeMembers()) |
||||
{ |
||||
yield return t; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static bool IsDerivedFrom(this INamedTypeSymbol type, INamedTypeSymbol baseType) |
||||
{ |
||||
INamedTypeSymbol? t = type; |
||||
|
||||
while (t != null) |
||||
{ |
||||
if (SymbolEqualityComparer.Default.Equals(t, baseType)) |
||||
return true; |
||||
|
||||
t = t.BaseType; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
} |
||||
@ -0,0 +1,125 @@
@@ -0,0 +1,125 @@
|
||||
#nullable enable |
||||
// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// 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.
|
||||
|
||||
namespace ICSharpCode.Decompiler.Generators; |
||||
|
||||
/// <summary>
|
||||
/// Static helper methods for traversing trees.
|
||||
/// </summary>
|
||||
internal static class TreeTraversal |
||||
{ |
||||
/// <summary>
|
||||
/// Converts a tree data structure into a flat list by traversing it in pre-order.
|
||||
/// </summary>
|
||||
/// <param name="root">The root element of the tree.</param>
|
||||
/// <param name="recursion">The function that gets the children of an element.</param>
|
||||
/// <returns>Iterator that enumerates the tree structure in pre-order.</returns>
|
||||
public static IEnumerable<T> PreOrder<T>(T root, Func<T, IEnumerable<T>?> recursion) |
||||
{ |
||||
return PreOrder(new T[] { root }, recursion); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Converts a tree data structure into a flat list by traversing it in pre-order.
|
||||
/// </summary>
|
||||
/// <param name="input">The root elements of the forest.</param>
|
||||
/// <param name="recursion">The function that gets the children of an element.</param>
|
||||
/// <returns>Iterator that enumerates the tree structure in pre-order.</returns>
|
||||
public static IEnumerable<T> PreOrder<T>(IEnumerable<T> input, Func<T, IEnumerable<T>?> recursion) |
||||
{ |
||||
Stack<IEnumerator<T>> stack = new Stack<IEnumerator<T>>(); |
||||
try |
||||
{ |
||||
stack.Push(input.GetEnumerator()); |
||||
while (stack.Count > 0) |
||||
{ |
||||
while (stack.Peek().MoveNext()) |
||||
{ |
||||
T element = stack.Peek().Current; |
||||
yield return element; |
||||
IEnumerable<T>? children = recursion(element); |
||||
if (children != null) |
||||
{ |
||||
stack.Push(children.GetEnumerator()); |
||||
} |
||||
} |
||||
stack.Pop().Dispose(); |
||||
} |
||||
} |
||||
finally |
||||
{ |
||||
while (stack.Count > 0) |
||||
{ |
||||
stack.Pop().Dispose(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Converts a tree data structure into a flat list by traversing it in post-order.
|
||||
/// </summary>
|
||||
/// <param name="root">The root element of the tree.</param>
|
||||
/// <param name="recursion">The function that gets the children of an element.</param>
|
||||
/// <returns>Iterator that enumerates the tree structure in post-order.</returns>
|
||||
public static IEnumerable<T> PostOrder<T>(T root, Func<T, IEnumerable<T>?> recursion) |
||||
{ |
||||
return PostOrder(new T[] { root }, recursion); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Converts a tree data structure into a flat list by traversing it in post-order.
|
||||
/// </summary>
|
||||
/// <param name="input">The root elements of the forest.</param>
|
||||
/// <param name="recursion">The function that gets the children of an element.</param>
|
||||
/// <returns>Iterator that enumerates the tree structure in post-order.</returns>
|
||||
public static IEnumerable<T> PostOrder<T>(IEnumerable<T> input, Func<T, IEnumerable<T>?> recursion) |
||||
{ |
||||
Stack<IEnumerator<T>> stack = new Stack<IEnumerator<T>>(); |
||||
try |
||||
{ |
||||
stack.Push(input.GetEnumerator()); |
||||
while (stack.Count > 0) |
||||
{ |
||||
while (stack.Peek().MoveNext()) |
||||
{ |
||||
T element = stack.Peek().Current; |
||||
IEnumerable<T>? children = recursion(element); |
||||
if (children != null) |
||||
{ |
||||
stack.Push(children.GetEnumerator()); |
||||
} |
||||
else |
||||
{ |
||||
yield return element; |
||||
} |
||||
} |
||||
stack.Pop().Dispose(); |
||||
if (stack.Count > 0) |
||||
yield return stack.Peek().Current; |
||||
} |
||||
} |
||||
finally |
||||
{ |
||||
while (stack.Count > 0) |
||||
{ |
||||
stack.Pop().Dispose(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
// 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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace ICSharpCode.Decompiler.CSharp.Syntax |
||||
{ |
||||
class DecompilerAstNodeAttribute : System.Attribute |
||||
{ |
||||
} |
||||
} |
||||
@ -1,468 +0,0 @@
@@ -1,468 +0,0 @@
|
||||
// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// 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.
|
||||
|
||||
|
||||
namespace ICSharpCode.Decompiler.CSharp.Syntax |
||||
{ |
||||
/// <summary>
|
||||
/// AST visitor.
|
||||
/// </summary>
|
||||
public interface IAstVisitor |
||||
{ |
||||
void VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression); |
||||
void VisitAnonymousTypeCreateExpression(AnonymousTypeCreateExpression anonymousTypeCreateExpression); |
||||
void VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression); |
||||
void VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression); |
||||
void VisitAsExpression(AsExpression asExpression); |
||||
void VisitAssignmentExpression(AssignmentExpression assignmentExpression); |
||||
void VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression); |
||||
void VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression); |
||||
void VisitCastExpression(CastExpression castExpression); |
||||
void VisitCheckedExpression(CheckedExpression checkedExpression); |
||||
void VisitConditionalExpression(ConditionalExpression conditionalExpression); |
||||
void VisitDeclarationExpression(DeclarationExpression declarationExpression); |
||||
void VisitRecursivePatternExpression(RecursivePatternExpression recursivePatternExpression); |
||||
void VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression); |
||||
void VisitDirectionExpression(DirectionExpression directionExpression); |
||||
void VisitIdentifierExpression(IdentifierExpression identifierExpression); |
||||
void VisitIndexerExpression(IndexerExpression indexerExpression); |
||||
void VisitInterpolatedStringExpression(InterpolatedStringExpression interpolatedStringExpression); |
||||
void VisitInvocationExpression(InvocationExpression invocationExpression); |
||||
void VisitIsExpression(IsExpression isExpression); |
||||
void VisitLambdaExpression(LambdaExpression lambdaExpression); |
||||
void VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression); |
||||
void VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression); |
||||
void VisitNamedExpression(NamedExpression namedExpression); |
||||
void VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression); |
||||
void VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression); |
||||
void VisitOutVarDeclarationExpression(OutVarDeclarationExpression outVarDeclarationExpression); |
||||
void VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression); |
||||
void VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression); |
||||
void VisitPrimitiveExpression(PrimitiveExpression primitiveExpression); |
||||
void VisitSizeOfExpression(SizeOfExpression sizeOfExpression); |
||||
void VisitStackAllocExpression(StackAllocExpression stackAllocExpression); |
||||
void VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression); |
||||
void VisitThrowExpression(ThrowExpression throwExpression); |
||||
void VisitTupleExpression(TupleExpression tupleExpression); |
||||
void VisitTypeOfExpression(TypeOfExpression typeOfExpression); |
||||
void VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression); |
||||
void VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression); |
||||
void VisitUncheckedExpression(UncheckedExpression uncheckedExpression); |
||||
void VisitUndocumentedExpression(UndocumentedExpression undocumentedExpression); |
||||
void VisitWithInitializerExpression(WithInitializerExpression withInitializerExpression); |
||||
|
||||
void VisitQueryExpression(QueryExpression queryExpression); |
||||
void VisitQueryContinuationClause(QueryContinuationClause queryContinuationClause); |
||||
void VisitQueryFromClause(QueryFromClause queryFromClause); |
||||
void VisitQueryLetClause(QueryLetClause queryLetClause); |
||||
void VisitQueryWhereClause(QueryWhereClause queryWhereClause); |
||||
void VisitQueryJoinClause(QueryJoinClause queryJoinClause); |
||||
void VisitQueryOrderClause(QueryOrderClause queryOrderClause); |
||||
void VisitQueryOrdering(QueryOrdering queryOrdering); |
||||
void VisitQuerySelectClause(QuerySelectClause querySelectClause); |
||||
void VisitQueryGroupClause(QueryGroupClause queryGroupClause); |
||||
|
||||
void VisitAttribute(Attribute attribute); |
||||
void VisitAttributeSection(AttributeSection attributeSection); |
||||
void VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration); |
||||
void VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration); |
||||
void VisitTypeDeclaration(TypeDeclaration typeDeclaration); |
||||
void VisitUsingAliasDeclaration(UsingAliasDeclaration usingAliasDeclaration); |
||||
void VisitUsingDeclaration(UsingDeclaration usingDeclaration); |
||||
void VisitExternAliasDeclaration(ExternAliasDeclaration externAliasDeclaration); |
||||
|
||||
void VisitBlockStatement(BlockStatement blockStatement); |
||||
void VisitBreakStatement(BreakStatement breakStatement); |
||||
void VisitCheckedStatement(CheckedStatement checkedStatement); |
||||
void VisitContinueStatement(ContinueStatement continueStatement); |
||||
void VisitDoWhileStatement(DoWhileStatement doWhileStatement); |
||||
void VisitEmptyStatement(EmptyStatement emptyStatement); |
||||
void VisitExpressionStatement(ExpressionStatement expressionStatement); |
||||
void VisitFixedStatement(FixedStatement fixedStatement); |
||||
void VisitForeachStatement(ForeachStatement foreachStatement); |
||||
void VisitForStatement(ForStatement forStatement); |
||||
void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement); |
||||
void VisitGotoDefaultStatement(GotoDefaultStatement gotoDefaultStatement); |
||||
void VisitGotoStatement(GotoStatement gotoStatement); |
||||
void VisitIfElseStatement(IfElseStatement ifElseStatement); |
||||
void VisitLabelStatement(LabelStatement labelStatement); |
||||
void VisitLockStatement(LockStatement lockStatement); |
||||
void VisitReturnStatement(ReturnStatement returnStatement); |
||||
void VisitSwitchStatement(SwitchStatement switchStatement); |
||||
void VisitSwitchSection(SwitchSection switchSection); |
||||
void VisitCaseLabel(CaseLabel caseLabel); |
||||
void VisitSwitchExpression(SwitchExpression switchExpression); |
||||
void VisitSwitchExpressionSection(SwitchExpressionSection switchExpressionSection); |
||||
void VisitThrowStatement(ThrowStatement throwStatement); |
||||
void VisitTryCatchStatement(TryCatchStatement tryCatchStatement); |
||||
void VisitCatchClause(CatchClause catchClause); |
||||
void VisitUncheckedStatement(UncheckedStatement uncheckedStatement); |
||||
void VisitUnsafeStatement(UnsafeStatement unsafeStatement); |
||||
void VisitUsingStatement(UsingStatement usingStatement); |
||||
void VisitVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement); |
||||
void VisitLocalFunctionDeclarationStatement(LocalFunctionDeclarationStatement localFunctionDeclarationStatement); |
||||
void VisitWhileStatement(WhileStatement whileStatement); |
||||
void VisitYieldBreakStatement(YieldBreakStatement yieldBreakStatement); |
||||
void VisitYieldReturnStatement(YieldReturnStatement yieldReturnStatement); |
||||
|
||||
void VisitAccessor(Accessor accessor); |
||||
void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration); |
||||
void VisitConstructorInitializer(ConstructorInitializer constructorInitializer); |
||||
void VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration); |
||||
void VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration); |
||||
void VisitEventDeclaration(EventDeclaration eventDeclaration); |
||||
void VisitCustomEventDeclaration(CustomEventDeclaration customEventDeclaration); |
||||
void VisitFieldDeclaration(FieldDeclaration fieldDeclaration); |
||||
void VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration); |
||||
void VisitMethodDeclaration(MethodDeclaration methodDeclaration); |
||||
void VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration); |
||||
void VisitParameterDeclaration(ParameterDeclaration parameterDeclaration); |
||||
void VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration); |
||||
void VisitVariableInitializer(VariableInitializer variableInitializer); |
||||
void VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration); |
||||
void VisitFixedVariableInitializer(FixedVariableInitializer fixedVariableInitializer); |
||||
|
||||
void VisitSyntaxTree(SyntaxTree syntaxTree); |
||||
void VisitSimpleType(SimpleType simpleType); |
||||
void VisitMemberType(MemberType memberType); |
||||
void VisitTupleType(TupleAstType tupleType); |
||||
void VisitTupleTypeElement(TupleTypeElement tupleTypeElement); |
||||
void VisitFunctionPointerType(FunctionPointerAstType functionPointerType); |
||||
void VisitInvocationType(InvocationAstType invocationType); |
||||
void VisitComposedType(ComposedType composedType); |
||||
void VisitArraySpecifier(ArraySpecifier arraySpecifier); |
||||
void VisitPrimitiveType(PrimitiveType primitiveType); |
||||
|
||||
void VisitComment(Comment comment); |
||||
void VisitPreProcessorDirective(PreProcessorDirective preProcessorDirective); |
||||
void VisitDocumentationReference(DocumentationReference documentationReference); |
||||
|
||||
void VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration); |
||||
void VisitConstraint(Constraint constraint); |
||||
void VisitCSharpTokenNode(CSharpTokenNode cSharpTokenNode); |
||||
void VisitIdentifier(Identifier identifier); |
||||
|
||||
void VisitInterpolation(Interpolation interpolation); |
||||
void VisitInterpolatedStringText(InterpolatedStringText interpolatedStringText); |
||||
|
||||
void VisitSingleVariableDesignation(SingleVariableDesignation singleVariableDesignation); |
||||
void VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignation parenthesizedVariableDesignation); |
||||
|
||||
void VisitNullNode(AstNode nullNode); |
||||
void VisitErrorNode(AstNode errorNode); |
||||
void VisitPatternPlaceholder(AstNode placeholder, PatternMatching.Pattern pattern); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// AST visitor.
|
||||
/// </summary>
|
||||
public interface IAstVisitor<out S> |
||||
{ |
||||
S VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression); |
||||
S VisitAnonymousTypeCreateExpression(AnonymousTypeCreateExpression anonymousTypeCreateExpression); |
||||
S VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression); |
||||
S VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression); |
||||
S VisitAsExpression(AsExpression asExpression); |
||||
S VisitAssignmentExpression(AssignmentExpression assignmentExpression); |
||||
S VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression); |
||||
S VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression); |
||||
S VisitCastExpression(CastExpression castExpression); |
||||
S VisitCheckedExpression(CheckedExpression checkedExpression); |
||||
S VisitConditionalExpression(ConditionalExpression conditionalExpression); |
||||
S VisitDeclarationExpression(DeclarationExpression declarationExpression); |
||||
S VisitRecursivePatternExpression(RecursivePatternExpression recursivePatternExpression); |
||||
S VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression); |
||||
S VisitDirectionExpression(DirectionExpression directionExpression); |
||||
S VisitIdentifierExpression(IdentifierExpression identifierExpression); |
||||
S VisitIndexerExpression(IndexerExpression indexerExpression); |
||||
S VisitInterpolatedStringExpression(InterpolatedStringExpression interpolatedStringExpression); |
||||
S VisitInvocationExpression(InvocationExpression invocationExpression); |
||||
S VisitIsExpression(IsExpression isExpression); |
||||
S VisitLambdaExpression(LambdaExpression lambdaExpression); |
||||
S VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression); |
||||
S VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression); |
||||
S VisitNamedExpression(NamedExpression namedExpression); |
||||
S VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression); |
||||
S VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression); |
||||
S VisitOutVarDeclarationExpression(OutVarDeclarationExpression outVarDeclarationExpression); |
||||
S VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression); |
||||
S VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression); |
||||
S VisitPrimitiveExpression(PrimitiveExpression primitiveExpression); |
||||
S VisitSizeOfExpression(SizeOfExpression sizeOfExpression); |
||||
S VisitStackAllocExpression(StackAllocExpression stackAllocExpression); |
||||
S VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression); |
||||
S VisitThrowExpression(ThrowExpression throwExpression); |
||||
S VisitTupleExpression(TupleExpression tupleExpression); |
||||
S VisitTypeOfExpression(TypeOfExpression typeOfExpression); |
||||
S VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression); |
||||
S VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression); |
||||
S VisitUncheckedExpression(UncheckedExpression uncheckedExpression); |
||||
S VisitUndocumentedExpression(UndocumentedExpression undocumentedExpression); |
||||
S VisitWithInitializerExpression(WithInitializerExpression withInitializerExpression); |
||||
|
||||
S VisitQueryExpression(QueryExpression queryExpression); |
||||
S VisitQueryContinuationClause(QueryContinuationClause queryContinuationClause); |
||||
S VisitQueryFromClause(QueryFromClause queryFromClause); |
||||
S VisitQueryLetClause(QueryLetClause queryLetClause); |
||||
S VisitQueryWhereClause(QueryWhereClause queryWhereClause); |
||||
S VisitQueryJoinClause(QueryJoinClause queryJoinClause); |
||||
S VisitQueryOrderClause(QueryOrderClause queryOrderClause); |
||||
S VisitQueryOrdering(QueryOrdering queryOrdering); |
||||
S VisitQuerySelectClause(QuerySelectClause querySelectClause); |
||||
S VisitQueryGroupClause(QueryGroupClause queryGroupClause); |
||||
|
||||
S VisitAttribute(Attribute attribute); |
||||
S VisitAttributeSection(AttributeSection attributeSection); |
||||
S VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration); |
||||
S VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration); |
||||
S VisitTypeDeclaration(TypeDeclaration typeDeclaration); |
||||
S VisitUsingAliasDeclaration(UsingAliasDeclaration usingAliasDeclaration); |
||||
S VisitUsingDeclaration(UsingDeclaration usingDeclaration); |
||||
S VisitExternAliasDeclaration(ExternAliasDeclaration externAliasDeclaration); |
||||
|
||||
S VisitBlockStatement(BlockStatement blockStatement); |
||||
S VisitBreakStatement(BreakStatement breakStatement); |
||||
S VisitCheckedStatement(CheckedStatement checkedStatement); |
||||
S VisitContinueStatement(ContinueStatement continueStatement); |
||||
S VisitDoWhileStatement(DoWhileStatement doWhileStatement); |
||||
S VisitEmptyStatement(EmptyStatement emptyStatement); |
||||
S VisitExpressionStatement(ExpressionStatement expressionStatement); |
||||
S VisitFixedStatement(FixedStatement fixedStatement); |
||||
S VisitForeachStatement(ForeachStatement foreachStatement); |
||||
S VisitForStatement(ForStatement forStatement); |
||||
S VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement); |
||||
S VisitGotoDefaultStatement(GotoDefaultStatement gotoDefaultStatement); |
||||
S VisitGotoStatement(GotoStatement gotoStatement); |
||||
S VisitIfElseStatement(IfElseStatement ifElseStatement); |
||||
S VisitLabelStatement(LabelStatement labelStatement); |
||||
S VisitLockStatement(LockStatement lockStatement); |
||||
S VisitReturnStatement(ReturnStatement returnStatement); |
||||
S VisitSwitchStatement(SwitchStatement switchStatement); |
||||
S VisitSwitchSection(SwitchSection switchSection); |
||||
S VisitCaseLabel(CaseLabel caseLabel); |
||||
S VisitSwitchExpression(SwitchExpression switchExpression); |
||||
S VisitSwitchExpressionSection(SwitchExpressionSection switchExpressionSection); |
||||
S VisitThrowStatement(ThrowStatement throwStatement); |
||||
S VisitTryCatchStatement(TryCatchStatement tryCatchStatement); |
||||
S VisitCatchClause(CatchClause catchClause); |
||||
S VisitUncheckedStatement(UncheckedStatement uncheckedStatement); |
||||
S VisitUnsafeStatement(UnsafeStatement unsafeStatement); |
||||
S VisitUsingStatement(UsingStatement usingStatement); |
||||
S VisitVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement); |
||||
S VisitLocalFunctionDeclarationStatement(LocalFunctionDeclarationStatement localFunctionDeclarationStatement); |
||||
S VisitWhileStatement(WhileStatement whileStatement); |
||||
S VisitYieldBreakStatement(YieldBreakStatement yieldBreakStatement); |
||||
S VisitYieldReturnStatement(YieldReturnStatement yieldReturnStatement); |
||||
|
||||
S VisitAccessor(Accessor accessor); |
||||
S VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration); |
||||
S VisitConstructorInitializer(ConstructorInitializer constructorInitializer); |
||||
S VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration); |
||||
S VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration); |
||||
S VisitEventDeclaration(EventDeclaration eventDeclaration); |
||||
S VisitCustomEventDeclaration(CustomEventDeclaration customEventDeclaration); |
||||
S VisitFieldDeclaration(FieldDeclaration fieldDeclaration); |
||||
S VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration); |
||||
S VisitMethodDeclaration(MethodDeclaration methodDeclaration); |
||||
S VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration); |
||||
S VisitParameterDeclaration(ParameterDeclaration parameterDeclaration); |
||||
S VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration); |
||||
S VisitVariableInitializer(VariableInitializer variableInitializer); |
||||
S VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration); |
||||
S VisitFixedVariableInitializer(FixedVariableInitializer fixedVariableInitializer); |
||||
|
||||
S VisitSyntaxTree(SyntaxTree syntaxTree); |
||||
S VisitSimpleType(SimpleType simpleType); |
||||
S VisitMemberType(MemberType memberType); |
||||
S VisitTupleType(TupleAstType tupleType); |
||||
S VisitTupleTypeElement(TupleTypeElement tupleTypeElement); |
||||
S VisitFunctionPointerType(FunctionPointerAstType functionPointerType); |
||||
S VisitInvocationType(InvocationAstType invocationType); |
||||
S VisitComposedType(ComposedType composedType); |
||||
S VisitArraySpecifier(ArraySpecifier arraySpecifier); |
||||
S VisitPrimitiveType(PrimitiveType primitiveType); |
||||
|
||||
S VisitComment(Comment comment); |
||||
S VisitPreProcessorDirective(PreProcessorDirective preProcessorDirective); |
||||
S VisitDocumentationReference(DocumentationReference documentationReference); |
||||
|
||||
S VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration); |
||||
S VisitConstraint(Constraint constraint); |
||||
S VisitCSharpTokenNode(CSharpTokenNode cSharpTokenNode); |
||||
S VisitIdentifier(Identifier identifier); |
||||
|
||||
S VisitInterpolation(Interpolation interpolation); |
||||
S VisitInterpolatedStringText(InterpolatedStringText interpolatedStringText); |
||||
|
||||
S VisitSingleVariableDesignation(SingleVariableDesignation singleVariableDesignation); |
||||
S VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignation parenthesizedVariableDesignation); |
||||
|
||||
S VisitNullNode(AstNode nullNode); |
||||
S VisitErrorNode(AstNode errorNode); |
||||
S VisitPatternPlaceholder(AstNode placeholder, PatternMatching.Pattern pattern); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// AST visitor.
|
||||
/// </summary>
|
||||
public interface IAstVisitor<in T, out S> |
||||
{ |
||||
S VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, T data); |
||||
S VisitAnonymousTypeCreateExpression(AnonymousTypeCreateExpression anonymousTypeCreateExpression, T data); |
||||
S VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, T data); |
||||
S VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression, T data); |
||||
S VisitAsExpression(AsExpression asExpression, T data); |
||||
S VisitAssignmentExpression(AssignmentExpression assignmentExpression, T data); |
||||
S VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, T data); |
||||
S VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, T data); |
||||
S VisitCastExpression(CastExpression castExpression, T data); |
||||
S VisitCheckedExpression(CheckedExpression checkedExpression, T data); |
||||
S VisitConditionalExpression(ConditionalExpression conditionalExpression, T data); |
||||
S VisitDeclarationExpression(DeclarationExpression declarationExpression, T data); |
||||
S VisitRecursivePatternExpression(RecursivePatternExpression recursivePatternExpression, T data); |
||||
S VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, T data); |
||||
S VisitDirectionExpression(DirectionExpression directionExpression, T data); |
||||
S VisitIdentifierExpression(IdentifierExpression identifierExpression, T data); |
||||
S VisitIndexerExpression(IndexerExpression indexerExpression, T data); |
||||
S VisitInterpolatedStringExpression(InterpolatedStringExpression interpolatedStringExpression, T data); |
||||
S VisitInvocationExpression(InvocationExpression invocationExpression, T data); |
||||
S VisitIsExpression(IsExpression isExpression, T data); |
||||
S VisitLambdaExpression(LambdaExpression lambdaExpression, T data); |
||||
S VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, T data); |
||||
S VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, T data); |
||||
S VisitNamedExpression(NamedExpression namedExpression, T data); |
||||
S VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression, T data); |
||||
S VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, T data); |
||||
S VisitOutVarDeclarationExpression(OutVarDeclarationExpression outVarDeclarationExpression, T data); |
||||
S VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, T data); |
||||
S VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, T data); |
||||
S VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, T data); |
||||
S VisitSizeOfExpression(SizeOfExpression sizeOfExpression, T data); |
||||
S VisitStackAllocExpression(StackAllocExpression stackAllocExpression, T data); |
||||
S VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, T data); |
||||
S VisitThrowExpression(ThrowExpression throwExpression, T data); |
||||
S VisitTupleExpression(TupleExpression tupleExpression, T data); |
||||
S VisitTypeOfExpression(TypeOfExpression typeOfExpression, T data); |
||||
S VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, T data); |
||||
S VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, T data); |
||||
S VisitUncheckedExpression(UncheckedExpression uncheckedExpression, T data); |
||||
S VisitUndocumentedExpression(UndocumentedExpression undocumentedExpression, T data); |
||||
S VisitWithInitializerExpression(WithInitializerExpression withInitializerExpression, T data); |
||||
|
||||
S VisitQueryExpression(QueryExpression queryExpression, T data); |
||||
S VisitQueryContinuationClause(QueryContinuationClause queryContinuationClause, T data); |
||||
S VisitQueryFromClause(QueryFromClause queryFromClause, T data); |
||||
S VisitQueryLetClause(QueryLetClause queryLetClause, T data); |
||||
S VisitQueryWhereClause(QueryWhereClause queryWhereClause, T data); |
||||
S VisitQueryJoinClause(QueryJoinClause queryJoinClause, T data); |
||||
S VisitQueryOrderClause(QueryOrderClause queryOrderClause, T data); |
||||
S VisitQueryOrdering(QueryOrdering queryOrdering, T data); |
||||
S VisitQuerySelectClause(QuerySelectClause querySelectClause, T data); |
||||
S VisitQueryGroupClause(QueryGroupClause queryGroupClause, T data); |
||||
|
||||
S VisitAttribute(Attribute attribute, T data); |
||||
S VisitAttributeSection(AttributeSection attributeSection, T data); |
||||
S VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, T data); |
||||
S VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, T data); |
||||
S VisitTypeDeclaration(TypeDeclaration typeDeclaration, T data); |
||||
S VisitUsingAliasDeclaration(UsingAliasDeclaration usingAliasDeclaration, T data); |
||||
S VisitUsingDeclaration(UsingDeclaration usingDeclaration, T data); |
||||
S VisitExternAliasDeclaration(ExternAliasDeclaration externAliasDeclaration, T data); |
||||
|
||||
S VisitBlockStatement(BlockStatement blockStatement, T data); |
||||
S VisitBreakStatement(BreakStatement breakStatement, T data); |
||||
S VisitCheckedStatement(CheckedStatement checkedStatement, T data); |
||||
S VisitContinueStatement(ContinueStatement continueStatement, T data); |
||||
S VisitDoWhileStatement(DoWhileStatement doWhileStatement, T data); |
||||
S VisitEmptyStatement(EmptyStatement emptyStatement, T data); |
||||
S VisitExpressionStatement(ExpressionStatement expressionStatement, T data); |
||||
S VisitFixedStatement(FixedStatement fixedStatement, T data); |
||||
S VisitForeachStatement(ForeachStatement foreachStatement, T data); |
||||
S VisitForStatement(ForStatement forStatement, T data); |
||||
S VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, T data); |
||||
S VisitGotoDefaultStatement(GotoDefaultStatement gotoDefaultStatement, T data); |
||||
S VisitGotoStatement(GotoStatement gotoStatement, T data); |
||||
S VisitIfElseStatement(IfElseStatement ifElseStatement, T data); |
||||
S VisitLabelStatement(LabelStatement labelStatement, T data); |
||||
S VisitLockStatement(LockStatement lockStatement, T data); |
||||
S VisitReturnStatement(ReturnStatement returnStatement, T data); |
||||
S VisitSwitchStatement(SwitchStatement switchStatement, T data); |
||||
S VisitSwitchSection(SwitchSection switchSection, T data); |
||||
S VisitCaseLabel(CaseLabel caseLabel, T data); |
||||
S VisitSwitchExpression(SwitchExpression switchExpression, T data); |
||||
S VisitSwitchExpressionSection(SwitchExpressionSection switchExpressionSection, T data); |
||||
S VisitThrowStatement(ThrowStatement throwStatement, T data); |
||||
S VisitTryCatchStatement(TryCatchStatement tryCatchStatement, T data); |
||||
S VisitCatchClause(CatchClause catchClause, T data); |
||||
S VisitUncheckedStatement(UncheckedStatement uncheckedStatement, T data); |
||||
S VisitUnsafeStatement(UnsafeStatement unsafeStatement, T data); |
||||
S VisitUsingStatement(UsingStatement usingStatement, T data); |
||||
S VisitVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement, T data); |
||||
S VisitLocalFunctionDeclarationStatement(LocalFunctionDeclarationStatement localFunctionDeclarationStatement, T data); |
||||
S VisitWhileStatement(WhileStatement whileStatement, T data); |
||||
S VisitYieldBreakStatement(YieldBreakStatement yieldBreakStatement, T data); |
||||
S VisitYieldReturnStatement(YieldReturnStatement yieldReturnStatement, T data); |
||||
|
||||
S VisitAccessor(Accessor accessor, T data); |
||||
S VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, T data); |
||||
S VisitConstructorInitializer(ConstructorInitializer constructorInitializer, T data); |
||||
S VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, T data); |
||||
S VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration, T data); |
||||
S VisitEventDeclaration(EventDeclaration eventDeclaration, T data); |
||||
S VisitCustomEventDeclaration(CustomEventDeclaration customEventDeclaration, T data); |
||||
S VisitFieldDeclaration(FieldDeclaration fieldDeclaration, T data); |
||||
S VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, T data); |
||||
S VisitMethodDeclaration(MethodDeclaration methodDeclaration, T data); |
||||
S VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, T data); |
||||
S VisitParameterDeclaration(ParameterDeclaration parameterDeclaration, T data); |
||||
S VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, T data); |
||||
S VisitVariableInitializer(VariableInitializer variableInitializer, T data); |
||||
S VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration, T data); |
||||
S VisitFixedVariableInitializer(FixedVariableInitializer fixedVariableInitializer, T data); |
||||
|
||||
S VisitSyntaxTree(SyntaxTree syntaxTree, T data); |
||||
S VisitSimpleType(SimpleType simpleType, T data); |
||||
S VisitMemberType(MemberType memberType, T data); |
||||
S VisitTupleType(TupleAstType tupleType, T data); |
||||
S VisitTupleTypeElement(TupleTypeElement tupleTypeElement, T data); |
||||
S VisitFunctionPointerType(FunctionPointerAstType functionPointerType, T data); |
||||
S VisitInvocationType(InvocationAstType invocationType, T data); |
||||
S VisitComposedType(ComposedType composedType, T data); |
||||
S VisitArraySpecifier(ArraySpecifier arraySpecifier, T data); |
||||
S VisitPrimitiveType(PrimitiveType primitiveType, T data); |
||||
|
||||
S VisitComment(Comment comment, T data); |
||||
S VisitPreProcessorDirective(PreProcessorDirective preProcessorDirective, T data); |
||||
S VisitDocumentationReference(DocumentationReference documentationReference, T data); |
||||
|
||||
S VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration, T data); |
||||
S VisitConstraint(Constraint constraint, T data); |
||||
S VisitCSharpTokenNode(CSharpTokenNode cSharpTokenNode, T data); |
||||
S VisitIdentifier(Identifier identifier, T data); |
||||
|
||||
S VisitInterpolation(Interpolation interpolation, T data); |
||||
S VisitInterpolatedStringText(InterpolatedStringText interpolatedStringText, T data); |
||||
|
||||
S VisitSingleVariableDesignation(SingleVariableDesignation singleVariableDesignation, T data); |
||||
S VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignation parenthesizedVariableDesignation, T data); |
||||
|
||||
S VisitNullNode(AstNode nullNode, T data); |
||||
S VisitErrorNode(AstNode errorNode, T data); |
||||
S VisitPatternPlaceholder(AstNode placeholder, PatternMatching.Pattern pattern, T data); |
||||
} |
||||
} |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue