Skip to content

Commit

Permalink
Use auto properties and misc code cleanup (#398)
Browse files Browse the repository at this point in the history
* Add .NET8 target

* Adress (performance related) warnings (which are treated as errors)

* Adress (performance related) warnings (which are treated as errors)

* Chore: address minor warnings and clean up

* Chore: use auto property syntax

* Cleanups

* Revert "Add .NET8 target"

This reverts commit 2e384c6.

* Chore: use auto property syntax

* Chore: seal internal classes

* Avoid async overhead in visitor methods

* Address suggested code changes
  • Loading branch information
alexander-jesner-AP authored Oct 20, 2024
1 parent c2583a5 commit 3150fe6
Show file tree
Hide file tree
Showing 64 changed files with 267 additions and 1,594 deletions.
31 changes: 4 additions & 27 deletions src/GraphQLParser/AST/Definitions/GraphQLArgumentsDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,17 @@ public GraphQLArgumentsDefinition(List<GraphQLInputValueDefinition> items)

internal sealed class GraphQLArgumentsDefinitionWithLocation : GraphQLArgumentsDefinition
{
private GraphQLLocation _location;

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}
public override GraphQLLocation Location { get; set; }
}

internal sealed class GraphQLArgumentsDefinitionWithComment : GraphQLArgumentsDefinition
{
private List<GraphQLComment>? _comments;

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}

internal sealed class GraphQLArgumentsDefinitionFull : GraphQLArgumentsDefinition
{
private GraphQLLocation _location;
private List<GraphQLComment>? _comments;
public override GraphQLLocation Location { get; set; }

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}
31 changes: 4 additions & 27 deletions src/GraphQLParser/AST/Definitions/GraphQLDirectiveDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,40 +48,17 @@ public GraphQLDirectiveDefinition(GraphQLName name, GraphQLDirectiveLocations lo

internal sealed class GraphQLDirectiveDefinitionWithLocation : GraphQLDirectiveDefinition
{
private GraphQLLocation _location;

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}
public override GraphQLLocation Location { get; set; }
}

internal sealed class GraphQLDirectiveDefinitionWithComment : GraphQLDirectiveDefinition
{
private List<GraphQLComment>? _comments;

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}

internal sealed class GraphQLDirectiveDefinitionFull : GraphQLDirectiveDefinition
{
private GraphQLLocation _location;
private List<GraphQLComment>? _comments;
public override GraphQLLocation Location { get; set; }

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}
31 changes: 4 additions & 27 deletions src/GraphQLParser/AST/Definitions/GraphQLEnumTypeDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,17 @@ public GraphQLEnumTypeDefinition(GraphQLName name)

internal sealed class GraphQLEnumTypeDefinitionWithLocation : GraphQLEnumTypeDefinition
{
private GraphQLLocation _location;

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}
public override GraphQLLocation Location { get; set; }
}

internal sealed class GraphQLEnumTypeDefinitionWithComment : GraphQLEnumTypeDefinition
{
private List<GraphQLComment>? _comments;

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}

internal sealed class GraphQLEnumTypeDefinitionFull : GraphQLEnumTypeDefinition
{
private GraphQLLocation _location;
private List<GraphQLComment>? _comments;
public override GraphQLLocation Location { get; set; }

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}
31 changes: 4 additions & 27 deletions src/GraphQLParser/AST/Definitions/GraphQLEnumValueDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,17 @@ public GraphQLEnumValueDefinition(GraphQLName name, GraphQLEnumValue enumValue)

internal sealed class GraphQLEnumValueDefinitionWithLocation : GraphQLEnumValueDefinition
{
private GraphQLLocation _location;

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}
public override GraphQLLocation Location { get; set; }
}

internal sealed class GraphQLEnumValueDefinitionWithComment : GraphQLEnumValueDefinition
{
private List<GraphQLComment>? _comments;

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}

internal sealed class GraphQLEnumValueDefinitionFull : GraphQLEnumValueDefinition
{
private GraphQLLocation _location;
private List<GraphQLComment>? _comments;
public override GraphQLLocation Location { get; set; }

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}
31 changes: 4 additions & 27 deletions src/GraphQLParser/AST/Definitions/GraphQLEnumValuesDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,17 @@ public GraphQLEnumValuesDefinition(List<GraphQLEnumValueDefinition> items)

internal sealed class GraphQLEnumValuesDefinitionWithLocation : GraphQLEnumValuesDefinition
{
private GraphQLLocation _location;

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}
public override GraphQLLocation Location { get; set; }
}

internal sealed class GraphQLEnumValuesDefinitionWithComment : GraphQLEnumValuesDefinition
{
private List<GraphQLComment>? _comments;

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}

internal sealed class GraphQLEnumValuesDefinitionFull : GraphQLEnumValuesDefinition
{
private GraphQLLocation _location;
private List<GraphQLComment>? _comments;
public override GraphQLLocation Location { get; set; }

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}
31 changes: 4 additions & 27 deletions src/GraphQLParser/AST/Definitions/GraphQLFieldDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,40 +44,17 @@ public GraphQLFieldDefinition(GraphQLName name, GraphQLType type)

internal sealed class GraphQLFieldDefinitionWithLocation : GraphQLFieldDefinition
{
private GraphQLLocation _location;

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}
public override GraphQLLocation Location { get; set; }
}

internal sealed class GraphQLFieldDefinitionWithComment : GraphQLFieldDefinition
{
private List<GraphQLComment>? _comments;

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}

internal sealed class GraphQLFieldDefinitionFull : GraphQLFieldDefinition
{
private GraphQLLocation _location;
private List<GraphQLComment>? _comments;
public override GraphQLLocation Location { get; set; }

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}
31 changes: 4 additions & 27 deletions src/GraphQLParser/AST/Definitions/GraphQLFieldsDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,17 @@ public GraphQLFieldsDefinition(List<GraphQLFieldDefinition> items)

internal sealed class GraphQLFieldsDefinitionWithLocation : GraphQLFieldsDefinition
{
private GraphQLLocation _location;

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}
public override GraphQLLocation Location { get; set; }
}

internal sealed class GraphQLFieldsDefinitionWithComment : GraphQLFieldsDefinition
{
private List<GraphQLComment>? _comments;

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}

internal sealed class GraphQLFieldsDefinitionFull : GraphQLFieldsDefinition
{
private GraphQLLocation _location;
private List<GraphQLComment>? _comments;
public override GraphQLLocation Location { get; set; }

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}
31 changes: 4 additions & 27 deletions src/GraphQLParser/AST/Definitions/GraphQLFragmentDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,16 @@ public GraphQLFragmentDefinition(GraphQLFragmentName name, GraphQLTypeCondition

internal sealed class GraphQLFragmentDefinitionWithLocation : GraphQLFragmentDefinition
{
private GraphQLLocation _location;

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}
public override GraphQLLocation Location { get; set; }
}

internal sealed class GraphQLFragmentDefinitionWithComment : GraphQLFragmentDefinition
{
private List<GraphQLComment>? _comments;

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}
internal sealed class GraphQLFragmentDefinitionFull : GraphQLFragmentDefinition
{
private GraphQLLocation _location;
private List<GraphQLComment>? _comments;
public override GraphQLLocation Location { get; set; }

public override GraphQLLocation Location
{
get => _location;
set => _location = value;
}

public override List<GraphQLComment>? Comments
{
get => _comments;
set => _comments = value;
}
public override List<GraphQLComment>? Comments { get; set; }
}
Loading

0 comments on commit 3150fe6

Please sign in to comment.