Sha256: bd6de9a8c92ac1fe525fe2bb6dc0750b07c8506690d469deab48f57f8ae73e55

Contents?: true

Size: 685 Bytes

Versions: 3

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

module RubyNext
  module Language
    module Rewriters
      class MethodReference < Base
        SYNTAX_PROBE = "Language.:transform"
        MIN_SUPPORTED_VERSION = Gem::Version.new("2.7.0")

        def on_meth_ref(node)
          context.track! self

          receiver, mid = *node.children

          node.updated(
            :send,
            [
              receiver,
              :method,
              s(:sym, mid)
            ]
          )
        end

        begin
          transform(SYNTAX_PROBE)
        rescue ::Parser::SyntaxError
          warn_custom_parser_required_for("method reference")
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
ruby-next-core-0.4.0 lib/ruby-next/language/rewriters/method_reference.rb
ruby-next-0.3.0 lib/ruby-next/language/rewriters/method_reference.rb
ruby-next-core-0.3.0 lib/ruby-next/language/rewriters/method_reference.rb