Class: TRuby::IR::MethodDef

Inherits:
Node
  • Object
show all
Defined in:
lib/t_ruby/ir.rb

Overview

Method definition

Instance Attribute Summary collapse

Attributes inherited from Node

#location, #metadata, #type_info

Instance Method Summary collapse

Methods inherited from Node

#accept, #transform

Constructor Details

#initialize(name:, params: [], return_type: nil, body: nil, visibility: :public, type_params: [], **opts) ⇒ MethodDef



121
122
123
124
125
126
127
128
129
# File 'lib/t_ruby/ir.rb', line 121

def initialize(name:, params: [], return_type: nil, body: nil, visibility: :public, type_params: [], **opts)
  super(**opts)
  @name = name
  @params = params
  @return_type = return_type
  @body = body
  @visibility = visibility
  @type_params = type_params
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



119
120
121
# File 'lib/t_ruby/ir.rb', line 119

def body
  @body
end

#nameObject

Returns the value of attribute name.



119
120
121
# File 'lib/t_ruby/ir.rb', line 119

def name
  @name
end

#paramsObject

Returns the value of attribute params.



119
120
121
# File 'lib/t_ruby/ir.rb', line 119

def params
  @params
end

#return_typeObject

Returns the value of attribute return_type.



119
120
121
# File 'lib/t_ruby/ir.rb', line 119

def return_type
  @return_type
end

#type_paramsObject

Returns the value of attribute type_params.



119
120
121
# File 'lib/t_ruby/ir.rb', line 119

def type_params
  @type_params
end

#visibilityObject

Returns the value of attribute visibility.



119
120
121
# File 'lib/t_ruby/ir.rb', line 119

def visibility
  @visibility
end

Instance Method Details

#childrenObject



131
132
133
# File 'lib/t_ruby/ir.rb', line 131

def children
  [@body].compact
end