class Haml::Compiler

def flush_merged_text

def flush_merged_text
  return if @to_merge.empty?
  str = ""
  mtabs = 0
  @to_merge.each do |type, val, tabs|
    case type
    when :text
      str << inspect_obj(val)[1...-1]
      mtabs += tabs
    when :script
      if mtabs != 0 && !@options[:ugly]
        val = "_hamlout.adjust_tabs(#{mtabs}); " + val
      end
      str << "\#{#{val}}"
      mtabs = 0
    else
      raise SyntaxError.new("[HAML BUG] Undefined entry in Haml::Compiler@to_merge.")
    end
  end
  unless str.empty?
    @precompiled <<
      if @options[:ugly]
        "_hamlout.buffer << \"#{str}\";"
      else
        "_hamlout.push_text(\"#{str}\", #{mtabs}, #{@dont_tab_up_next_text.inspect});"
      end
  end
  @to_merge = []
  @dont_tab_up_next_text = false
end