Compile-time validation of cross-entity references in the DSL.
Catches a family of "typo or stale reference" errors that would otherwise
surface as a runtime crash, a silent nil, or a quiet shadow — usually deep
inside lavash's runtime where the user can't easily trace them back to the
original mistake. Each check raises Spark.Error.DslError with the
offending entity name and a hint at the fix.
Run after Lavash.Transformers.ExpandFields (so all synthesized entities
— animated phase states, setter actions, etc. — are present) and before
any compile transformer.
Checks:
statename uniqueness — twostate :foo, ...declarations are a silent shadow (second wins).calculatename uniqueness — twocalculate :foo, ...likewise.- state/calculate name collision — a calculation with the same name as a state silently masks the state.
actionname uniqueness — duplicateaction :foo do ... endsilently keeps only one.reads [:field]— references must match a state OR calculation. Today this surfaces asKeyErrorinside the run body.set :field, ...— target must be a declared state.set ..., rx(@field)deps — references inside rx must match declared states or calculations. Today an unknown @field evaluates tonilsilently.calculate :foo, rx(@field)deps — same shape as #7.- Action guards (
action :foo, [], [:guard])— guard names must match a declared boolean state or calculation.
Summary
Functions
Callback implementation for Spark.Dsl.Transformer.after?/1.
Callback implementation for Spark.Dsl.Transformer.after_compile?/0.
Callback implementation for Spark.Dsl.Transformer.before?/1.
Callback implementation for Spark.Dsl.Transformer.transform/1.
Functions
Callback implementation for Spark.Dsl.Transformer.after?/1.
Callback implementation for Spark.Dsl.Transformer.after_compile?/0.
Callback implementation for Spark.Dsl.Transformer.before?/1.
Callback implementation for Spark.Dsl.Transformer.transform/1.