Metastatic.Supplemental.Validator
(Metastatic v0.10.4)
View Source
Validates supplemental module availability and compatibility.
Analyzes MetaAST documents to detect required supplemental modules and checks if they are registered and compatible.
Summary
Functions
Analyzes a document to detect required supplementals for target language.
Checks if all required supplementals are available for a language.
Lists all supplemental-requiring constructs in a MetaAST.
Functions
@spec analyze(Metastatic.Document.t(), atom()) :: {:ok, map()} | {:error, map()}
Analyzes a document to detect required supplementals for target language.
Returns analysis result with required and available supplementals.
Examples
iex> Validator.analyze(document, :python)
{:ok, %{required: [:actor_call], available: [:actor_call], missing: []}}
iex> Validator.analyze(document_with_actors, :python)
{:error, %{required: [:actor_call], available: [], missing: [:actor_call]}}
@spec compatible?(Metastatic.Document.t(), atom()) :: boolean()
Checks if all required supplementals are available for a language.
Examples
iex> Validator.compatible?(document, :python)
true
Lists all supplemental-requiring constructs in a MetaAST.
Examples
iex> Validator.detect_required_constructs(meta_ast)
[:actor_call, :spawn_actor]