diff --git a/src/RCParsing/ParsedRuleResult.cs b/src/RCParsing/ParsedRuleResult.cs index b2658de..27fae08 100644 --- a/src/RCParsing/ParsedRuleResult.cs +++ b/src/RCParsing/ParsedRuleResult.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; namespace RCParsing { diff --git a/src/RCParsing/ParsedRuleResultBase.cs b/src/RCParsing/ParsedRuleResultBase.cs index fcc94c0..74a4951 100644 --- a/src/RCParsing/ParsedRuleResultBase.cs +++ b/src/RCParsing/ParsedRuleResultBase.cs @@ -316,7 +316,7 @@ public T GetIntermediateValue(string label) /// The type of value to retrieve. /// The intermediate value associated with child AST node. public T? TryGetIntermediateValue(int index) - => TryGetChild(index).IntermediateValue is T result ? result : default; + => TryGetChild(index)?.IntermediateValue is T result ? result : default; /// /// Tries to get the intermediate value associated with child AST node at the specific index as an instance of type . @@ -324,7 +324,7 @@ public T GetIntermediateValue(string label) /// The type of value to retrieve. /// The intermediate value associated with child AST node. public T? TryGetIntermediateValue(string label) - => TryGetChild(label).IntermediateValue is T result ? result : default; + => TryGetChild(label)?.IntermediateValue is T result ? result : default; /// /// Gets the intermediate value associated with this AST node converted to type . @@ -460,7 +460,7 @@ public T GetValue(string label) /// The type of value to retrieve. /// The value associated with child AST node. public T? TryGetValue(int index) - => TryGetChild(index).Value is T result ? result : default; + => TryGetChild(index)?.Value is T result ? result : default; /// /// Tries to get the value associated with child AST node marked with specified label as an instance of type or value. @@ -468,7 +468,7 @@ public T GetValue(string label) /// The type of value to retrieve. /// The value associated with child AST node. public T? TryGetValue(string label) - => TryGetChild(label).Value is T result ? result : default; + => TryGetChild(label)?.Value is T result ? result : default; /// /// Tries to get the value associated with this AST node as an instance of type or value. @@ -484,7 +484,7 @@ public T GetValue(string label) /// The type of value to retrieve. /// The value associated with child AST node. public T? TryGetNullableValue(int index) where T : struct - => TryGetChild(index).Value is T result ? result : null; + => TryGetChild(index)?.Value is T result ? result : null; /// /// Tries to get the value associated with child AST node marked with specified label as an instance of type or value. @@ -492,7 +492,7 @@ public T GetValue(string label) /// The type of value to retrieve. /// The value associated with child AST node. public T? TryGetNullableValue(string label) where T : struct - => TryGetChild(label).Value is T result ? result : null; + => TryGetChild(label)?.Value is T result ? result : null; /// /// Gets the value associated with this AST node converted to type . diff --git a/src/RCParsing/RCParsing.csproj b/src/RCParsing/RCParsing.csproj index 659256b..0c69a7c 100644 --- a/src/RCParsing/RCParsing.csproj +++ b/src/RCParsing/RCParsing.csproj @@ -8,7 +8,7 @@ RCParsing - 5.3.0 + 5.3.1 Roman K. RomeCore RCParsing