Class: Chelsy::Function
- Inherits:
-
Declarative
- Object
- Node
- Element
- Declarative
- Chelsy::Function
- Defined in:
- lib/chelsy/ast.rb
Overview
== 6.9.1 Function definition
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#return_type ⇒ Object
readonly
Returns the value of attribute return_type.
Attributes inherited from Declarative
Attributes inherited from Element
Instance Method Summary collapse
-
#initialize(name, return_type, params, inline: false, **rest, &block) ⇒ Function
constructor
A new instance of Function.
Methods inherited from Declarative
Constructor Details
#initialize(name, return_type, params, inline: false, **rest, &block) ⇒ Function
Returns a new instance of Function.
1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 |
# File 'lib/chelsy/ast.rb', line 1142 def initialize(name, return_type, params, inline: false, **rest, &block) @name = Syntax::Ident.ensure(name) @return_type = Syntax::Type.ensure(return_type) @params = ParamList.new(params) @body = Block.new block.call(@body) super(**rest) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
1140 1141 1142 |
# File 'lib/chelsy/ast.rb', line 1140 def body @body end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
1140 1141 1142 |
# File 'lib/chelsy/ast.rb', line 1140 def name @name end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
1140 1141 1142 |
# File 'lib/chelsy/ast.rb', line 1140 def params @params end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
1140 1141 1142 |
# File 'lib/chelsy/ast.rb', line 1140 def return_type @return_type end |