Statifier.Validator.Checks.Final (Statifier v2.1.1)

Copy Markdown View Source

Check 6 (spec 3.7): a :final state's content model is onentry, onexit, and donedata - nothing else. Two reasons, each reported once per offending child and at the child's own location rather than the <final>'s, so the caret lands on the element that should not be there:

  • {:final_has_states, id} for a state child, id being the child's.
  • {:final_has_transitions, id} for a <transition> child, id being the <final>'s - a <final> is where a region stops, so it has no outgoing transition to take. This case was deferred at first, then folded into this module rather than growing a ninth check for one more child type.

An initial attribute or <initial> element on a :final is not reported here: check 3 already refuses it as :initial_on_atomic_state (Checks.InitialTargets's atomic_for_initial?/1 counts :final), and reporting it twice would be two errors for one mistake.

Summary

Functions

Returns a :final_has_states error for every state child of a :final state and a :final_has_transitions error for every <transition> child of one - a <final>'s only legal content is onentry, onexit, and donedata. An initial attribute or <initial> element on a :final is not reported here; check 3 already owns that mistake. Returns [] when no :final state carries an illegal child.

Functions

check(document, context)

@spec check(
  document :: Statifier.Document.t(),
  context :: Statifier.Validator.Context.t()
) :: [
  Statifier.Validator.Error.t()
]

Returns a :final_has_states error for every state child of a :final state and a :final_has_transitions error for every <transition> child of one - a <final>'s only legal content is onentry, onexit, and donedata. An initial attribute or <initial> element on a :final is not reported here; check 3 already owns that mistake. Returns [] when no :final state carries an illegal child.