diff --git a/.editorconfig b/.editorconfig index 1e358090..15c0413f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -129,8 +129,8 @@ csharp_style_unused_value_assignment_preference = discard_variable:suggestion # C# code style - Index and range preferences # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#index-and-range-preferences -csharp_style_prefer_index_operator = true:warning -csharp_style_prefer_range_operator = true:warning +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion # C# code style - Miscellaneous preferences # https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#miscellaneous-preferences diff --git a/src/GraphQLParser.ApiTests/GraphQL-Parser.approved.txt b/src/GraphQLParser.ApiTests/GraphQL-Parser.approved.txt index db242acf..04495b17 100644 --- a/src/GraphQLParser.ApiTests/GraphQL-Parser.approved.txt +++ b/src/GraphQLParser.ApiTests/GraphQL-Parser.approved.txt @@ -60,7 +60,6 @@ namespace GraphQLParser.AST public GraphQLComment() { } public override GraphQLParser.AST.ASTNodeKind Kind { get; } public GraphQLParser.ROM Text { get; set; } - public string TextString { get; } } public class GraphQLDirective : GraphQLParser.AST.ASTNode, GraphQLParser.AST.INamedNode { @@ -193,7 +192,6 @@ namespace GraphQLParser.AST public GraphQLName() { } public override GraphQLParser.AST.ASTNodeKind Kind { get; } public GraphQLParser.ROM Value { get; set; } - public string ValueString { get; } } public class GraphQLNamedType : GraphQLParser.AST.GraphQLType, GraphQLParser.AST.INamedNode { @@ -258,7 +256,6 @@ namespace GraphQLParser.AST public GraphQLScalarValue(GraphQLParser.AST.ASTNodeKind kind) { } public override GraphQLParser.AST.ASTNodeKind Kind { get; } public GraphQLParser.ROM Value { get; set; } - public string ValueString { get; } public override string? ToString() { } } public class GraphQLSchemaDefinition : GraphQLParser.AST.ASTNode, GraphQLParser.AST.IHasDirectivesNode diff --git a/src/GraphQLParser/AST/GraphQLComment.cs b/src/GraphQLParser/AST/GraphQLComment.cs index b6402a59..2afd7b8e 100644 --- a/src/GraphQLParser/AST/GraphQLComment.cs +++ b/src/GraphQLParser/AST/GraphQLComment.cs @@ -3,33 +3,15 @@ namespace GraphQLParser.AST { /// - [DebuggerDisplay("{TextString}")] + [DebuggerDisplay("{Text}")] public class GraphQLComment : ASTNode { - private ROM _text; - private string? _textString; - /// public override ASTNodeKind Kind => ASTNodeKind.Comment; /// /// Comment value represented as . /// - public ROM Text - { - get => _text; - set - { - _text = value; - _textString = null; - } - } - - /// - /// Gets comment value represented as string. The value of this property is cached and in sync with . - /// The first time this property is accessed, memory in the managed heap will be allocated for it. - /// In scenarios where minimum memory consumption is required, use the property. - /// - public string TextString => _textString ??= (string)Text; + public ROM Text { get; set; } } } diff --git a/src/GraphQLParser/AST/GraphQLName.cs b/src/GraphQLParser/AST/GraphQLName.cs index 31463dad..e28c1830 100644 --- a/src/GraphQLParser/AST/GraphQLName.cs +++ b/src/GraphQLParser/AST/GraphQLName.cs @@ -3,33 +3,15 @@ namespace GraphQLParser.AST { /// - [DebuggerDisplay("{ValueString}")] + [DebuggerDisplay("{Value}")] public class GraphQLName : ASTNode { - private ROM _value; - private string? _valueString; - /// public override ASTNodeKind Kind => ASTNodeKind.Name; /// /// Name value represented as . /// - public ROM Value - { - get => _value; - set - { - _value = value; - _valueString = null; - } - } - - /// - /// Gets name value represented as string. The value of this property is cached and in sync with . - /// The first time this property is accessed, memory in the managed heap will be allocated for it. - /// In scenarios where minimum memory consumption is required, use the property. - /// - public string ValueString => _valueString ??= (string)Value; + public ROM Value { get; set; } } } diff --git a/src/GraphQLParser/AST/GraphQLScalarValue.cs b/src/GraphQLParser/AST/GraphQLScalarValue.cs index 87844aad..ff4f4acc 100644 --- a/src/GraphQLParser/AST/GraphQLScalarValue.cs +++ b/src/GraphQLParser/AST/GraphQLScalarValue.cs @@ -19,12 +19,10 @@ namespace GraphQLParser.AST ///
/// Null /// - [DebuggerDisplay("{ValueString}")] + [DebuggerDisplay("{Value}")] public class GraphQLScalarValue : GraphQLValue { private readonly ASTNodeKind _kind; - private ROM _value; - private string? _valueString; /// /// Creates scalar node with the specified kind. @@ -41,22 +39,7 @@ public GraphQLScalarValue(ASTNodeKind kind) /// /// Scalar value represented as . /// - public ROM Value - { - get => _value; - set - { - _value = value; - _valueString = null; - } - } - - /// - /// Gets scalar value represented as string. The value of this property is cached and in sync with . - /// The first time this property is accessed, memory in the managed heap will be allocated for it. - /// In scenarios where minimum memory consumption is required, use the property. - /// - public string ValueString => _valueString ??= (string)Value; + public ROM Value { get; set; } /// public override string? ToString() => Kind == ASTNodeKind.StringValue ? $"\"{Value}\"" : Value.ToString(); diff --git a/src/GraphQLParser/GraphQLParser.csproj b/src/GraphQLParser/GraphQLParser.csproj index 20a31a10..ea0a806e 100644 --- a/src/GraphQLParser/GraphQLParser.csproj +++ b/src/GraphQLParser/GraphQLParser.csproj @@ -7,7 +7,6 @@ netstandard2.0;netstandard2.1 GraphQL-Parser GraphQL;json;api;parser - $(NoWarn);IDE0057