This is a Roslyn-based tool for C# syntax rewriting with the purpose of source-code desugaring.
There are 2 varieties of rewriter:
- a purely syntactic one,
Rewriter, and - a symbolic one,
SymbolicRewriter.
For the rewriting, the former relies on syntactic information only; the latter also relies on symbolic information by means of a SemanticModel.
BlockifyExpressionBodyDeanonymizeTypeDecomposeNullConditionalEmplaceGlobalStatementEnsureVisibleConstructorExpandForeachImplementAutoPropertyImposeExplicitReturnImposeThisPrefixInitializeOutArgumentReplicateLocalInitializationStoreObjectCreationTranslateLinqUncoalesceCoalescedNullUninterpolateStringsUnparameterizeRecordDeclaration
Hint: A "description" of the exact rewrite performed by a given rewriter, you might want to check the tests.
void ApplyRewrite(IRewriter rewriter, SyntaxTree tree) { SyntaxTree tree_P; if (rewriter.IsPurelySyntactic()) { tree_P = ((Rewriter)rewriter).Apply(tree); } else { Compilation compilation = /* ... */ tree_P = ((SymbolicRewriter)rewriter).Apply(tree, compilation.GetSemanticModel(tree)); } }