Class: Yoda::Typing::Inferencer::Arguments
- Inherits:
-
Object
- Object
- Yoda::Typing::Inferencer::Arguments
- Defined in:
- lib/yoda/typing/inferencer/arguments.rb
Instance Method Summary collapse
- #accepted_by?(signature) ⇒ Boolean
- #infer_argument_nodes(argument_nodes) ⇒ {Symbol => Types::Base}
-
#initialize(argument_nodes, tracer) ⇒ Arguments
constructor
A new instance of Arguments.
Constructor Details
#initialize(argument_nodes, tracer) ⇒ Arguments
Returns a new instance of Arguments.
7 8 9 10 |
# File 'lib/yoda/typing/inferencer/arguments.rb', line 7 def initialize(argument_nodes, tracer) @argument_nodes = argument_nodes @tracer = tracer end |
Instance Method Details
#accepted_by?(signature) ⇒ Boolean
14 15 16 |
# File 'lib/yoda/typing/inferencer/arguments.rb', line 14 def accepted_by?(signature) signature.parameters end |
#infer_argument_nodes(argument_nodes) ⇒ {Symbol => Types::Base}
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/yoda/typing/inferencer/arguments.rb', line 20 def infer_argument_nodes(argument_nodes) argument_nodes.each_with_object({}) do |node, obj| case node.type when :splat # TODO infer(node) when :block_pass obj[:block_argument] = infer(node.children.first) else obj[:arguments] ||= [] obj[:arguments].push(infer(node)) end end end |