Compile-time analysis of which scopes reference which ^arg(...) templates.
Given a resource, walks every scope's resolved (inheritance-applied) filter
expression and records the set of {:_arg, name} references per scope.
Inverting that mapping produces %{arg_name => [scope_atoms]}, which the
AshGrant.Transformers.AddArgumentResolvers transformer uses to wire up
AshGrant.Changes.ResolveArgument only where the argument is actually needed.
The walker understands the following AST shapes:
%Ash.Query.BooleanExpression{},%Ash.Query.Not{}%Ash.Query.Call{args: [...]}%Ash.Query.Exists{expr: ...}%Ash.Query.Ref{}- structs with
__function__?: trueand:arguments - structs with
__operator__?: true/:left+:right - lists (for
inoperator RHS and function arg collections) - bare
{:_arg, name}template tuples
Summary
Functions
Returns %{arg_name => [scope_names]} for all args referenced by any scope
on the given resource. Uses write-scope resolution so inheritance is applied.
Returns the list of {:_arg, name} argument names referenced anywhere in the
expression.
True iff the expression references {:_arg, name} anywhere.
Types
Functions
@spec arg_to_scopes(Ash.Resource.t()) :: %{required(arg_name()) => [scope_name()]}
Returns %{arg_name => [scope_names]} for all args referenced by any scope
on the given resource. Uses write-scope resolution so inheritance is applied.
Returns the list of {:_arg, name} argument names referenced anywhere in the
expression.
True iff the expression references {:_arg, name} anywhere.