Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/RCParsing/ParsedRuleResult.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
12 changes: 6 additions & 6 deletions src/RCParsing/ParsedRuleResultBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,15 @@ public T GetIntermediateValue<T>(string label)
/// <typeparam name="T">The type of value to retrieve.</typeparam>
/// <returns>The intermediate value associated with child AST node.</returns>
public T? TryGetIntermediateValue<T>(int index)
=> TryGetChild(index).IntermediateValue is T result ? result : default;
=> TryGetChild(index)?.IntermediateValue is T result ? result : default;

/// <summary>
/// Tries to get the intermediate value associated with child AST node at the specific index as an instance of type <typeparamref name="T"/>.
/// </summary>
/// <typeparam name="T">The type of value to retrieve.</typeparam>
/// <returns>The intermediate value associated with child AST node.</returns>
public T? TryGetIntermediateValue<T>(string label)
=> TryGetChild(label).IntermediateValue is T result ? result : default;
=> TryGetChild(label)?.IntermediateValue is T result ? result : default;

/// <summary>
/// Gets the intermediate value associated with this AST node converted to type <typeparamref name="T"/>.
Expand Down Expand Up @@ -460,15 +460,15 @@ public T GetValue<T>(string label)
/// <typeparam name="T">The type of value to retrieve.</typeparam>
/// <returns>The value associated with child AST node.</returns>
public T? TryGetValue<T>(int index)
=> TryGetChild(index).Value is T result ? result : default;
=> TryGetChild(index)?.Value is T result ? result : default;

/// <summary>
/// Tries to get the value associated with child AST node marked with specified label as an instance of type <typeparamref name="T"/> or <see langword="default"/> value.
/// </summary>
/// <typeparam name="T">The type of value to retrieve.</typeparam>
/// <returns>The value associated with child AST node.</returns>
public T? TryGetValue<T>(string label)
=> TryGetChild(label).Value is T result ? result : default;
=> TryGetChild(label)?.Value is T result ? result : default;

/// <summary>
/// Tries to get the value associated with this AST node as an instance of type <typeparamref name="T"/> or <see langword="default"/> value.
Expand All @@ -484,15 +484,15 @@ public T GetValue<T>(string label)
/// <typeparam name="T">The type of value to retrieve.</typeparam>
/// <returns>The value associated with child AST node.</returns>
public T? TryGetNullableValue<T>(int index) where T : struct
=> TryGetChild(index).Value is T result ? result : null;
=> TryGetChild(index)?.Value is T result ? result : null;

/// <summary>
/// Tries to get the value associated with child AST node marked with specified label as an instance of type <typeparamref name="T"/> or <see langword="default"/> value.
/// </summary>
/// <typeparam name="T">The type of value to retrieve.</typeparam>
/// <returns>The value associated with child AST node.</returns>
public T? TryGetNullableValue<T>(string label) where T : struct
=> TryGetChild(label).Value is T result ? result : null;
=> TryGetChild(label)?.Value is T result ? result : null;

/// <summary>
/// Gets the value associated with this AST node converted to type <typeparamref name="T"/>.
Expand Down
2 changes: 1 addition & 1 deletion src/RCParsing/RCParsing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<PropertyGroup>
<PackageId>RCParsing</PackageId>
<Version>5.3.0</Version>
<Version>5.3.1</Version>
<Authors>Roman K.</Authors>
<Company>RomeCore</Company>
<Product>RCParsing</Product>
Expand Down
Loading