Skip to content

Suggested feature: default AST visitor context #332

Closed
@Shane32

Description

@Shane32

Currently there is no default implementation of IASTVisitorContext. I suggest providing one with a CancellationToken and one without a CancellationToken (where => default;).

In a similar vein, perhaps we should add an extension method to run a visitor synchronously. Many visitors will not run asynchronously and will not need a cancellation token. .GetAwaiter().GetResult() produces a warning as it will not work correctly if run on a truly asynchronous task, but .ToTask() returns Task.CompletedTask for a completed ValueTask and so perhaps .ToTask().GetAwaiter().GetResult() is an allocation-free and safe method to expose externally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions