Skip to content

Commit 796ac3f

Browse files
authored
Switch to mini_racer to support Object.setPrototypeOf in the repl mode. (opal#1840)
1 parent 8cdbc41 commit 796ac3f

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ gem 'tilt', tilt_version if tilt_version
1919
gem 'sprockets', sprockets_version if sprockets_version
2020

2121
group :repl do
22-
gem 'therubyracer', platform: :mri, require: false
22+
gem 'mini_racer', platform: :mri, require: false
2323
gem 'therubyrhino', platform: :jruby, require: false
2424
end
2525

exe/opal-repl

+3-11
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,12 @@ module Opal
1414
return if @v8
1515

1616
begin
17-
require 'v8'
17+
require 'mini_racer'
1818
rescue LoadError
19-
abort 'opal-repl depends on therubyracer gem, which is not currently installed'
19+
abort 'opal-repl depends on mini_racer gem, which is not currently installed'
2020
end
2121

22-
# Patch V8::Object#respond_to? to avoid MRI warning
23-
V8::Object.class_eval do
24-
def respond_to?(method, private = false)
25-
super or self[method] != nil
26-
end
27-
end
28-
29-
@v8 = V8::Context.new
30-
@v8['console'] = self
22+
@v8 = MiniRacer::Context.new
3123
@v8.eval Opal::Builder.new.build('opal').to_s
3224

3325
if filename

0 commit comments

Comments
 (0)