IRewriteStep Interface

Definition

public interface IRewriteStep
type IRewriteStep = interface
Public Interface IRewriteStep

Properties

AssemblyConstants

Dictionary that will be populated by the Q# compiler when the rewrite step is loaded. It contains the assembly constants for the Q# compilation unit on which the rewrite step is acting.

GeneratedDiagnostics

Contains diagnostics generated by the rewrite step and intended for display to the user. Depending on the specified build configuration, the generated diagnostics may be queried after all implemented interface methods have been executed.

ImplementsPostconditionVerification

A postcondition verification provides the means for diagnostics generation and detailed checks after transformation. The verification is executed only if the precondition verification passes and after applying the implemented transformation (if any).

ImplementsPreconditionVerification

If a precondition verification is implemented, that verification is executed prior to executing anything else. If the verification fails, nothing further is executed and the rewrite step is terminated.

ImplementsTransformation

Indicates whether or not the rewrite step intends to modify the compilation in any form. If a transformation is implemented, then that transformation will be executed only if either no precondition verification is implemented, or the implemented precondition verification succeeds.

Name

User facing name identifying the rewrite step used for logging and in diagnostics.

Priority

The priority of the transformation relative to other transformations within the same dll or package. Steps with a larger priority number have higher priority and will be executed first.

Methods

PostconditionVerification(QsCompilation)

Verifies whether a given compilation satisfies the postcondition after executing the implemented transformation (if any). ImplementsPostconditionVerification indicates whether or not this method is implemented. The verification may be omitted for performance reasons depending on the build configuration. The postcondition verification should never throw an exception, but instead indicate if the postcondition is satisfied via the returned value. More detailed information can be displayed to the user by generating suitable diagnostics.

PreconditionVerification(QsCompilation)

Verifies whether a given compilation satisfies the precondition for executing this rewrite step. ImplementsPreconditionVerification indicates whether or not this method is implemented. If the precondition verification succeeds, then the invocation of an implemented transformation (if any) with the given compilation should complete without throwing an exception. The precondition verification should never throw an exception, but instead indicate if the precondition is satisfied via the returned value. More detailed information can be provided via logging.

Transformation(QsCompilation, QsCompilation)

Implements a rewrite step transforming a Q# compilation. ImplementsTransformation indicates whether or not this method is implemented. The transformation should complete without throwing an exception if no precondition verification is implemented or the implemented verification passes.

Applies to