MetalamaAPI documentationAspect APIMetalama.​Framework.​CodeDeclaration­Extensions
Open sandboxFocus

DeclarationExtensions Class

Extension methods for IDeclaration.

Inheritance
System.Object
DeclarationExtensions
Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public static class DeclarationExtensions : Object

Methods

Name Description
ContainingAncestors(IDeclaration)

Gets all containing ancestors, i.e. declaration.ContainingDeclaration, declaration.ContainingDeclaration.ContainingDeclaration, declaration.ContainingDeclaration.ContainingDeclaration.ContainingDeclaration...

ContainingAncestorsAndSelf(IDeclaration)

Gets all containing ancestors including the current declaration, i.e. declaration, declaration.ContainingDeclaration, declaration.ContainingDeclaration.ContainingDeclaration, declaration.ContainingDeclaration.ContainingDeclaration.ContainingDeclaration...

Enhancements<T>(T)

Gets an object that gives access to the aspects, options and annotations on the current declaration.

ForCompilation<T>(T, ICompilation, ReferenceResolutionOptions)

Gets a representation of the current declaration in a different version of the compilation.

GetClosestMemberOrNamedType(IDeclaration)

Gets the declaring IMemberOrNamedType of a given declaration if the declaration if not an IMemberOrNamedType, or the IMemberOrNamedType itself if the given declaration is itself an IMemberOrNamedType.

GetClosestNamedType(IDeclaration)

Gets the declaring INamedType of a given declaration if the declaration if not an INamedType, or the INamedType itself if the given declaration is itself an INamedType.

GetTopmostNamedType(IDeclaration)

Gets the topmost type of a nested type, i.e. a type that is not contained in any other type. If the given type is not a given type, returns the given type itself.

IsContainedIn(IDeclaration, IDeclaration)

Determines if a given declaration is a child of another given declaration, using the ContainingDeclaration relationship for all declarations except for named type, where the parent namespace is considered.

IsRecordCopyConstructor(IConstructor)
TryForCompilation<T>(T, ICompilation, out T, ReferenceResolutionOptions)

Tries to get a representation of the current declaration in a different version of the compilation.