-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use Object.keys instead of for ... in, because with Opal. #1797
base: develop
Are you sure you want to change the base?
use Object.keys instead of for ... in, because with Opal. #1797
Conversation
If added some methods to Array.prototype, failed Blocks.getAllVariableAndListReferences. Because it use for ... in.
I'm developing Smalruby 3 ( https://smalruby.jp/smalruby3-gui ) based scratch-gui. I hope it will be bridge of Ruby and Scratch. It's use Opal, so I made this PR. Please merge this. |
Hi @takaokouji. thanks for the interest, that looks like a cool project. Could you explain a bit more about the need to move away from for/in? It is quite a common JS idiom used in many places in our codebase, and we would need to introduce a lint rule or something to prevent it from coming back. Also sorry about the delay in reviewing, we are gearing up for the 3.0 launch and so are trying to stabilize things. |
OK. I think to move away only for Array object. Almost your projects's So, please use |
Proposed Changes
use Object.keys instead of for ... in in Blocks.getAllVariableAndListReferences.
Reason for Changes
If added some methods to Array.prototype by some libraries like Opal, it's failed.
Test Coverage
I checked scratch-gui with this changes. Drag and drop blocks from a sprite to another sprite, and it's done.