File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -933,6 +933,10 @@ namespace GraphQLParser.Visitors
933933 public System.Threading.CancellationToken CancellationToken { get; init; }
934934 public System.Collections.Generic.Stack<GraphQLParser.AST.ASTNode> Parents { get; init; }
935935 }
936+ public struct DefaultVisitorContext : GraphQLParser.Visitors.IASTVisitorContext
937+ {
938+ public System.Threading.CancellationToken CancellationToken { get; set; }
939+ }
936940 public interface IASTVisitorContext
937941 {
938942 System.Threading.CancellationToken CancellationToken { get; }
@@ -960,6 +964,10 @@ namespace GraphQLParser.Visitors
960964 public MaxDepthVisitor() { }
961965 public override System.Threading.Tasks.ValueTask VisitAsync(GraphQLParser.AST.ASTNode? node, TContext context) { }
962966 }
967+ public struct NullVisitorContext : GraphQLParser.Visitors.IASTVisitorContext
968+ {
969+ public System.Threading.CancellationToken CancellationToken { get; }
970+ }
963971 public static class PrintContextExtensions
964972 {
965973 public static System.Threading.Tasks.ValueTask WriteAsync<TContext>(this TContext context, GraphQLParser.ROM value)
Original file line number Diff line number Diff line change 1+ namespace GraphQLParser . Visitors ;
2+
3+ /// <summary>
4+ /// An implementation of <see cref="IASTVisitorContext"/> that only contains a <see cref="CancellationToken"/>.
5+ /// Ideal for use in cases where there is no context variables.
6+ /// </summary>
7+ public struct DefaultVisitorContext : IASTVisitorContext
8+ {
9+ /// <inheritdoc/>
10+ public CancellationToken CancellationToken { get ; set ; }
11+ }
Original file line number Diff line number Diff line change 1+ namespace GraphQLParser . Visitors ;
2+
3+ /// <summary>
4+ /// An implementation of <see cref="IASTVisitorContext"/> that does nothing.
5+ /// Ideal for use in cases where the visitor runs synchronously, there is no context
6+ /// variables, and cancellation is not required.
7+ /// </summary>
8+ public struct NullVisitorContext : IASTVisitorContext
9+ {
10+ /// <inheritdoc/>
11+ public readonly CancellationToken CancellationToken => default ;
12+ }
You can’t perform that action at this time.
0 commit comments