Class: TypeProf::Core::ActualArguments
- Inherits:
-
Object
- Object
- TypeProf::Core::ActualArguments
- Defined in:
- lib/typeprof/core/env/method.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#positionals ⇒ Object
readonly
Returns the value of attribute positionals.
-
#splat_flags ⇒ Object
readonly
Returns the value of attribute splat_flags.
Instance Method Summary collapse
- #get_keyword_arg(genv, changes, name) ⇒ Object
- #get_rest_args(genv, start_rest, end_rest) ⇒ Object
-
#initialize(positionals, splat_flags, keywords, block) ⇒ ActualArguments
constructor
A new instance of ActualArguments.
- #new_vertexes(genv, node) ⇒ Object
Constructor Details
#initialize(positionals, splat_flags, keywords, block) ⇒ ActualArguments
Returns a new instance of ActualArguments.
27 28 29 30 31 32 |
# File 'lib/typeprof/core/env/method.rb', line 27 def initialize(positionals, splat_flags, keywords, block) @positionals = positionals @splat_flags = splat_flags @keywords = keywords @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
34 35 36 |
# File 'lib/typeprof/core/env/method.rb', line 34 def block @block end |
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
34 35 36 |
# File 'lib/typeprof/core/env/method.rb', line 34 def keywords @keywords end |
#positionals ⇒ Object (readonly)
Returns the value of attribute positionals.
34 35 36 |
# File 'lib/typeprof/core/env/method.rb', line 34 def positionals @positionals end |
#splat_flags ⇒ Object (readonly)
Returns the value of attribute splat_flags.
34 35 36 |
# File 'lib/typeprof/core/env/method.rb', line 34 def splat_flags @splat_flags end |
Instance Method Details
#get_keyword_arg(genv, changes, name) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/typeprof/core/env/method.rb', line 66 def get_keyword_arg(genv, changes, name) vtx = Vertex.new(self) @keywords.each_type do |ty| case ty when Type::Hash changes.add_edge(genv, ty.get_value(name), vtx) when Type::Instance if ty.mod == genv.mod_hash changes.add_edge(genv, ty.args[1], vtx) end else # what to do? end end vtx end |
#get_rest_args(genv, start_rest, end_rest) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/typeprof/core/env/method.rb', line 44 def get_rest_args(genv, start_rest, end_rest) vtxs = [] start_rest.upto(end_rest - 1) do |i| a_arg = @positionals[i] if @splat_flags[i] a_arg.each_type do |ty| ty = ty.base_type(genv) if ty.is_a?(Type::Instance) && ty.mod == genv.mod_ary && ty.args[0] vtxs << ty.args[0].new_vertex(genv, self) else "???" end end else vtxs << a_arg end end vtxs.uniq end |
#new_vertexes(genv, node) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/typeprof/core/env/method.rb', line 36 def new_vertexes(genv, node) positionals = @positionals.map {|arg| arg.new_vertex(genv, node) } splat_flags = @splat_flags keywords = @keywords ? @keywords.new_vertex(genv, node) : nil block = @block ? @block.new_vertex(genv, node) : nil ActualArguments.new(positionals, splat_flags, keywords, block) end |