Browse Source

Generate node constructors

Each concrete node's constructors are now emitted by the source generator
from its members in source order: single and collection [Slot] children,
the [NameSlot] string, and settable enum scalars (Operator, FieldDirection,
...). It emits the empty ctor (for object initializers), a required-prefix
ctor, one ending at each collection, and the full ctor, with later ctors
forwarding to shorter ones via this(...) and a params[] overload alongside
each IEnumerable<T> one. The hand-written ctors the generator now produces
are removed; scalar/location/Identifier convenience overloads that it cannot
express are kept (e.g. AssignmentExpression(left, right), SimpleType(Identifier),
the string+TextLocation overloads).

Because ctor parameters follow source order, BinaryOperatorExpression and
AssignmentExpression declare Operator between Left and Right so the generated
ctor is the expected (left, op, right). Pure-scalar nodes whose state is not
in slots (e.g. PrimitiveExpression's literal value) are left untouched.

Assisted-by: Claude:claude-opus-4-8:Claude Code
pull/3807/head
Siegfried Pammer 3 weeks ago committed by Siegfried Pammer
parent
commit
16db97d5f5
  1. 121
      ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs
  2. 21
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs
  3. 16
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs
  4. 14
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs
  5. 9
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs
  6. 16
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs
  7. 15
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs
  8. 9
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs
  9. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs
  10. 10
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs
  11. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs
  12. 10
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs
  13. 9
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs
  14. 20
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs
  15. 11
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs
  16. 20
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs
  17. 9
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs
  18. 21
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs
  19. 10
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs
  20. 10
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs
  21. 20
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs
  22. 4
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs
  23. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs
  24. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs
  25. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs
  26. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs
  27. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs
  28. 11
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs
  29. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs
  30. 4
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs
  31. 4
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs
  32. 4
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs
  33. 10
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs
  34. 8
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs
  35. 24
      ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs
  36. 23
      ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs
  37. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs
  38. 4
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs
  39. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs
  40. 10
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs
  41. 10
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs
  42. 4
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs
  43. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs
  44. 9
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs
  45. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs
  46. 8
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs
  47. 4
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs
  48. 9
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs
  49. 4
      ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs
  50. 3
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ExtensionDeclaration.cs
  51. 11
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs
  52. 4
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs
  53. 11
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs
  54. 2
      ICSharpCode.Decompiler/CSharp/Transforms/DeclareVariables.cs

121
ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs

@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.Generators; @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.Generators;
[Generator]
internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator
{
record AstNodeAdditions(string NodeName, bool NeedsVisitor, bool NeedsNullNode, bool NeedsPatternPlaceholder, int NullNodeBaseCtorParamCount, bool IsTypeNode, string VisitMethodName, string VisitMethodParamType, EquatableArray<(string Member, string TypeName, bool RecursiveMatch, bool MatchAny, bool Nullable)>? MembersToMatch, EquatableArray<(string RoleExpr, bool IsCollection, string PropertyName, string PropertyType, string ElementType, bool IsOverride, bool IsNullable, string KindName, bool IsPartial)>? Slots, EquatableArray<(string StringName, string TokenName, bool NullOnEmpty)>? NameSlots);
record AstNodeAdditions(string NodeName, bool NeedsVisitor, bool IsAbstract, bool BaseHasDefaultConstructor, bool NeedsNullNode, bool NeedsPatternPlaceholder, int NullNodeBaseCtorParamCount, bool IsTypeNode, string VisitMethodName, string VisitMethodParamType, EquatableArray<(string Member, string TypeName, bool RecursiveMatch, bool MatchAny, bool Nullable)>? MembersToMatch, EquatableArray<(string RoleExpr, bool IsCollection, string PropertyName, string PropertyType, string ElementType, bool IsOverride, bool IsNullable, string KindName, bool IsPartial)>? Slots, EquatableArray<(string StringName, string TokenName, bool NullOnEmpty)>? NameSlots, EquatableArray<(string PropertyName, string ParamType, string ElementType, bool IsCollection, bool IsOptional)>? CtorParams);
// Derives the shared SlotKind name from a [Slot] role expression: the last dotted segment with a
// trailing "Role" removed (e.g. "Roles.EmbeddedStatement" -> "EmbeddedStatement", "LeftRole" ->
@ -115,6 +115,11 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator @@ -115,6 +115,11 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator
// string body. DoMatch matches X (a string) and never sees XToken.
List<(string RoleExpr, bool IsCollection, string PropertyName, string PropertyType, string ElementType, bool IsOverride, bool IsNullable, string KindName, bool IsPartial)>? slots = null;
List<(string StringName, string TokenName, bool NullOnEmpty)>? nameSlots = null;
// Constructor parameters in declaration order: single/collection [Slot] children, the [NameSlot]
// string, and settable enum-typed scalar properties (e.g. Operator, FieldDirection). ParamType is the
// full parameter type for non-collections; for a collection it is empty and ElementType names the
// element. IsOptional (nullable / collection / nullOnEmpty) drives the required-parameter prefix.
List<(string PropertyName, string ParamType, string ElementType, bool IsCollection, bool IsOptional)>? ctorParams = null;
foreach (var m in targetSymbol.GetMembers())
{
if (m is not IPropertySymbol property)
@ -133,6 +138,10 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator @@ -133,6 +138,10 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator
? ((INamedTypeSymbol)property.Type).TypeArguments[0].ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat)
: propertyType;
slots.Add((roleExpr, isCollection, property.Name, propertyType, elementType, property.IsOverride, isNullable, SlotKindName(roleExpr), true));
ctorParams ??= new();
ctorParams.Add(isCollection
? (property.Name, "", elementType, true, true)
: (property.Name, propertyType + (isNullable ? "?" : ""), "", false, isNullable));
continue;
}
var nameSlotAttr = property.GetAttributes().FirstOrDefault(a => a.AttributeClass?.Name == "NameSlotAttribute");
@ -146,16 +155,30 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator @@ -146,16 +155,30 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator
// An optional name (nullOnEmpty) makes the backing token a real nullable slot: an absent name is a null token.
slots.Add((roleExpr, false, tokenName, "Identifier", "Identifier", false, nullOnEmpty, SlotKindName(roleExpr), false));
nameSlots.Add((property.Name, tokenName, nullOnEmpty));
// The name is the primary construction value, so it is a required param. nullOnEmpty only
// governs the empty-string-to-null behaviour of the setter, not ctor optionality.
ctorParams ??= new();
ctorParams.Add((property.Name, "string", "", false, false));
continue;
}
// A settable enum-typed scalar (e.g. Operator, FieldDirection) is part of construction. The enum may
// live in another namespace, so fully-qualify it (the generated file has only a few usings).
if (property.Type.TypeKind == TypeKind.Enum && property.SetMethod != null && !property.IsStatic)
{
ctorParams ??= new();
ctorParams.Add((property.Name, property.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat), "", false, false));
}
}
return new(targetSymbol.Name,
NeedsVisitor: !targetSymbol.IsAbstract && targetSymbol.BaseType!.IsAbstract,
IsAbstract: targetSymbol.IsAbstract,
BaseHasDefaultConstructor: targetSymbol.BaseType is { } bt && bt.InstanceConstructors.Any(c => c.Parameters.Length == 0 && c.DeclaredAccessibility != Accessibility.Private),
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(), slots?.ToEquatableArray(), nameSlots?.ToEquatableArray());
visitMethodName, paramTypeName, membersToMatch?.ToEquatableArray(), slots?.ToEquatableArray(), nameSlots?.ToEquatableArray(), ctorParams?.ToEquatableArray());
}
// Backing-field name for a slot property. Prefixed to avoid colliding with hand-written fields
@ -351,6 +374,98 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator @@ -351,6 +374,98 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator
}
}
// Constructors. Parameters follow member source order and cover single/collection [Slot] children,
// the [NameSlot] string, and settable enum scalars (Operator, FieldDirection, ...); a collection is
// an IEnumerable<T> param in its declared position. We emit the empty ctor (for object-initializer
// construction), then a ctor for the required prefix (through the last required param), one ending at
// each collection, and one with all params. A params T[] overload is added when a ctor's last param
// is the collection. Pure-scalar nodes (no [Slot]/[NameSlot], e.g. PrimitiveExpression) are excluded
// because their non-enum state (a literal value) is invisible here; those keep hand-written ctors.
if (!source.IsAbstract && source.BaseHasDefaultConstructor && slots.Count > 0 && source.CtorParams is { } ctorParamsArray)
{
var cp = ctorParamsArray.ToList();
string ParamName(string n)
{
string p = char.ToLowerInvariant(n[0]) + n.Substring(1);
return SyntaxFacts.GetKeywordKind(p) != SyntaxKind.None ? "@" + p : p;
}
string ParamType(int i) => cp[i].IsCollection
? $"global::System.Collections.Generic.IEnumerable<{cp[i].ElementType}>"
: cp[i].ParamType;
builder.AppendLine($"\tpublic {source.NodeName}()");
builder.AppendLine("\t{");
builder.AppendLine("\t}");
builder.AppendLine();
// Required prefix: through the last non-optional param (an optional param before it is still
// positionally included so the required param after it can be passed).
int reqLen = 0;
for (int i = 0; i < cp.Count; i++)
if (!cp[i].IsOptional)
reqLen = i + 1;
// A normal prefix ctor forwards to the previous (shorter) emitted prefix via : this(...) and only
// sets the params between them; the shortest sets its params directly. A params T[] overload
// forwards to the IEnumerable overload of the same length.
void EmitPrefix(int len, int chainLen, bool paramsForm)
{
var decls = new List<string>();
for (int i = 0; i < len; i++)
{
if (paramsForm && i == len - 1)
decls.Add($"params {cp[i].ElementType}[] {ParamName(cp[i].PropertyName)}");
else
decls.Add($"{ParamType(i)} {ParamName(cp[i].PropertyName)}");
}
builder.AppendLine($"\tpublic {source.NodeName}({string.Join(", ", decls)})");
if (paramsForm)
{
var args = new List<string>();
for (int i = 0; i < len; i++)
args.Add(i == len - 1
? $"(global::System.Collections.Generic.IEnumerable<{cp[i].ElementType}>){ParamName(cp[i].PropertyName)}"
: ParamName(cp[i].PropertyName));
builder.AppendLine($"\t\t: this({string.Join(", ", args)})");
builder.AppendLine("\t{");
builder.AppendLine("\t}");
}
else
{
if (chainLen > 0)
builder.AppendLine($"\t\t: this({string.Join(", ", Enumerable.Range(0, chainLen).Select(i => ParamName(cp[i].PropertyName)))})");
builder.AppendLine("\t{");
for (int i = chainLen; i < len; i++)
{
if (cp[i].IsCollection)
builder.AppendLine($"\t\tthis.{cp[i].PropertyName}.AddRange({ParamName(cp[i].PropertyName)});");
else
builder.AppendLine($"\t\tthis.{cp[i].PropertyName} = {ParamName(cp[i].PropertyName)};");
}
builder.AppendLine("\t}");
}
builder.AppendLine();
}
var lengths = new SortedSet<int>();
if (reqLen > 0)
lengths.Add(reqLen);
for (int i = 0; i < cp.Count; i++)
if (cp[i].IsCollection && i + 1 >= reqLen)
lengths.Add(i + 1);
lengths.Add(cp.Count);
int prev = 0;
foreach (int len in lengths)
{
if (len <= 0)
continue;
EmitPrefix(len, prev, paramsForm: false);
if (cp[len - 1].IsCollection)
EmitPrefix(len, len, paramsForm: true);
prev = len;
}
}
// Flattened child-index space: slots in declaration order, a single slot occupying one index
// (even when empty), a collection slot a contiguous run of its current length.
builder.Append("\tinternal override int GetChildCount() => ");
@ -455,7 +570,7 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator @@ -455,7 +570,7 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator
builder.AppendLine("namespace ICSharpCode.Decompiler.CSharp.Syntax;");
source = source
.Concat([new("PatternPlaceholder", true, false, false, 0, false, "PatternPlaceholder", "AstNode", null, null, null)])
.Concat([new("PatternPlaceholder", true, false, true, false, false, 0, false, "PatternPlaceholder", "AstNode", null, null, null, null)])
.ToImmutableArray();
WriteInterface("IAstVisitor", "void", "");

