Open sandboxFocus

Interface IDurableExpression

A representation of an IExpression that is safe to be held across compilations. Obtain one by calling ToDurable(IExpression), and turn it back into an IExpression by calling ToExpression(ICompilation).

Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
[InternalImplement]
[Durable]
[ImmutableType]
public interface IDurableExpression
Remarks

This is to IExpression what IDurableRef<T> is to IRef<T>. An IExpression is not durable: one captured in a template holds its compilation, and one read from the code model holds the syntax tree of its source file. Aspect state that must survive an edit cannot hold either.

The conversion renders the expression immediately and keeps the result, so it works for every kind of expression.

Properties

Name Description
IsAssignable

Gets a value indicating whether the value of the expression can be set, which is the counterpart of IsAssignable.

Text

Gets the C# code of the expression, which is what a serializer of aspect state persists.

Type

Gets a durable reference to the type of the expression, which is the counterpart of Type.

Methods

Name Description
ToExpression(ICompilation)

Returns an IExpression for a given compilation.

Extension Methods