Skip to content

Commit

Permalink
small cleanups to comments and method signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
bfarmer67 committed Jun 10, 2024
1 parent 621d785 commit fa1f4eb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Hyperbee.Json/JsonPathBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ public JsonPathBuilder( JsonElement rootElement )
{
_rootElement = rootElement;

// we will avoid allocating full paths for every node by
// building a dictionary cache of (parentId, segment) pairs.
// avoid allocating full paths for every node by building
// a dictionary of (parentId, segment) pairs.

_parentMap[GetUniqueId( _rootElement )] = (-1, "$"); // seed parent map with root
}

public string GetPath( JsonElement targetElement )
public string GetPath( in JsonElement targetElement )
{
// quick out

Expand Down Expand Up @@ -77,12 +77,12 @@ public string GetPath( JsonElement targetElement )
return null; // target not found
}

private static int GetUniqueId( JsonElement element )
private static int GetUniqueId( in JsonElement element )
{
return JsonElementInternal.GetIdx( element );
}

private static string BuildPath( int elementId, Dictionary<int, (int parentId, string segment)> parentMap )
private static string BuildPath( in int elementId, Dictionary<int, (int parentId, string segment)> parentMap )
{
var pathSegments = new Stack<string>();
var currentId = elementId;
Expand Down

0 comments on commit fa1f4eb

Please sign in to comment.