Sha256: caf55e7b325bfef1f60c2fd412ad8bdcd6b0af0535980edef6804e56c46cc9db

Contents?: true

Size: 925 Bytes

Versions: 43

Compression:

Stored size: 925 Bytes

Contents

# frozen_string_literal: true

require_relative 'entry'
require_relative '../datatype/all_datatypes'

module Loxxy
  module BackEnd
    # Representation of a Lox variable.
    # It is a named slot that can be associated with a value at the time.
    class Variable
      include Entry # Add expected behaviour for symbol table entries

      # @return [Datatype::BuiltinDatatype] the value assigned to the variable
      attr_reader :value

      # Create a variable with given name and initial value
      # @param aName [String] The name of the variable
      # @param aValue [Datatype::BuiltinDatatype] the initial assigned value
      def initialize(aName, aValue = Datatype::Nil.instance)
        init_name(aName)
        assign(aValue)
      end

      # @param aValue [Datatype::BuiltinDatatype] the assigned value
      def assign(aValue)
        @value = aValue
      end
    end # class
  end # module
end # module

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
loxxy-0.4.08 lib/loxxy/back_end/variable.rb
loxxy-0.4.07 lib/loxxy/back_end/variable.rb
loxxy-0.4.06 lib/loxxy/back_end/variable.rb
loxxy-0.4.05 lib/loxxy/back_end/variable.rb
loxxy-0.4.04 lib/loxxy/back_end/variable.rb
loxxy-0.4.03 lib/loxxy/back_end/variable.rb
loxxy-0.4.02 lib/loxxy/back_end/variable.rb
loxxy-0.4.01 lib/loxxy/back_end/variable.rb
loxxy-0.4.00 lib/loxxy/back_end/variable.rb
loxxy-0.3.03 lib/loxxy/back_end/variable.rb
loxxy-0.3.02 lib/loxxy/back_end/variable.rb
loxxy-0.3.01 lib/loxxy/back_end/variable.rb
loxxy-0.3.00 lib/loxxy/back_end/variable.rb
loxxy-0.2.06 lib/loxxy/back_end/variable.rb
loxxy-0.2.05 lib/loxxy/back_end/variable.rb
loxxy-0.2.04 lib/loxxy/back_end/variable.rb
loxxy-0.2.03 lib/loxxy/back_end/variable.rb
loxxy-0.2.02 lib/loxxy/back_end/variable.rb
loxxy-0.2.01 lib/loxxy/back_end/variable.rb
loxxy-0.2.00 lib/loxxy/back_end/variable.rb