21
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs

@ -58,26 +58,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -58,26 +58,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Body")]
public partial BlockStatement Body { get; set; }
public AnonymousMethodExpression()
{
}
public AnonymousMethodExpression(BlockStatement body, IEnumerable<ParameterDeclaration> parameters = null)
{
if (parameters != null)
{
hasParameterList = true;
foreach (var parameter in parameters)
{
AddChild(parameter, SlotKind.Parameter);
}
}
AddChild(body, SlotKind.Body);
}
public AnonymousMethodExpression(BlockStatement body, params ParameterDeclaration[] parameters) : this(body, (IEnumerable<ParameterDeclaration>)parameters)
{
}
}
}

16
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs

@ -37,22 +37,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -37,22 +37,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Expression")]
public partial AstNodeCollection<Expression> Initializers { get; }
public AnonymousTypeCreateExpression()
{
}
public AnonymousTypeCreateExpression(IEnumerable<Expression> initializers)
{
foreach (var ini in initializers)
{
AddChild(ini, SlotKind.Expression);
}
}
public AnonymousTypeCreateExpression(params Expression[] initializer) : this((IEnumerable<Expression>)initializer)
{
}
}
}

14
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs

@ -34,20 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -34,20 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)]
public partial class ArrayInitializerExpression : Expression
{
public ArrayInitializerExpression()
{
}
public ArrayInitializerExpression(IEnumerable<Expression> elements)
{
this.Elements.AddRange(elements);
}
public ArrayInitializerExpression(params Expression[] elements)
{
this.Elements.AddRange(elements);
}
[Slot("Roles.Expression")]
public partial AstNodeCollection<Expression> Elements { get; }

9
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs

@ -40,15 +40,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -40,15 +40,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Type")]
public partial AstType Type { get; set; }
public AsExpression()
{
}
public AsExpression(Expression expression, AstType type)
{
AddChild(expression, SlotKind.Expression);
AddChild(type, SlotKind.Type);
}
}
}

