Module: lib/compiler/templateEvents

One walk over a template, shared by everything that needs it.

Source:

Methods

(static) collectTemplateEvents(template) → {Array:.<object:>}

Collects every expression-bearing construct in a template, with its offset.

Two callers need exactly this walk and must not drift apart: validateTemplate runs it over the processed template to report undeclared references, and Atlas runs it over the original source — where the offsets still point at what the developer wrote — to record the relationships each construct creates.

Offsets are relative to whatever string is passed in. Nothing here assumes the template has been transformed, so it is safe on raw source.

Parameters:
Name Type Description
template string

The template text to walk.

Source:
Returns:

Events ordered by offset. Each carries type, index and length; expression-bearing types also carry expr.

Type
Array:.<object:>