Checks template expressions at build time, not at render time.
Template interpolations, computed values and directive bindings are evaluated by Avenx's own expression evaluator, which covers the expression language and refuses anything outside it. Without this pass a developer finds that out when the component renders — possibly in production, possibly on a branch a test never took.
The compiler already holds every one of those expressions as source text. Parsing them here means an unsupported expression fails the build, with the file, the line and the reason, instead of becoming an AVX_R32 at runtime.
Action bodies are deliberately not checked. They are statement JavaScript and
always have been; if, for and return are not expressions, and the
runtime runs them as statements.
Members
(inner, constant) EXPRESSION_ATTRIBUTES :Array:.<string:>
Attributes whose value is an expression rather than a statement.
data-ax-event holds handler statements and is excluded: a handler may
legitimately be a statement sequence.
Type:
Methods
(static) collectTemplateExpressions(template) → {Array:.<{source:: string:, kind:: string:}>}
Finds every expression in a template, with its source offset.
Interpolations and directive attribute values only. Reading them out of the rewritten template rather than the original source means the offsets point at a string the developer never wrote, so the location is reported against the original file by searching for the expression text — imprecise for a repeated expression, and honest about it: the message names the expression itself, which is what a developer searches for.
Parameters:
| Name | Type | Description |
|---|---|---|
template |
string | The rewritten template. |
Returns:
The expressions found.
(static) validateComponentExpressions(unit) → {Array:.<TemplateValidationError:>}
Validates every expression a component evaluates as an expression.
Parameters:
Returns:
One error per unsupported expression.
- Type
- Array:.<TemplateValidationError:>