16
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs

@ -52,31 +52,21 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -52,31 +52,21 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public const string BitwiseOrToken = "|=";
public const string ExclusiveOrToken = "^=";
public AssignmentExpression()
{
}
// Simple assignment convenience: Operator defaults to Assign. The (left, op, right) form is generated.
public AssignmentExpression(Expression left, Expression right)
{
this.Left = left;
this.Right = right;
}
public AssignmentExpression(Expression left, AssignmentOperatorType op, Expression right)
{
this.Left = left;
this.Operator = op;
this.Right = right;
}
[Slot("LeftRole")]
public partial Expression Left { get; set; }
public AssignmentOperatorType Operator {
get;
set;
}
[Slot("LeftRole")]
public partial Expression Left { get; set; }
[Slot("RightRole")]
public partial Expression Right { get; set; }

15
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs

@ -63,25 +63,14 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -63,25 +63,14 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public const string IsKeyword = IsExpression.IsKeyword;
public BinaryOperatorExpression()
{
}
public BinaryOperatorExpression(Expression? left, BinaryOperatorType op, Expression? right)
{
this.Left = left;
this.Operator = op;
this.Right = right;
}
[Slot("LeftRole")]
public partial Expression? Left { get; set; }
public BinaryOperatorType Operator {
get;
set;
}
[Slot("LeftRole")]
public partial Expression? Left { get; set; }
[Slot("RightRole")]
public partial Expression? Right { get; set; }

