Class: TypeProf::Core::AST::AttrReaderMetaNode
- Inherits:
-
Node
- Object
- Node
- TypeProf::Core::AST::AttrReaderMetaNode
show all
- Defined in:
- lib/typeprof/core/ast/meta.rb
Instance Attribute Summary collapse
Attributes inherited from Node
#changes, #lenv, #prev_node, #ret, #static_ret
Instance Method Summary
collapse
Methods inherited from Node
#boxes, #code_range, #define, #define0, #define_copy, #diagnostics, #diff, #each_subnode, #get_vertexes, #install, #install_copy, #modified_vars, #pretty_print_instance_variables, #retrieve_at, #subnodes, #traverse, #undefine, #undefine0, #uninstall
Constructor Details
Returns a new instance of AttrReaderMetaNode.
48
49
50
51
52
53
54
55
56
|
# File 'lib/typeprof/core/ast/meta.rb', line 48
def initialize(raw_node, lenv)
super(raw_node, lenv)
@args = []
raw_node.arguments.arguments.each do |raw_arg|
@args << raw_arg.value.to_sym if raw_arg.type == :symbol_node
end
end
|
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
58
59
60
|
# File 'lib/typeprof/core/ast/meta.rb', line 58
def args
@args
end
|
Instance Method Details
#attrs ⇒ Object
60
|
# File 'lib/typeprof/core/ast/meta.rb', line 60
def attrs = { args: }
|
#install0(genv) ⇒ Object
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/typeprof/core/ast/meta.rb', line 76
def install0(genv)
@args.each do |arg|
ivar_name = :"@#{ arg }"
ivar_box = @changes.add_ivar_read_box(genv, @lenv.cref.cpath, false, ivar_name)
e_ret = Vertex.new(self)
ret_box = @changes.add_escape_box(genv, ivar_box.ret, e_ret)
@changes.add_method_def_box(genv, @lenv.cref.cpath, false, arg, FormalArguments::Empty, [ret_box])
end
Source.new
end
|
#mname_code_range(name) ⇒ Object
70
71
72
73
74
|
# File 'lib/typeprof/core/ast/meta.rb', line 70
def mname_code_range(name)
idx = @args.index(name.to_sym) node = @raw_node.arguments.arguments[idx].location
TypeProf::CodeRange.from_node(node)
end
|
#opt_keywords ⇒ Object
67
|
# File 'lib/typeprof/core/ast/meta.rb', line 67
def opt_keywords = []
|
#opt_positionals ⇒ Object
63
|
# File 'lib/typeprof/core/ast/meta.rb', line 63
def opt_positionals = []
|
#post_positionals ⇒ Object
64
|
# File 'lib/typeprof/core/ast/meta.rb', line 64
def post_positionals = []
|
#req_keywords ⇒ Object
66
|
# File 'lib/typeprof/core/ast/meta.rb', line 66
def req_keywords = []
|
#req_positionals ⇒ Object
62
|
# File 'lib/typeprof/core/ast/meta.rb', line 62
def req_positionals = []
|
#rest_keywords ⇒ Object
68
|
# File 'lib/typeprof/core/ast/meta.rb', line 68
def rest_keywords = nil
|
#rest_positionals ⇒ Object
65
|
# File 'lib/typeprof/core/ast/meta.rb', line 65
def rest_positionals = nil
|