From 7bec9da29f7d64386e7fc46f24e010f391928ede Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Mon, 4 Jan 2021 23:11:01 +0300 Subject: [PATCH] Add xml comments --- src/GraphQLParser/AST/GraphQLListType.cs | 5 ++-- src/GraphQLParser/AST/GraphQLListValue.cs | 1 + src/GraphQLParser/AST/GraphQLLocation.cs | 32 +++++++++++++++------ src/GraphQLParser/AST/GraphQLNamedType.cs | 5 ++-- src/GraphQLParser/AST/GraphQLNonNullType.cs | 5 ++-- src/GraphQLParser/Token.cs | 5 ++-- 6 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/GraphQLParser/AST/GraphQLListType.cs b/src/GraphQLParser/AST/GraphQLListType.cs index e3c5caaa..bca90daa 100644 --- a/src/GraphQLParser/AST/GraphQLListType.cs +++ b/src/GraphQLParser/AST/GraphQLListType.cs @@ -1,4 +1,4 @@ -namespace GraphQLParser.AST +namespace GraphQLParser.AST { public class GraphQLListType : GraphQLType { @@ -6,6 +6,7 @@ public class GraphQLListType : GraphQLType public GraphQLType? Type { get; set; } + /// public override string ToString() => $"[{Type}]"; } -} \ No newline at end of file +} diff --git a/src/GraphQLParser/AST/GraphQLListValue.cs b/src/GraphQLParser/AST/GraphQLListValue.cs index 89100755..1721a5a7 100644 --- a/src/GraphQLParser/AST/GraphQLListValue.cs +++ b/src/GraphQLParser/AST/GraphQLListValue.cs @@ -17,6 +17,7 @@ public GraphQLListValue(ASTNodeKind kind) public List? Values { get; set; } + /// public override string ToString() => AstValue!; } } diff --git a/src/GraphQLParser/AST/GraphQLLocation.cs b/src/GraphQLParser/AST/GraphQLLocation.cs index b3362eda..5413d521 100644 --- a/src/GraphQLParser/AST/GraphQLLocation.cs +++ b/src/GraphQLParser/AST/GraphQLLocation.cs @@ -3,9 +3,15 @@ namespace GraphQLParser.AST { + /// + /// Provides information regarding the location of a node within a document's original query text. + /// [DebuggerDisplay("(Start={Start}, End={End})")] public readonly struct GraphQLLocation : IEquatable { + /// + /// Initializes a new instance with the specified parameters. + /// public GraphQLLocation(int start, int end) { Start = start; @@ -14,28 +20,38 @@ public GraphQLLocation(int start, int end) /// /// The index for the start of the node in the source (i.e. it's inclusive). - /// - /// For example, - /// { field { subfield } } - /// ^ field.Location.Start = 2 + ///
+ /// For example: + /// + /// { field { subfield } } + ///
+ /// --^ field.Location.Start = 2 + ///
///
public int Start { get; } /// /// The index for the character immediately after the node in the source (i.e. it's exclusive). - /// - /// For example, - /// { field { subfield } } - /// ^ field.Location.End = 20 + ///
+ /// For example: + /// + /// { field { subfield } } + ///
+ /// --------------------^ field.Location.End = 20 + ///
///
public int End { get; } + /// public bool Equals(GraphQLLocation other) => Start == other.Start && End == other.End; + /// public override bool Equals(object obj) => obj is GraphQLLocation l && Equals(l); + /// public override int GetHashCode() => (Start, End).GetHashCode(); + /// public override string ToString() => $"({Start},{End})"; } } diff --git a/src/GraphQLParser/AST/GraphQLNamedType.cs b/src/GraphQLParser/AST/GraphQLNamedType.cs index aee90d79..6aa2a409 100644 --- a/src/GraphQLParser/AST/GraphQLNamedType.cs +++ b/src/GraphQLParser/AST/GraphQLNamedType.cs @@ -1,4 +1,4 @@ -namespace GraphQLParser.AST +namespace GraphQLParser.AST { public class GraphQLNamedType : GraphQLType, INamedNode { @@ -6,6 +6,7 @@ public class GraphQLNamedType : GraphQLType, INamedNode public GraphQLName? Name { get; set; } + /// public override string ToString() => Name?.Value!; } -} \ No newline at end of file +} diff --git a/src/GraphQLParser/AST/GraphQLNonNullType.cs b/src/GraphQLParser/AST/GraphQLNonNullType.cs index 263bbde5..10f42615 100644 --- a/src/GraphQLParser/AST/GraphQLNonNullType.cs +++ b/src/GraphQLParser/AST/GraphQLNonNullType.cs @@ -1,4 +1,4 @@ -namespace GraphQLParser.AST +namespace GraphQLParser.AST { public class GraphQLNonNullType : GraphQLType { @@ -6,6 +6,7 @@ public class GraphQLNonNullType : GraphQLType public GraphQLType? Type { get; set; } + /// public override string ToString() => Type + "!"; } -} \ No newline at end of file +} diff --git a/src/GraphQLParser/Token.cs b/src/GraphQLParser/Token.cs index f7c13c13..086722d0 100644 --- a/src/GraphQLParser/Token.cs +++ b/src/GraphQLParser/Token.cs @@ -1,4 +1,4 @@ -namespace GraphQLParser +namespace GraphQLParser { public readonly struct Token { @@ -42,6 +42,7 @@ public Token(TokenKind kind, string? value, int start, int end) _ => string.Empty }; + /// public override string ToString() { return Value != null @@ -49,4 +50,4 @@ public override string ToString() : GetTokenKindDescription(Kind); } } -} \ No newline at end of file +}