Sha256: a5e454b17cf424071151968e0e0c91c726684196af6a83f05aff4c4471311f66

Contents?: true

Size: 892 Bytes

Versions: 13

Compression:

Stored size: 892 Bytes

Contents

# frozen_string_literal: true

require "ruby-next"
require "ruby-next/utils"
require "ruby-next/language"

RubyNext::Language.runtime!

# Patch bootsnap to transform source code.
# Based on https://github.com/kddeisz/preval/blob/master/lib/preval.rb
load_iseq = RubyVM::InstructionSequence.method(:load_iseq)

if load_iseq.source_location[0].include?("/bootsnap/")
  Bootsnap::CompileCache::ISeq.singleton_class.prepend(
    Module.new do
      def input_to_storage(source, path, *)
        return super unless RubyNext::Language.transformable?(path)
        source = RubyNext::Language.transform(source, rewriters: RubyNext::Language.current_rewriters)

        RubyNext.debug_source(source, path)

        RubyVM::InstructionSequence.compile(source, path, path).to_binary
      rescue SyntaxError
        raise Bootsnap::CompileCache::Uncompilable, "syntax error"
      end
    end
  )
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ruby-next-core-0.15.3 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.15.2 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.15.1 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.15.0 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.14.1 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.14.0 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.13.3 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.13.2 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.13.1 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.13.0 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.12.0 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.11.1 lib/ruby-next/language/bootsnap.rb
ruby-next-core-0.11.0 lib/ruby-next/language/bootsnap.rb