Sha256: 651d916b3fe03cf5025789634b170e93b02902100acb36946092be1cd8fe6c24

Contents?: true

Size: 921 Bytes

Versions: 2

Compression:

Stored size: 921 Bytes

Contents

# frozen_string_literal: true

require 'parser'
require 'tempfile'
require 'vernacular'

require 'vernacular/ast/ast_parser'
require 'vernacular/ast/modifier'
require 'vernacular/ast/version'

require 'vernacular/ast/modifiers/typed_method_args'
require 'vernacular/ast/modifiers/typed_method_returns'

module Vernacular
  # Extends Vernacular to support rewriting the AST
  module AST
    PARSER_PATH = File.expand_path('ast/parser.rb', __dir__).freeze

    Vernacular::InstructionSequenceMixin.prepend(
      Module.new do
        def load_iseq(filepath)
          super unless filepath == PARSER_PATH
        end
      end
    )

    Vernacular::BootsnapMixin.prepend(
      Module.new do
        def input_to_storage(_, filepath)
          if filepath == PARSER_PATH
            raise ::Bootsnap::CompileCache::Uncompilable, "can't compile parser"
          end

          super
        end
      end
    )
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vernacular-ast-0.1.0 lib/vernacular/ast.rb
vernacular-ast-0.0.1 lib/vernacular/ast.rb