def add_variables_from_node(lhs, scope_stack, allow_duplicates=true)
      case lhs[0]
      when :@ident
        scope_stack.add_variable(lhs[1], allow_duplicates)
      when :const_path_field, :@const, :top_const_field
        if scope_stack.in_method?
          raise DynamicConstantError.new
        end
      when Array
        add_variable_list(lhs, scope_stack, allow_duplicates)
      when :mlhs_paren, :var_field, :rest_param, :blockarg
        add_variables_from_node(lhs[1], scope_stack, allow_duplicates)
      when :mlhs_add_star
        pre_star, star, post_star = lhs[1..3]
        add_variable_list(pre_star, scope_stack, allow_duplicates)
        if star
          add_variables_from_node(star, scope_stack, allow_duplicates)
        end
        add_variable_list(post_star, scope_stack, allow_duplicates) if post_star
      when :param_error
        raise InvalidArgumentError.new
      when :assign_error
        raise LHSError.new
      end
    end
def add_variables_from_node(lhs, scope_stack, allow_duplicates=true)
      case lhs[0]
      when :@ident
        scope_stack.add_variable(lhs[1], allow_duplicates)
      when :const_path_field, :@const, :top_const_field
        if scope_stack.in_method?
          raise DynamicConstantError.new
        end
      when Array
        add_variable_list(lhs, scope_stack, allow_duplicates)
      when :mlhs_paren, :var_field, :rest_param, :blockarg
        add_variables_from_node(lhs[1], scope_stack, allow_duplicates)
      when :mlhs_add_star
        pre_star, star, post_star = lhs[1..3]
        add_variable_list(pre_star, scope_stack, allow_duplicates)
        if star
          add_variables_from_node(star, scope_stack, allow_duplicates)
        end
        add_variable_list(post_star, scope_stack, allow_duplicates) if post_star
      when :param_error
        raise InvalidArgumentError.new
      when :assign_error
        raise LHSError.new
      end
    end
Adds variables to the given scope stack from the given node. Allows
 nodes from parameter lists, left-hand-sides, block argument lists, and
 so on.