Represents a subset of a Roslyn Compilation, limited to specific syntax trees. This interface provides an immutable view of the compilation that can be transformed by aspect weavers.
Namespace: Metalama.Framework.Engine.CodeModel
Assembly: Metalama.Framework.Sdk.dll
Syntax
public interface IPartialCompilationRemarks
IPartialCompilation is the primary interface for manipulating compilations in IAspectWeaver implementations. It wraps a Roslyn Compilation and provides methods to transform syntax trees.
Compile-time vs design-time behavior: At compile time, this always represents the complete compilation. At design time (IDE), this represents only the inheritance closure of files that have been modified and need to be recompiled, which is why the IsPartial property exists.
Key operations:
- WithSyntaxTreeTransformations(IReadOnlyList<SyntaxTreeTransformation>?): Apply syntax tree modifications (add, remove, replace).
- WithAdditionalResources(params ManagedResource[]): Add managed resources to the compilation.
This interface is immutable. All modification methods return a new IPartialCompilation instance.
Properties
| Name | Description |
|---|---|
| Compilation | Gets the underlying Roslyn Compilation. |
| IsPartial | Gets a value indicating whether this IPartialCompilation represents a subset of the full compilation, or the complete compilation. |
| Namespaces | Gets the namespaces that contain types in this subset. |
| Resources | Gets the list of managed resources for the current compilation. |
| SyntaxTrees | Gets the syntax trees in the current subset, keyed by file path. |
| Types | Gets the named types declared in the syntax trees of this subset. |
Methods
| Name | Description |
|---|---|
| WithAdditionalResources(params ManagedResource[]) | |
| WithSyntaxTreeTransformations(IReadOnlyList<SyntaxTreeTransformation>?) |