Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some small fixes #4964

Merged
merged 10 commits into from
Apr 13, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public override bool Equals(object? obj)
/// hashing algorithms and data structures such as a hash table.
/// </returns>
public override int GetHashCode()
=> HashCode.Combine(Kind, Element?.GetHashCode());
=> HashCode.Combine(Kind, Element);

public static bool operator ==(
OptionalModifierNode? left,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace HotChocolate.Language;
/// <summary>
/// <para>Represents the scalar definition syntax.</para>
/// <para>
/// Scalar types represent primitive leaf values in a GraphQL type system.
/// Scalar types represent primitive leaf values in a GraphQL type system.
/// GraphQL responses take the form of a hierarchical tree;
/// the leaves of this tree are typically GraphQL Scalar types
/// (but may also be Enum types or null values).
Expand Down Expand Up @@ -182,7 +182,7 @@ public override bool Equals(object? obj)
/// hashing algorithms and data structures such as a hash table.
/// </returns>
public override int GetHashCode()
=> HashCode.Combine(base.GetHashCode(), Kind, Description?.GetHashCode());
=> HashCode.Combine(base.GetHashCode(), Kind, Description);

/// <summary>
/// The equal operator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public IEnumerable<ISyntaxNode> GetNodes()
public SchemaDefinitionNode WithLocation(Location? location)
{
return new SchemaDefinitionNode(
Location, Description, Directives, OperationTypes);
location, Description, Directives, OperationTypes);
}

public SchemaDefinitionNode WithDirectives(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ public abstract class SchemaDefinitionNodeBase
IReadOnlyList<DirectiveNode> directives,
IReadOnlyList<OperationTypeDefinitionNode> operationTypes)
{
Location = location;
Directives = directives
?? throw new ArgumentNullException(nameof(directives));
OperationTypes = operationTypes
?? throw new ArgumentNullException(nameof(operationTypes));

Location = location;
Directives = directives;
OperationTypes = operationTypes;
michaelstaib marked this conversation as resolved.
Show resolved Hide resolved
}

public abstract SyntaxKind Kind { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public IEnumerable<ISyntaxNode> GetNodes()
public SchemaExtensionNode WithLocation(Location? location)
{
return new SchemaExtensionNode(
Location, Directives, OperationTypes);
location, Directives, OperationTypes);
}

public SchemaExtensionNode WithDirectives(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ public SelectionSetNode WithLocation(Location? location)
public SelectionSetNode WithSelections(
IReadOnlyList<ISelectionNode> selections)
{
if (selections == null)
{
throw new ArgumentNullException(nameof(selections));
}

return new SelectionSetNode(
michaelstaib marked this conversation as resolved.
Show resolved Hide resolved
michaelstaib marked this conversation as resolved.
Show resolved Hide resolved
Location, selections);
}
Expand All @@ -77,8 +72,7 @@ public SelectionSetNode WithLocation(Location? location)
throw new ArgumentNullException(nameof(selection));
}

var selections = new List<ISelectionNode>(Selections);
selections.Add(selection);
var selections = new List<ISelectionNode>(Selections) { selection };

return new SelectionSetNode(
Location, selections);
Expand Down