Class: Rigor::Plugin::TypeNodeResolver
- Inherits:
-
Object
- Object
- Rigor::Plugin::TypeNodeResolver
- Defined in:
- lib/rigor/plugin/type_node_resolver.rb
Overview
Plugin-supplied resolver for custom named / generic type vocabulary in RBS::Extended payloads. ADR-13 § “Decision”.
Subclasses override #resolve to return a Type::Base when the node matches the vocabulary the resolver covers, or ‘nil` to fall through to the next resolver in the chain (and finally to the built-in / RBS fallback). The base implementation returns `nil` so an unimplemented subclass is a safe no-op.
Resolvers are registered through their plugin’s manifest under the ‘type_node_resolvers:` slot:
class RigorTypescriptUtilityTypes < Rigor::Plugin::Base
manifest(
id: "typescript-utility-types",
version: "0.1.0",
type_node_resolvers: [Resolvers::Pick.new,
Resolvers::Omit.new]
)
end
Slice 2 of the ADR-13 envelope (this file) ships the base class + manifest hook + registry aggregation. The parser- side wiring that actually consults the resolver chain arrives in slice 3, when TypeNode::NameScope and the dispatcher between Builtins::ImportedRefinements::Parser and the chain land. Until then resolvers can be unit-tested in isolation but never run for a real ‘%arigor:v1:…` payload.
Resolvers SHOULD be stateless and re-entrant; the registry builds the chain once per ‘Analysis::Runner.run` and may consult any resolver multiple times for the same node.
Instance Method Summary collapse
-
#resolve(node, scope) ⇒ Rigor::Type::Base?
Resolved type, or ‘nil` to fall through.
Instance Method Details
#resolve(node, scope) ⇒ Rigor::Type::Base?
Returns resolved type, or ‘nil` to fall through.
47 48 49 |
# File 'lib/rigor/plugin/type_node_resolver.rb', line 47 def resolve(node, scope) # rubocop:disable Lint/UnusedMethodArgument nil end |