Class: Stone::AST::ComputedPropertyDefinition
- Inherits:
-
Stone::AST
- Object
- Stone::AST
- Stone::AST::ComputedPropertyDefinition
- Defined in:
- lib/stone/ast/computed_property_definition.rb
Instance Attribute Summary collapse
-
#lambda ⇒ Object
readonly
Returns the value of attribute lambda.
-
#property_name ⇒ Object
readonly
Returns the value of attribute property_name.
-
#type_name ⇒ Object
readonly
Returns the value of attribute type_name.
Attributes inherited from Stone::AST
Instance Method Summary collapse
-
#initialize(type_name, property_name, lambda) ⇒ ComputedPropertyDefinition
constructor
A new instance of ComputedPropertyDefinition.
- #to_llir(builder, mod, scope = Stone::Scope.top_level) ⇒ Object
Constructor Details
#initialize(type_name, property_name, lambda) ⇒ ComputedPropertyDefinition
Returns a new instance of ComputedPropertyDefinition.
10 11 12 13 14 15 |
# File 'lib/stone/ast/computed_property_definition.rb', line 10 def initialize(type_name, property_name, lambda) @name = :computed_property_definition @type_name = type_name @property_name = property_name @lambda = lambda end |
Instance Attribute Details
#lambda ⇒ Object (readonly)
Returns the value of attribute lambda.
8 9 10 |
# File 'lib/stone/ast/computed_property_definition.rb', line 8 def lambda @lambda end |
#property_name ⇒ Object (readonly)
Returns the value of attribute property_name.
8 9 10 |
# File 'lib/stone/ast/computed_property_definition.rb', line 8 def property_name @property_name end |
#type_name ⇒ Object (readonly)
Returns the value of attribute type_name.
8 9 10 |
# File 'lib/stone/ast/computed_property_definition.rb', line 8 def type_name @type_name end |
Instance Method Details
#to_llir(builder, mod, scope = Stone::Scope.top_level) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/stone/ast/computed_property_definition.rb', line 17 def to_llir(builder, mod, scope = Stone::Scope.top_level) # Generate the lambda function func = @lambda.to_llir(builder, mod, scope) # Register as a function alias with the name "Type@property" # This allows lookup via mod.lookup_function("Type@property") function_name = "#{@type_name}@#{@property_name}" mod.register_function_alias(function_name, func) # Return nil (computed properties are definitions, not expressions) nil end |