Commit Graph
7067 Commits
Author SHA1 Message Date
Thomas Weber 779f0a196d Add no-op rAF loop to improve frame pacing
It is still not perfect. Better though
Fixes https://github.com/TurboWarp/scratch-vm/issues/257
Closes https://github.com/TurboWarp/scratch-vm/pull/324
(this one uses a different approach and restricts to 30 FPS and checks
if the platform is known to benefit before we turn on battery draining
workarounds)
2025-12-29 18:57:47 -06:00
8to16 36bf998aee Fix evalAndReturn with comments at the bottom of a script (#322)
This is because beepbox's script:
https://cdn.jsdelivr.net/npm/beepbox@4.2.0/global/beepbox_synth.min.js
has a sourceMappingURL comment at the bottom for whatever
reason, causing it to become
//# sourceMappingURL=beepbox_synth.min.js.map;return beepbox;
This is obviously going to break and might also be the case with
other libraries too, hot just beepbox.

Ported from AmpMod:
https://codeberg.org/ampmod/ampmod/commit/0daf1021bdc8e67a1f0d08b91ce500605fcaa711
2025-12-15 18:51:13 -06:00
Thomas Weber fd13a98e2d Merge pull request #305 from TurboWarp/compile-say
Compile looks_say and looks_think without compatibility layer
2025-12-04 21:42:32 -06:00
Thomas Weber 9624ea5456 Compile looks_say and looks_think without compatibility layer 2025-12-04 21:38:16 -06:00
Thomas Weber 08e850a825 Merge pull request #280 from TurboWarp/fix-negative-zero
Fix all remaining negative zero bugs
2025-12-04 21:35:58 -06:00
Thomas Weber 06dbe65a98 Use Number.isNaN instead 2025-12-04 21:32:19 -06:00
Thomas Weber 6f6845ba3c Fix all remaining negative zero bugs 2025-12-04 21:32:19 -06:00
Thomas Weber 8252e2e60d Merge pull request #285 from TurboWarp/use-Number.isNaN
Replace isNaN with Number.isNaN in jsexecute
2025-12-04 21:30:03 -06:00
Thomas Weber fd1b85589e Merge pull request #301 from TurboWarp/more-unnecessary-casts
Remove more unnecessary casts
2025-12-04 21:29:22 -06:00
Thomas Weber d8c26ad156 Merge pull request #307 from TurboWarp/optimize-repeat-better
Improve repeat block analysis
2025-12-04 21:28:50 -06:00
Thomas Weber 4187f550a0 Record which keys the project has used
Related to https://github.com/TurboWarp/scratch-gui/issues/1106
2025-11-15 19:00:15 -06:00
Thomas Weber 92adc762d9 Merge pull request #313 from TurboWarp/update-languages
Update scratch-translate-extension-languages to 1.0.7
2025-11-01 20:36:39 -05:00
Thomas Weber 475ffd0cb4 Update scratch-translate-extension-languages to 1.0.7 2025-11-01 19:18:12 -05:00
Thomas Weber 55674f82ee Implement Scratch.external - VM part (#308) 2025-10-18 23:43:22 -05:00
Thomas Weber 8860e2d602 Fix repeat block iteration count not being optimizable in yielding loops 2025-10-12 11:16:25 -05:00
Thomas Weber eb0d678068 Only analyze repeat block inputs at the start of the loop 2025-10-12 11:12:05 -05:00
Thomas Weber efb502a8ac Remove unnecessary boolean casts 2025-10-08 18:44:51 -05:00
Thomas Weber 3b947da95e Remove unnecessary number index casts 2025-10-08 18:43:50 -05:00
Thomas Weber 67cb7cfc5d Remove unnecessary string casts 2025-10-08 18:42:43 -05:00
Thomas Weber 36d4d8224b Merge pull request #300 from TurboWarp/fix-string-length-type
Use more specific type for string length
2025-10-08 18:33:55 -05:00
Thomas Weber 07309b6ebf Use more specific type for string length 2025-10-08 17:15:44 -05:00
Thomas Weber d09f82a2fe Add new test case that does some simple string operations 2025-10-08 17:15:24 -05:00
Thomas Weber 2ee8d6cf6b Merge pull request #299 from TurboWarp/face-sensing
Add face sensing to default extension URLs
2025-10-07 18:12:47 -05:00
Thomas Weber 4ab24673c9 Add face sensing to default extension URLs 2025-10-07 18:06:10 -05:00
Thomas Weber d848fd0e6e Convert default extension URLs from dict to object 2025-10-07 18:05:47 -05:00
Thomas Weber 51aacba14c Merge pull request #295 from TurboWarp/optimize-loops
Optimize loops with provably-non-fraction iteration counts
2025-10-05 08:54:44 -05:00
Thomas Weber 5c5ff712b0 Merge pull request #296 from TurboWarp/round-floor-ceil-type
Use more specific type for round, floor, ceiling
2025-10-05 08:48:20 -05:00
Thomas Weber 2a2d15282b Infinite iteration count can also use simpler condition 2025-10-04 20:37:54 -05:00
Thomas Weber a2701efdf5 Use more specific type for round, floor, ceiling 2025-10-04 20:36:46 -05:00
Thomas Weber 2ac7095947 Optimize loops with provably-integer iteration counts 2025-10-04 20:05:31 -05:00
Thomas Weber bf7ae82d75 Merge pull request #290 from Tacodiva/compiler-int-type-fix
Make types for blocks which return ints more specific
2025-09-27 22:09:49 -05:00
Thomas Weber 7051b87b21 Merge pull request #289 from Tacodiva/compiler-sensing-sizeof-fix
Fix incorrect type in sensing () of () block
2025-09-27 22:09:18 -05:00
Tacodiva 8fe321c357 Make types for blocks which returns ints more spercific 2025-09-28 12:30:32 +10:00
Tacodiva bc9a3d03b1 Fix sensing x/y of types 2025-09-28 12:29:50 +10:00
Tacodiva bbfa559972 Fix sensing size of type 2025-09-28 12:22:03 +10:00
Thomas Weber aafaa74d9a Replace isNaN with Number.isNaN in jsexecute 2025-09-24 17:18:34 -05:00
Thomas Weber 37c6fbe63b Merge pull request #284 from TurboWarp/fix-281
Discard old state after calling yielding procedure
2025-09-24 16:52:50 -05:00
Thomas Weber 2244b26773 Discard old state after calling yielding procedure 2025-09-24 16:48:01 -05:00
Thomas Weber d7a5f1c011 Merge pull request #279
More misc compiler fixes
2025-09-22 19:48:55 -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 4a8a5ad901 Add test case for 7ed29f5801 2025-09-22 19:30:23 -05:00
Thomas Weber 214b86a063 Add test case for d8c73c71d2 2025-09-22 19:29:06 -05:00
Thomas Weber 445a129939 Add test case for 7cc8f580b3 2025-09-22 19:28:17 -05:00
Thomas Weber c372e925a5 Add test case for 6a37fee386 2025-09-22 19:27:08 -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 40715dc259 Add test case for https://github.com/TurboWarp/scratch-vm/issues/276 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