expression property
The expression that follows the atSign.
The syntax of an annotation is fixed:
identifier ('.' identifier)? typeArguments? ('.' identifier)? arguments?.
With arguments, the expression is always a ConstructorInvocation, even
before resolution. Without arguments, the parser produces a chain of
ParsedUnqualifiedName, ParsedNameAccess, and ParsedTypeArguments,
which resolution replaces, depending on what the names denote, with:
- a NameExpression, such as
foo,p.foo, orC.foo; - a TypeLiteral, such as
Corp.C<int>; - a ConstructorTearOff, such as
C.namedorC<int>.named; - a FunctionInstantiation, such as
f<int>.
An annotation is resolved like the same expression written without a keyword in a constant context. A valid annotation is either a read of a constant variable or an invocation of a constant constructor. For any other expression resolution reports a diagnostic, and the annotation has no value.
Implementation
@experimental
Expression get expression;