9
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs

@ -37,15 +37,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -37,15 +37,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Expression")]
public partial Expression Expression { get; set; }
public CastExpression()
{
}
public CastExpression(AstType castToType, Expression expression)
{
AddChild(castToType, SlotKind.Type);
AddChild(expression, SlotKind.Expression);
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs

@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Expression")]
public partial Expression Expression { get; set; }
public CheckedExpression()
{
}
public CheckedExpression(Expression expression)
{
AddChild(expression, SlotKind.Expression);
}
}
}

10
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs

@ -44,15 +44,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -44,15 +44,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("FalseRole")]
public partial Expression FalseExpression { get; set; }
public ConditionalExpression()
{
}
public ConditionalExpression(Expression condition, Expression trueExpression, Expression falseExpression)
{
AddChild(condition, SlotKind.Condition);
AddChild(trueExpression, SlotKind.True);
AddChild(falseExpression, SlotKind.False);
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs

@ -37,14 +37,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -37,14 +37,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Type")]
public partial AstType Type { get; set; }
public DefaultValueExpression()
{
}
public DefaultValueExpression(AstType type)
{
AddChild(type, SlotKind.Type);
}
}
}

10
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs

@ -51,15 +51,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -51,15 +51,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Expression")]
public partial Expression Expression { get; set; }
public DirectionExpression()
{
}
public DirectionExpression(FieldDirection direction, Expression expression)
{
this.FieldDirection = direction;
AddChild(expression, SlotKind.Expression);
}
}
}

