Sha256: e5c4b735068a40f60e1f942c28df8498371ba45803333dcde64f87144dd99cb6
Contents?: true
Size: 1.24 KB
Versions: 12
Compression:
Stored size: 1.24 KB
Contents
module Steep module Interface class Abstract attr_reader :name attr_reader :kind attr_reader :params attr_reader :methods attr_reader :supers attr_reader :ivar_chains def initialize(name:, params:, methods:, supers:, ivar_chains:) @name = name @params = params @methods = methods @supers = supers @ivar_chains = ivar_chains end def ivars @ivars ||= ivar_chains.transform_values(&:type) end def ==(other) other.is_a?(self.class) && other.name == name && other.params == params && other.methods == methods && other.supers == supers && other.ivars == ivars end def instantiate(type:, args:, instance_type:, module_type:) Steep.logger.debug("type=#{type}, self=#{name}, args=#{args}, params=#{params}") subst = Substitution.build(params, args, instance_type: instance_type, module_type: module_type, self_type: type) Instantiated.new( type: type, methods: methods.transform_values {|method| method.subst(subst) }, ivar_chains: ivar_chains.transform_values {|chain| chain.subst(subst) } ) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems