Sha256: 0034ff0bc4f2b1bb745542d7945a2279d32b28a80dbd1bdfd47c1bb6662669ea

Contents?: true

Size: 712 Bytes

Versions: 11

Compression:

Stored size: 712 Bytes

Contents

# frozen_string_literal: true

module Unparser
  class Emitter
    # Emitter for for nodes
    class For < self
      include Terminated

      handle :for

      children :condition, :assignment, :body

    private

      # Perform dispatch
      #
      # @return [undefined]
      #
      # @api private
      #
      def dispatch
        write(K_FOR, WS)
        emit_condition
        emit_body
        k_end
      end

      # Emit assignment
      #
      # @return [undefined]
      #
      # @api private
      #
      def emit_condition
        visit_plain(condition)
        write(WS, K_IN, WS)
        visit(assignment)
        write(WS, K_DO)
      end

    end # For
  end # Emitter
end # Unparser

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unparser-0.4.9 lib/unparser/emitter/for.rb
unparser-0.4.8 lib/unparser/emitter/for.rb
unparser-0.4.7 lib/unparser/emitter/for.rb
unparser-0.4.6 lib/unparser/emitter/for.rb
unparser-0.4.5 lib/unparser/emitter/for.rb
unparser-0.4.4 lib/unparser/emitter/for.rb
unparser-0.4.3 lib/unparser/emitter/for.rb
unparser-0.4.2 lib/unparser/emitter/for.rb
unparser-0.4.1 lib/unparser/emitter/for.rb
unparser-0.4.0 lib/unparser/emitter/for.rb
unparser-0.3.0 lib/unparser/emitter/for.rb