9
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs

@ -32,15 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -32,15 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class IdentifierExpression : Expression
{
public IdentifierExpression()
{
}
public IdentifierExpression(string identifier)
{
this.Identifier = identifier;
}
public IdentifierExpression(string identifier, TextLocation location)
{
SetChildByRole(SlotKind.Identifier, Decompiler.CSharp.Syntax.Identifier.Create(identifier, location));

20
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs

@ -41,25 +41,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -41,25 +41,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Argument")]
public partial AstNodeCollection<Expression> Arguments { get; }
public IndexerExpression()
{
}
public IndexerExpression(Expression? target, IEnumerable<Expression>? arguments)
{
Target = target;
if (arguments != null)
{
foreach (var arg in arguments)
{
AddChild(arg, SlotKind.Argument);
}
}
}
public IndexerExpression(Expression? target, params Expression[] arguments) : this(target, (IEnumerable<Expression>)arguments)
{
}
}
}

11
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs

@ -14,11 +14,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -14,11 +14,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("InterpolatedStringContent.Role")]
public partial AstNodeCollection<InterpolatedStringContent> Content { get; }
public InterpolatedStringExpression()
{
}
public InterpolatedStringExpression(IList<InterpolatedStringContent> content)
{
Content.AddRange(content);
@ -52,12 +47,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -52,12 +47,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public int Alignment { get; }
public string Suffix { get; }
public Interpolation()
{
}
public Interpolation(Expression expression, int alignment = 0, string suffix = null)
{
Expression = expression;

20
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs

@ -39,25 +39,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -39,25 +39,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Argument")]
public partial AstNodeCollection<Expression> Arguments { get; }
public InvocationExpression()
{
}
public InvocationExpression(Expression target, IEnumerable<Expression> arguments)
{
AddChild(target, SlotKind.TargetExpression);
if (arguments != null)
{
foreach (var arg in arguments)
{
AddChild(arg, SlotKind.Argument);
}
}
}
public InvocationExpression(Expression target, params Expression[] arguments) : this(target, (IEnumerable<Expression>)arguments)
{
}
}
}

9
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs

@ -41,15 +41,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -41,15 +41,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Type")]
public partial AstType Type { get; set; }
public IsExpression()
{
}
public IsExpression(Expression expression, AstType type)
{
AddChild(expression, SlotKind.Expression);
AddChild(type, SlotKind.Type);
}
}
}

21
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs

@ -42,26 +42,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -42,26 +42,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.TypeArgument")]
public partial AstNodeCollection<AstType> TypeArguments { get; }
public MemberReferenceExpression()
{
}
public MemberReferenceExpression(Expression target, string memberName, IEnumerable<AstType> arguments = null)
{
AddChild(target, SlotKind.TargetExpression);
MemberName = memberName;
if (arguments != null)
{
foreach (var arg in arguments)
{
AddChild(arg, SlotKind.TypeArgument);
}
}
}
public MemberReferenceExpression(Expression target, string memberName, params AstType[] arguments) : this(target, memberName, (IEnumerable<AstType>)arguments)
{
}
}
}

