Sha256: 7c2976617ca8d693064b945369d9c50396038f30d714ddd8ed19c15018548534
Contents?: true
Size: 761 Bytes
Versions: 1
Compression:
Stored size: 761 Bytes
Contents
require 'gobstones/modules/equal_by_class' module Gobstones module Lang class MultipleAssignment include Gobstones::EqualByClass attr_reader :var_tuple, :expression def initialize(var_tuple, expression) @var_tuple, @expression = var_tuple, expression end def ==(other) super(other) && self.var_tuple == other.var_tuple && self.expression == other.expression end def evaluate(context) # TODO implement as many simple assignments? function_call_result = expression.evaluate(context) function_call_result.length.times do |index| context.set var_tuple.variable_at(index), function_call_result[index] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gobstones-0.0.2 | lib/gobstones/lang/commands/multiple_assignment.rb |