Class: Carbon::Compiler::Node::Definition::Function
- Defined in:
- lib/carbon/compiler/node/definition/function.rb,
lib/carbon/compiler/node/definition/function/body.rb,
lib/carbon/compiler/node/definition/function/name.rb,
lib/carbon/compiler/node/definition/function/parameter.rb,
lib/carbon/compiler/node/definition/function/parameters.rb
Overview
A function definition. This contains information about the arguments to be passed to the function, the “klass” (type) or return type of the function, the body of a function (if an extern function, this is null), and the associated Project::Function information, when tied.
Defined Under Namespace
Classes: Body, Name, Parameter, Parameters
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#behavior? ⇒ true
If this definition is a behavior definition.
- #generics ⇒ Object
-
#name ⇒ String
The name of the function.
Methods inherited from Base
#[], #accept, #attributes!, #data, #data?, #each, #identity?, #initialize, #map!, mapping, #merge!, #type!, #update!
Constructor Details
This class inherits a constructor from Carbon::Compiler::Node::Base
Instance Method Details
#behavior? ⇒ true
If this definition is a behavior definition. Functions are the only behavior definitions in a module.
25 26 27 |
# File 'lib/carbon/compiler/node/definition/function.rb', line 25 def behavior? true end |
#generics ⇒ Object
37 38 39 |
# File 'lib/carbon/compiler/node/definition/function.rb', line 37 def generics @children[0].generics end |
#name ⇒ String
The name of the function. This is used in place of an actual node for various reasons.
33 34 35 |
# File 'lib/carbon/compiler/node/definition/function.rb', line 33 def name @children[0].name.value end |