10
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs

@ -25,16 +25,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -25,16 +25,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class NamedArgumentExpression : Expression
{
public NamedArgumentExpression()
{
}
public NamedArgumentExpression(string name, Expression expression)
{
this.Name = name;
this.Expression = expression;
}
[NameSlot("Roles.Identifier")]
public partial string Name { get; set; }

10
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs

@ -33,16 +33,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -33,16 +33,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class NamedExpression : Expression
{
public NamedExpression()
{
}
public NamedExpression(string name, Expression expression)
{
this.Name = name;
this.Expression = expression;
}
[NameSlot("Roles.Identifier")]
public partial string Name { get; set; }

20
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs

@ -46,25 +46,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -46,25 +46,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("InitializerRole")]
public partial ArrayInitializerExpression? Initializer { get; set; }
public ObjectCreateExpression()
{
}
public ObjectCreateExpression(AstType type, IEnumerable<Expression>? arguments = null)
{
AddChild(type, SlotKind.Type);
if (arguments != null)
{
foreach (var arg in arguments)
{
AddChild(arg, SlotKind.Argument);
}
}
}
public ObjectCreateExpression(AstType type, params Expression[] arguments) : this(type, (IEnumerable<Expression>)arguments)
{
}
}
}

4
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs

@ -32,10 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -32,10 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Variable")]
public partial VariableInitializer Variable { get; set; }
public OutVarDeclarationExpression()
{
}
public OutVarDeclarationExpression(AstType type, string name)
{
this.Type = type;

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs

@ -35,13 +35,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -35,13 +35,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Expression")]
public partial Expression Expression { get; set; }
public ParenthesizedExpression()
{
}
public ParenthesizedExpression(Expression expr)
{
Expression = expr;
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs

@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Type")]
public partial AstType Type { get; set; }
public SizeOfExpression()
{
}
public SizeOfExpression(AstType type)
{
AddChild(type, SlotKind.Type);
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs

@ -29,13 +29,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -29,13 +29,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Expression")]
public partial Expression Expression { get; set; }
public ThrowExpression()
{
}
public ThrowExpression(Expression expression)
{
AddChild(expression, SlotKind.Expression);
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs

@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Type")]
public partial AstType Type { get; set; }
public TypeOfExpression()
{
}
public TypeOfExpression(AstType type)
{
AddChild(type, SlotKind.Type);
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs

@ -28,13 +28,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -28,13 +28,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Type")]
public partial AstType Type { get; set; }
public TypeReferenceExpression()
{
}
public TypeReferenceExpression(AstType type)
{
AddChild(type, SlotKind.Type);
}
}
}

11
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs

@ -56,17 +56,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -56,17 +56,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public const string SuppressNullableWarningToken = "!";
public const string IndexFromEndToken = "^";
public const string PatternNotKeyword = "not";
public UnaryOperatorExpression()
{
}
public UnaryOperatorExpression(UnaryOperatorType op, Expression expression)
{
this.Operator = op;
this.Expression = expression;
}
public UnaryOperatorType Operator {
get;
set;

8
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs

@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Expression")]
public partial Expression Expression { get; set; }
public UncheckedExpression()
{
}
public UncheckedExpression(Expression expression)
{
AddChild(expression, SlotKind.Expression);
}
}
}

4
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs

@ -50,10 +50,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -50,10 +50,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Attribute")]
public partial AstNodeCollection<Attribute> Attributes { get; }
public AttributeSection()
{
}
public AttributeSection(Attribute attr)
{
this.Attributes.Add(attr);

4
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs

@ -101,10 +101,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -101,10 +101,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("MemberRole")]
public partial AstNodeCollection<AstNode> Members { get; }
public NamespaceDeclaration()
{
}
public NamespaceDeclaration(string name)
{
this.Name = name;

4
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs

@ -45,10 +45,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -45,10 +45,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[NameSlot("Roles.Identifier")]
public partial string Name { get; set; }
public TypeParameterDeclaration()
{
}
public TypeParameterDeclaration(string name)
{
Name = name;

10
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs

@ -40,20 +40,10 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -40,20 +40,10 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("ImportRole")]
public partial AstType Import { get; set; }
public UsingAliasDeclaration()
{
}
public UsingAliasDeclaration(string alias, string nameSpace)
{
AddChild(Identifier.Create(alias), SlotKind.Alias);
AddChild(new SimpleType(nameSpace), SlotKind.Import);
}
public UsingAliasDeclaration(string alias, AstType import)
{
AddChild(Identifier.Create(alias), SlotKind.Alias);
AddChild(import, SlotKind.Import);
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs

@ -77,18 +77,10 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -77,18 +77,10 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
return result.ToString();
}
public UsingDeclaration()
{
}
public UsingDeclaration(string nameSpace)
{
AddChild(AstType.Create(nameSpace), SlotKind.Import);
}
public UsingDeclaration(AstType import)
{
AddChild(import, SlotKind.Import);
}
}
}

24
ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs

@ -52,30 +52,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -52,30 +52,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.TypeArgument")]
public partial AstNodeCollection<AstType> TypeArguments { get; }
public MemberType()
{
}
public MemberType(AstType target, string memberName)
{
this.Target = target;
this.MemberName = memberName;
}
public MemberType(AstType target, string memberName, IEnumerable<AstType> typeArguments)
{
this.Target = target;
this.MemberName = memberName;
foreach (var arg in typeArguments)
{
AddChild(arg, SlotKind.TypeArgument);
}
}
public MemberType(AstType target, string memberName, params AstType[] typeArguments) : this(target, memberName, (IEnumerable<AstType>)typeArguments)
{
}
}
}

