Commit Graph
3690 Commits
Author SHA1 Message Date
Thomas Weber 2244b26773 Discard old state after calling yielding procedure 2025-09-24 16:48:01 -05:00
Thomas Weber e81319b201 Use Object.create(null) instead of {}
Avoids any weird issues if variables have strange IDs like "toString"
2025-09-22 19:35:06 -05:00
Thomas Weber 5a90e13981 Fix TypeState#after setting variable types to undefined
If a variable existed in `this` but not in `other`, its resulting type
would be set to undefined. Changing it to use the type from `this`
seems to fix https://github.com/TurboWarp/scratch-vm/issues/273.
2025-09-22 18:41:48 -05:00
Thomas Weber 2639653647 Revert "Fix #273"
This reverts commit c16be25178.

Caused https://github.com/TurboWarp/scratch-vm/issues/276
2025-09-22 18:41:38 -05:00
Thomas Weber 5d917cca05 Use log.error instead of console.error 2025-09-22 18:41:08 -05:00
Thomas Weber 44e2589e65 Fix https://github.com/TurboWarp/scratch-vm/issues/277
Need to clear the state before analyzing the condition as the condition
may be re-evaluated after yielding.
2025-09-22 18:40:34 -05:00
Thomas Weber 41af457060 Move analyzeStackBlock analyzeInputs call into the switch statement
Makes later commits easier.
2025-09-22 18:40:19 -05:00
Tacodiva d17ceccd83 Fix #269 2025-09-21 23:13:11 +10:00
Tacodiva 749e923378 Fix #272 (thanks @Geotale) 2025-09-21 23:10:50 +10:00
Tacodiva c16be25178 Fix #273 2025-09-21 22:59:56 +10:00
Tacodiva cc96ee8c70 Fix -0 being turned into 0 in the type matrix test 2025-09-21 22:59:06 +10:00
Thomas Weber cd353ca31e Merge pull request #268 from TurboWarp/fix-analyzeLoopedBlock-infinite-loop
Give up analyzing looped stack after 10000 iterations
2025-09-20 13:57:52 -05:00
Thomas Weber fa035541da Give up analyzing looped stack after 10000 iterations
Temporary fix for an infinite loop, to be properly fixed later
2025-09-20 13:53:41 -05:00
Thomas Weber 5b027b995e Fix motion_turnleft and motion_turnright missing type casts 2025-09-15 18:01:45 -05:00
Thomas Weber e1ad53e7f5 Add compatibility layer for extensions relying on old compiler (#264)
The new compiler broke all the extensions doing compiler patches. We promised not to help them when those break but it seems enough people use those extensions that we sort of got forced into finding some solution, so this makes these changes:

 - The exports for the new compiler are now in `these_broke_before_and_will_break_again`
 - `i_will_not_ask_for_help_when_these_break` now returns some stubs that pretend to be the old compiler. It also emits an event so -gui can show a warning.
 - Focus is on compatibility & safety, not performance. There will be unnecessary casts and scripts marked as yielding.
 - Extensions that meet these assumptions should work without changes:
   - Extensions do not try to combine this compatibility layer with any APIs provided by the new compiler.
   - Extensions treat IR nodes received from descendSubstack and similar as opaque objects because they will be the new intermediate objects instead of { kind: "..." }
   - Extensions need to implement the JS generators for all AST node kinds they use. Can not rely on the default JS generator because those generators are expecting a different format than { kind: "..." }

Lack of tests is intentional since this will be removed at some point when we have a proper API we can tell people to use
2025-09-14 11:14:18 -05:00
Tacodiva 7ed29f5801 Fix sound dropdown playing wrong sound when sounds have a number name 2025-09-08 17:11:50 +10:00
Tacodiva 7cc8f580b3 Fix yielding loop arguments not re-analyzing 2025-09-08 17:08:23 +10:00
Tacodiva d8c73c71d2 Account for stop this script in type analysis and add test 2025-09-08 15:28:11 +10:00
Tacodiva 6a37fee386 Re-analyze loop block inputs after each loop 2025-09-08 15:11:03 +10:00
Tacodiva fbca1bf49b Fixed NaN = 0 wrongly reporting true, and add a test 2025-09-08 11:48:55 +10:00
Tacodiva b8defadedb Merge remote-tracking branch 'origin/develop' into HEAD 2025-09-07 11:56:25 +10:00
Thomas Weber 6222be2a3c Fix wrong drawables being marked non-interactive 2025-06-07 18:33:32 -05:00
Thomas Weber df92bc2899 Mark video sensing drawable as non-interactive 2025-06-07 18:17:42 -05:00
Thomas Weber ef02dc86d8 Mark pen drawable as non-interactive
Using API added in https://github.com/TurboWarp/scratch-render/commit/1ffefcf2cdff2fcbe0bc7f0f000521ae2843f3a8
This replaces the hardcoded PenSkin exclusion in the renderer
2025-06-07 18:13:45 -05:00
ghost 5bc497aabb Add blockShape option to extensions (#210) 2025-05-20 21:48:52 -05:00
Thomas Weber f957e1c6c1 Fix Mouse.postData error if called before project loads 2025-05-20 13:29:44 -05:00
Thomas Weber ba9ae068ca Don't compress formats that are already compressed (#258)
Closes https://github.com/TurboWarp/scratch-vm/issues/253
2025-05-13 21:45:21 -05:00
Thomas Weber b8520ccd9a Fix visual report error when thread target does not match editing target
Fixes #252
2025-03-27 13:34:21 -05:00
Thomas Weber 7ef5e29c16 interpreter: fix skipped blocks in recursive procedures using "stop this script"
Closes https://github.com/TurboWarp/scratch-vm/issues/249
Regression from 20f25f252c
2025-03-07 01:21:08 -06:00
Muffin cd63c87f07 js: reset variable types after compatibility layer call
Fixes https://github.com/TurboWarp/scratch-vm/issues/245
2025-02-11 00:49:36 -06:00
Thomas Weber af3b7513a4 ir: Match vanilla quirks when handling variable or list fields with null ID 2025-01-18 00:29:09 -06:00
Thomas Weber 2c9d301da2 ir: Fix variable cache collision when variable or list field has null ID
Fixes https://github.com/TurboWarp/scratch-vm/issues/239
2025-01-18 00:09:09 -06:00
Miyo Sho 36c02f3fec Expose Variable on the VM exports (#237) 2024-12-27 16:45:09 -06:00
熊谷 凌 56825e3744 Allow refreshBlocks() to specify extension (#228) 2024-12-25 22:56:30 -06:00
Thomas Weber c3b60f6fb6 Add Scratch.download API 2024-12-22 17:46:17 -06:00
Thomas Weber fdd954c012 Add URL argument to Scratch.canDownload
This lets us filter out javascript: URLs
2024-12-22 17:46:09 -06:00
Thomas Weber 1a578aa44e Add canDownload API
https://github.com/TurboWarp/scratch-gui/issues/969
2024-12-22 11:51:26 -06:00
Muffin 9e6993de27 Add restricted fonts and case insensitivity to font manager (#231) 2024-11-02 21:39:44 -05:00
凌 fed099c4cc Fix isRecursiveCall failing on flyout blocks (#227) 2024-09-30 22:47:02 -05:00
Tacodiva df65b01cde Merge branch 'origin/develop' into next-next 2024-09-26 11:50:09 +10:00
Muffin 179030ad49 Don't eagerly cast boolean arguments to boolean (#223)
Fixes https://github.com/TurboWarp/scratch-vm/issues/222
2024-09-08 11:56:47 -05:00
Muffin 99ff662f7f Don't emit STAGE_SIZE_CHANGED if stage size didn't change
and also fix the other STAGE_SIZE_CHANGED event test to
actually test that it is being fired when there is a change
2024-07-31 15:16:44 -05:00
Tacodiva 430353b1e3 Re-add JSGenerator.unstable_exports and expose enums as unsupported APIs 2024-07-28 20:36:24 +10:00
Tacodiva 59cc74c10b Fix imports :c 2024-07-28 20:31:07 +10:00
Tacodiva 34491603f8 Linty linty code 2024-07-28 20:22:30 +10:00
Tacodiva a589e57d9e Fix old and add new unsupported APIs. 2024-07-28 20:14:05 +10:00
Muffin 4c366e0110 Use a fixed modification date when zipping 2024-07-17 14:27:33 -05:00
Tacodiva 177b899138 Fix issue when switching to costume with a number name 2024-07-03 12:58:07 +10:00
Tacodiva 1dd7744525 Handle colors correctly + more smartly 2024-07-03 12:45:49 +10:00
Tacodiva 1dc9aadf3f Fix issue when setting variables to InputType.ANY and add test 2024-06-25 18:25:47 +10:00