yhara / dxopal

Game development framework for Opal, API compatible to DXRuby

Home Page:https://yhara.github.io/dxopal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Input.keyevent_target= raises NameError in Opal 1.2.0

sonota88 opened this issue · comments

Hi. I tried to use DXOpal with Opal 1.2.0 and NameError was raised in Input.keyevent_target= (input.rb#L96).

uninitialized class variable @@keyevent_target in DXOpal::Input
    at Opal.class_variable_get (http://localhost:7521/build/dxopal.js:918:28)
    at Function.$Input_keyevent_target$eq$9 (http://localhost:7521/build/dxopal.js:26352:21)
    at Object.Opal.send2 (http://localhost:7521/build/dxopal.js:1773:17)
    at Opal.send (http://localhost:7521/build/dxopal.js:1763:17)
    at eval (eval at <anonymous> (http://localhost:7521/index.html:2:7), <anonymous>:11:3)
    at eval (eval at <anonymous> (http://localhost:7521/index.html:2:7), <anonymous>:13:3)
    at http://localhost:7521/index.html:32:7

It seems to be caused by the following change.

Rework class variables to support inheritance correctly by hmdne · Pull Request # 2251 · opal/opal
opal/opal#2251

Steps to reproduce

ruby -v
  => ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]

git log -1 --oneline
  => 45a9605 (HEAD -> master, tag: v1.5.2, origin/master, origin/HEAD) v1.5.2

Edit Gemfile

-gem 'opal'
-gem 'opal-sprockets'
-gem 'c_lexer'
+gem 'opal', '1.2.0'
+# gem 'opal-sprockets'
+# gem 'c_lexer'
bundle config set --local path 'vendor/bundle'
bundle install

bundle exec opal -v
  => Opal v1.2.0

bundle exec rake build
bundle exec dxopal server
# Open http://localhost:7521/index.html and see developer console.