23
ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs

@ -34,15 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -34,15 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: true)]
public partial class SimpleType : AstType
{
public SimpleType()
{
}
public SimpleType(string identifier)
{
this.Identifier = identifier;
}
public SimpleType(Identifier identifier)
{
this.IdentifierToken = identifier;
@ -52,20 +43,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -52,20 +43,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
SetChildByRole(SlotKind.Identifier, Syntax.Identifier.Create(identifier, location));
}
public SimpleType(string identifier, IEnumerable<AstType> typeArguments)
{
this.Identifier = identifier;
foreach (var arg in typeArguments)
{
AddChild(arg, SlotKind.TypeArgument);
}
}
public SimpleType(string identifier, params AstType[] typeArguments) : this(identifier, (IEnumerable<AstType>)typeArguments)
{
}
[NameSlot("Roles.Identifier", nullOnEmpty: true)]
public partial string Identifier { get; set; }

8
ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs

@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Body")]
public partial BlockStatement Body { get; set; }
public CheckedStatement()
{
}
public CheckedStatement(BlockStatement body)
{
AddChild(body, SlotKind.Body);
}
}
}

4
ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs

@ -41,10 +41,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -41,10 +41,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Condition")]
public partial Expression Condition { get; set; }
public DoWhileStatement()
{
}
public DoWhileStatement(Expression condition, Statement embeddedStatement)
{
this.Condition = condition;

8
ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs

@ -35,13 +35,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -35,13 +35,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Expression")]
public partial Expression Expression { get; set; }
public ExpressionStatement()
{
}
public ExpressionStatement(Expression expression)
{
this.Expression = expression;
}
}
}

10
ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs

@ -33,16 +33,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -33,16 +33,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public partial class GotoStatement : Statement
{
public const string GotoKeyword = "goto";
public GotoStatement()
{
}
public GotoStatement(string label)
{
this.Label = label;
}
[NameSlot("Roles.Identifier", nullOnEmpty: true)]
public partial string Label { get; set; }
}

10
ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs

@ -46,15 +46,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -46,15 +46,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("FalseRole")]
public partial Statement? FalseStatement { get; set; }
public IfElseStatement()
{
}
public IfElseStatement(Expression condition, Statement trueStatement, Statement? falseStatement = null)
{
this.Condition = condition;
this.TrueStatement = trueStatement;
this.FalseStatement = falseStatement;
}
}
}

