Open sandboxFocus

Class RefExtensions

Extension methods for resolving IRef<T> references to their target declarations.

Inheritance
RefExtensions
Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public static class RefExtensions
Remarks

This class provides the primary methods for resolving references to declarations. References are used because IDeclaration objects are bound to a specific ICompilation, which changes at each step of the aspect pipeline. References provide a stable way to identify the same declaration across these compilation versions.

Key methods:

Methods

Name Description
Equals(IRef, IRef?, bool)
GetTarget(IRef, ICompilation, IGenericContext?, Type?)

Resolves a non-generic reference to its target declaration within a specific compilation.

GetTargetOrNull(IRef, ICompilation, IGenericContext?, Type?)

Resolves a non-generic reference to its target declaration within a specific compilation, returning null if the reference cannot be resolved.

GetTargetOrNull<T>(IRef<T>)

Resolves a reference to its target declaration using the current Metalama execution context, returning null if the reference cannot be resolved.

GetTargetOrNull<T>(IRef<T>, ICompilation, IGenericContext?)

Resolves a reference to its target declaration within a specific compilation, returning null if the reference cannot be resolved.

GetTarget<T>(IRef<T>)

Resolves a reference to its target declaration using the current Metalama execution context.

GetTarget<T>(IRef<T>, ICompilation, IGenericContext?)

Resolves a reference to its target declaration within a specific compilation.

See Also