Class: Highway::Compiler::Analyze::Tree::Segments::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/highway/compiler/analyze/tree/segments/variable.rb

Overview

This class represents a variable value segment in the semantic tree. It consists of a variable name and its lookup scope.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, scope:) ⇒ Variable

Initialize an instance.

Parameters:

  • name (String)

    The variable name.

  • scope (Symbol)

    The lookup scope of variable.



22
23
24
25
# File 'lib/highway/compiler/analyze/tree/segments/variable.rb', line 22

def initialize(name, scope:)
  @name = name
  @scope = scope
end

Instance Attribute Details

#nameString (readonly)

The variable name.

Returns:

  • (String)


30
31
32
# File 'lib/highway/compiler/analyze/tree/segments/variable.rb', line 30

def name
  @name
end

#scopeSymbol (readonly)

The lookup scope of the variable.

Returns:

  • (Symbol)


35
36
37
# File 'lib/highway/compiler/analyze/tree/segments/variable.rb', line 35

def scope
  @scope
end