Sha256: 78c495e012b90584e7db454a16c866923c526be5e21953334c9c210730d061a9

Contents?: true

Size: 654 Bytes

Versions: 7

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true
require 'opal/rewriter'

module Opal
  module Rewriters
    class BreakFinder < Opal::Rewriters::Base
      def initialize
        @found_break = false
      end

      def found_break?
        @found_break
      end

      def on_break(node)
        @found_break = true
        node
      end

      def stop_lookup(node)
      end

      # regular loops
      alias on_for        stop_lookup
      alias on_while      stop_lookup
      alias on_while_post stop_lookup
      alias on_until      stop_lookup
      alias on_until_post stop_lookup

      # nested block
      alias on_block      stop_lookup
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opal-0.11.4 lib/opal/rewriters/break_finder.rb
opal-0.11.3 lib/opal/rewriters/break_finder.rb
opal-0.11.2 lib/opal/rewriters/break_finder.rb
opal-0.11.1 lib/opal/rewriters/break_finder.rb
opal-0.11.1.pre lib/opal/rewriters/break_finder.rb
opal-0.11.0 lib/opal/rewriters/break_finder.rb
opal-0.11.0.rc1 lib/opal/rewriters/break_finder.rb