-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Extension loop/conditional support for the compiler #141
Conversation
Note that this PR does not add custom C blocks (it just makes extension-created C blocks work in the compiler), and that |
thanks for your patience on this |
Ignore git complaining about the snapshot tests
Do you have a use case in mind for this? The compiler is something I really don't want things touching right now |
The main thing I was doing that for was compiler support for an Inline Blocks extension, but since custom reporters exist now, that probably isn't needed anymore. |
for some reason github will not let me push to this pull request |
Yeah I don't know what's up with that
I'm superseding this with #158 |
does not work yet, but will soon - TurboWarp/scratch-vm#141 - TurboWarp/scratch-vm#158
ytmsOZFM3Z.mp4
Test extension (uploaded as txt because github doesn't like uploading js files): loops-test.js.txt
Resolves
Resolves #98
Proposed Changes
Adds support for
Scratch.BlockType.CONDITIONAL
andScratch.BlockType.LOOP
extension blocks to the compiler. If you don't know: LOOP runs the inner script if it returns true and doesn't run it otherwise, and CONDITIONAL runs a branch (the branch count being specified by the branchCount block property) starting from 1 (0 to run none) based on the number it returns.For LOOP blocks,
util.stackFrame
is maintained between runs of the function (but not between runs of the block), so state can be maintained like the primitiverepeat
block.Also exports some compiler-related objects.Not anymore.Types will have to be updated to un-deprecate Scratch.BlockType.LOOP and CONDITIONAL.
Reason for Changes
Fixing bugs, making extensions more powerful and parity with the interpreter.
Test Coverage
Haven't added tests, don't really know how to do that. (I have updated the snapshot tests though)
Test runs: 6 failing (there's like 70-something failing tests on develop with failing snapshot tests and 7 failing tests when excluding the snapshot tests so I might not have broken stuff?).