Module: lib/core/expression/interpreter

The expression interpreter, as a development-only plug-in.

This is the only module that reaches the parser, the tree-walking evaluator and the old source-text sandbox, and the only thing that imports it is the module the compiler adds to a development entry. That is what keeps all three out of a production bundle: they are unreachable there, so the bundler drops them.

It exists because a development build should keep working while a developer is still writing the template — an expression mid-edit, or one using a construct the generator does not cover, should render rather than fail, with the build's AVX_W48 warning saying which. A production build makes the opposite trade: an uncompiled expression is a defect to fix, not a cost to absorb on every page load.

Source:

Members

(inner, constant) statementCache :LruCache

Function bodies built for statement sources the AST evaluator cannot run.

Type:
Source:

Methods

(inner) evaluate(source, scope) → {any}

Evaluates an expression the compiler did not compile.

Parameters:
Name Type Description
source string

The expression source.

scope object

The evaluation scope.

Source:
Returns:

The value.

Type
any

(inner) execute(source, scope) → {any}

Runs a statement body the compiler did not compile.

This is the last new Function in the framework, and it is reachable only from a development build. A body that gets here is one the action compiler refused, which the build reported.

Parameters:
Name Type Description
source string

The statement source.

scope object

The evaluation scope.

Source:
Returns:

Whatever the body returned.

Type
any