Skip to content

Commit

Permalink
don't require proxy to write something
Browse files Browse the repository at this point in the history
  • Loading branch information
Quin Lynch committed Apr 17, 2024
1 parent e65d9bb commit b942a6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/EdgeDB.Net.QueryBuilder/Lexical/QueryWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private ValueNode AddTracked(in Value value, bool after)
if (value.TryProxy(this, out var head, out _))
{
// track is already updated.
return head;
return head ?? _track!;
}
else if (_track is null)
_track = _tokens.AddFirst(in value); //Set(ref _tokens.AddFirst(in value));
Expand Down
9 changes: 3 additions & 6 deletions src/EdgeDB.Net.QueryBuilder/Lexical/Value.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public Value(object? value)

public bool TryProxy(
QueryWriter writer,
[MaybeNullWhen(false)] out LooseLinkedList<Value>.Node first,
[MaybeNullWhen(false)] out LooseLinkedList<Value>.Node last)
out LooseLinkedList<Value>.Node? first,
out LooseLinkedList<Value>.Node? last)
{
if (IsScalar)
{
Expand All @@ -55,10 +55,7 @@ public bool TryProxy(

using var nodeObserver = new RangeNodeObserver(writer);
_callback(writer);

if (!nodeObserver.HasValue)
throw new InvalidOperationException("Provided proxy wrote no value");


first = nodeObserver.First;
last = nodeObserver.Last;
return true;
Expand Down

0 comments on commit b942a6b

Please sign in to comment.