Sha256: 9b53d52fe0549b7fbd84575761ff27421dd603e0e9a7dcfb9f315db1d2064e08

Contents?: true

Size: 649 Bytes

Versions: 51

Compression:

Stored size: 649 Bytes

Contents

class Rewriter < Parser::Rewriter
  def on_if(node)
    # Crude, totally-not-usable-in-the-real-world code to remove optional
    # parens from control keywords.
    #
    # In a perfect test scenario we'd simply make this a no-op, to demonstrate
    # that the bug happens when any rewriter is loaded regardless of whether it
    # actually changes anything but that makes assertions much harder to get
    # right.  It's much easier to just show that the file did, or did not
    # get changed.
    if node.children[0].type == :begin
      replace node.children[0].loc.begin, ' '
      remove node.children[0].loc.end
    end

    super
  end
end

Version data entries

51 entries across 51 versions & 4 rubygems

Version Path
dirwatch-0.0.9 vendor/bundle/ruby/2.5.0/gems/parser-2.4.0.2/test/bug_163/rewriter.rb
dirwatch-0.0.8 vendor/bundle/ruby/2.5.0/gems/parser-2.4.0.2/test/bug_163/rewriter.rb
dirwatch-0.0.6 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/bug_163/rewriter.rb
dirwatch-0.0.5 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/bug_163/rewriter.rb
dirwatch-0.0.4 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/bug_163/rewriter.rb
dirwatch-0.0.3 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.2/test/bug_163/rewriter.rb
dirwatch-0.0.2 vendor/bundle/ruby/2.3.0/gems/parser-2.4.0.0/test/bug_163/rewriter.rb
parser-2.4.0.2 test/bug_163/rewriter.rb
parser-2.4.0.1 test/bug_163/rewriter.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/parser-2.4.0.0/test/bug_163/rewriter.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/parser-2.4.0.0/test/bug_163/rewriter.rb
parser-2.4.0.0 test/bug_163/rewriter.rb
parser-2.3.3.1 test/bug_163/rewriter.rb
parser-2.3.3.0 test/bug_163/rewriter.rb
parser-2.3.2.0 test/bug_163/rewriter.rb
parser-2.3.1.4 test/bug_163/rewriter.rb
parser-2.3.1.3 test/bug_163/rewriter.rb
erruby_parser-2.3.1.2 test/bug_163/rewriter.rb
parser-2.3.1.2 test/bug_163/rewriter.rb
parser-2.3.1.1 test/bug_163/rewriter.rb