Sha256: 0470887ab422b12771609b3a7c7eae102af567f171f3a03af99ff5a09a9ab731

Contents?: true

Size: 670 Bytes

Versions: 24

Compression:

Stored size: 670 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)
        # noop
      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

24 entries across 24 versions & 1 rubygems

Version Path
opal-1.5.1 lib/opal/rewriters/break_finder.rb
opal-1.5.0 lib/opal/rewriters/break_finder.rb
opal-1.5.0.rc1 lib/opal/rewriters/break_finder.rb
opal-1.4.1 lib/opal/rewriters/break_finder.rb
opal-1.4.0 lib/opal/rewriters/break_finder.rb
opal-1.4.0.alpha1 lib/opal/rewriters/break_finder.rb
opal-1.3.2 lib/opal/rewriters/break_finder.rb
opal-1.3.1 lib/opal/rewriters/break_finder.rb
opal-1.3.0 lib/opal/rewriters/break_finder.rb
opal-1.3.0.rc1 lib/opal/rewriters/break_finder.rb
opal-1.3.0.alpha1 lib/opal/rewriters/break_finder.rb
opal-1.2.0 lib/opal/rewriters/break_finder.rb
opal-1.2.0.beta1 lib/opal/rewriters/break_finder.rb
opal-1.1.1 lib/opal/rewriters/break_finder.rb
opal-1.1.1.rc1 lib/opal/rewriters/break_finder.rb
opal-1.1.0 lib/opal/rewriters/break_finder.rb
opal-1.1.0.rc1 lib/opal/rewriters/break_finder.rb
opal-1.0.5 lib/opal/rewriters/break_finder.rb
opal-1.0.4 lib/opal/rewriters/break_finder.rb
opal-1.0.3 lib/opal/rewriters/break_finder.rb