4
ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs

@ -28,9 +28,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -28,9 +28,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("MethodDeclarationRole")]
public partial MethodDeclaration Declaration { get; set; }
public LocalFunctionDeclarationStatement(MethodDeclaration methodDeclaration)
{
AddChild(methodDeclaration, SlotKind.MethodDeclaration);
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs

@ -39,13 +39,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -39,13 +39,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Expression")]
public partial Expression? Expression { get; set; }
public ReturnStatement()
{
}
public ReturnStatement(Expression returnExpression)
{
AddChild(returnExpression, SlotKind.Expression);
}
}
}

9
ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs

@ -71,14 +71,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -71,14 +71,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// </summary>
[Slot("Roles.Expression")]
public partial Expression? Expression { get; set; }
public CaseLabel()
{
}
public CaseLabel(Expression expression)
{
this.Expression = expression;
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs

@ -39,13 +39,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -39,13 +39,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Expression")]
public partial Expression? Expression { get; set; }
public ThrowStatement()
{
}
public ThrowStatement(Expression expression)
{
AddChild(expression, SlotKind.Expression);
}
}
}

8
ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs

@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -37,13 +37,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Body")]
public partial BlockStatement Body { get; set; }
public UncheckedStatement()
{
}
public UncheckedStatement(BlockStatement body)
{
AddChild(body, SlotKind.Body);
}
}
}

4
ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs

@ -32,10 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -32,10 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class VariableDeclarationStatement : Statement
{
public VariableDeclarationStatement()
{
}
public VariableDeclarationStatement(AstType type, string name, Expression initializer = null)
{
this.Type = type;

9
ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs

@ -40,14 +40,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -40,14 +40,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.EmbeddedStatement")]
public partial Statement EmbeddedStatement { get; set; }
public WhileStatement()
{
}
public WhileStatement(Expression condition, Statement embeddedStatement)
{
this.Condition = condition;
this.EmbeddedStatement = embeddedStatement;
}
}
}

4
ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs

@ -40,10 +40,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -40,10 +40,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("MemberRole")]
public partial AstNodeCollection<AstNode> Members { get; }
public SyntaxTree()
{
}
/// <summary>
/// Gets all defined types in this syntax tree.
/// </summary>

3
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ExtensionDeclaration.cs

@ -46,8 +46,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -46,8 +46,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.TypeMemberRole")]
public partial AstNodeCollection<EntityDeclaration> Members { get; }
public ExtensionDeclaration()
{
}
}
}

11
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs

@ -32,17 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -32,17 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class FixedVariableInitializer : AstNode
{
public FixedVariableInitializer()
{
}
public FixedVariableInitializer(string name, Expression initializer = null)
{
this.Name = name;
this.CountExpression = initializer;
}
[NameSlot("Roles.Identifier")]
public partial string Name { get; set; }

4
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs

@ -91,10 +91,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -91,10 +91,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Expression")]
public partial Expression? DefaultExpression { get; set; }
public ParameterDeclaration()
{
}
public new ParameterDeclaration Clone()
{
return (ParameterDeclaration)base.Clone();

11
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs

@ -34,17 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -34,17 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)]
public partial class VariableInitializer : AstNode
{
public VariableInitializer()
{
}
public VariableInitializer(string name, Expression? initializer = null)
{
this.Name = name;
this.Initializer = initializer;
}
[NameSlot("Roles.Identifier")]
public partial string Name { get; set; }

2
ICSharpCode.Decompiler/CSharp/Transforms/DeclareVariables.cs

@ -239,7 +239,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -239,7 +239,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
mustResolveConflicts: true)
);
stmt.Expression = new AssignmentExpression(
new IdentifierExpression(v.Name).WithRR(new ILVariableResolveResult(v, v.Type)),
new IdentifierExpression(v.Name!).WithRR(new ILVariableResolveResult(v, v.Type)),
stmt.Expression.Detach());
}
}

Loading…
Cancel
Save