def process_attrasgn exp
tar_variable = exp.target
target = process(exp.target)
method = exp.method
index_arg = exp.first_arg
value_arg = exp.second_arg
if method == :[]=
index = exp.first_arg = process(index_arg)
value = exp.second_arg = process(value_arg)
match = Sexp.new(:call, target, :[], index)
set_value match, value
if hash? target
env[tar_variable] = hash_insert target.deep_clone, index, value
end
unless node_type? target, :hash
exp.target = target
end
elsif method.to_s[-1,1] == "="
exp.first_arg = process(index_arg)
value = get_rhs(exp)
match = Sexp.new(:call, target, method.to_s[0..-2].to_sym)
set_value match, value
exp.target = target
else
raise "Unrecognized assignment: #{exp}"
end
exp
end