Commit Graph
133 Commits
Author SHA1 Message Date
Thomas Weber 5aff90af0d js: Improve yieldNotWarpOrStuck 2020-08-13 00:04:51 -05:00
Thomas Weber a68665b542 ast: Don't create the variable in the original if it already exists
It may have been created in the original between when this sprite was cloned and when this script is compiled.
2020-08-12 16:59:38 -05:00
Thomas Weber 01e79ea337 ast: Improve clone variable creation
Only need to look through the sprite's clones, not every sprite.
2020-08-12 16:58:37 -05:00
Thomas Weber a9f9ac7dc7 ast: Fix variables created by clones not being added to the original
This fixes https://scratch.mit.edu/projects/416410318/editor/

A clone could previously create a variable only in that clone, and that would break things because the cached result would be reused on other clones where it might not exist.
2020-08-12 01:46:11 -05:00
Thomas Weber 05aef80288 ast: Remove unnecessary double variableCache setting 2020-08-12 01:45:09 -05:00
Thomas Weber d0e2987cb7 ast: Simplify compiler detector logic, fix default value for boolean arguments 2020-08-10 17:20:54 -05:00
Thomas Weber 4c6225a5ca js: Simplify yieldNotWarpOrStuck 2020-08-09 15:00:38 -05:00
Thomas Weber 1170d4add6 execute: Address some compatibility layer todos
- handle warp mode
- handle promise return value after yield
2020-08-09 14:15:16 -05:00
Thomas Weber 9f6cd4244d js: Wait should check for stuck 2020-08-09 14:14:45 -05:00
Thomas Weber 05305af250 execute: timer should use runtime.currentMSecs 2020-08-09 14:14:27 -05:00
Thomas Weber 2fc50f3dbc js/execute: Improve stuck detection
- move logic to execute
- only check for stuck if in warp
2020-08-09 14:12:55 -05:00
Thomas Weber 0447835bc7 execute: Fix some compatibility layer timing bugs (#8) 2020-08-08 22:43:27 -05:00
Thomas Weber e5b252502f js: control.wait should request a redraw (#8) 2020-08-08 22:14:13 -05:00
Thomas Weber b9f24c349d js: Don't include opcode comment in compat layer
Already included when getting the opcode function.
2020-08-08 22:04:15 -05:00
Thomas Weber 52e06d27f7 ast: Improve the compiler detector argument
- case insensitive
- also support "is turbowarp?"
2020-08-05 22:36:07 -05:00
Thomas Weber a9b205f50c js: "wait until" should yield if the thread is stuck
Testing to see if this should be applied to the other loops.
2020-08-05 22:24:50 -05:00
Thomas Weber 1d2ba750ec ast: fix compiler detector 2020-08-04 16:44:21 -05:00
Thomas Weber 97f908c277 Merge branch 'ast' into develop 2020-08-03 23:51:05 -05:00
Thomas Weber 626513d345 ast/execute cleanup 2020-08-03 23:47:54 -05:00
Thomas Weber 04e2755405 js: Fix control.wait 2020-08-03 23:47:26 -05:00
Thomas Weber bd3123192d Support music blocks in the compiler 2020-08-03 22:54:47 -05:00
Thomas Weber a31527ad96 add "is compiled?" boolean arg 2020-08-03 22:54:47 -05:00
Thomas Weber 3c0eaed66f Fix procedure dependencies breaking with caching 2020-08-03 22:54:47 -05:00
Thomas Weber c466ee790d js: add noop 2020-08-03 22:54:47 -05:00
Thomas Weber ca87f40e02 Cache compile results 2020-08-03 22:54:35 -05:00
Thomas Weber 9a585a25be ast: Cache procedure trees 2020-08-03 22:54:35 -05:00
Thomas Weber 5771e70d6b js: Move warp tracking to call time 2020-08-03 22:54:22 -05:00
Thomas Weber 3331a8bdf2 js: Fix op.contains 2020-08-03 22:54:13 -05:00
Thomas Weber af265c63ca Include sprite name in debug logs 2020-08-03 22:54:05 -05:00
Thomas Weber 84fcff85d9 ast: Fix default procedure inputs 2020-08-03 22:53:55 -05:00
Thomas Weber 0b04f50eea Support compiler flags, "nocompile" 2020-08-03 22:53:36 -05:00
Thomas Weber 32df47f2e2 Compiler cleanup 2020-08-03 22:53:36 -05:00
Thomas Weber 9b95cd6992 js: Fix list.add 2020-08-03 22:53:36 -05:00
Thomas Weber 235e2a00cd Fix some smaller bugs 2020-08-03 22:53:36 -05:00
Thomas Weber 921022f33f Nuke the old compiler. 2020-08-03 22:53:36 -05:00
Thomas Weber d0278aa08e ast: Support the remaining ast nodes in jsgen 2020-08-03 22:53:36 -05:00
Thomas Weber ffbe899eaf ast: Improve procedure call codegen
- emit nothing for empty procedures
- only emit arguments if needed
2020-08-03 22:53:36 -05:00
Thomas Weber 5df9db0427 ast: Improve some variable handling 2020-08-03 22:53:36 -05:00
Thomas Weber c26a72fbfb ast: Further fix codegen 2020-08-03 22:53:36 -05:00
Thomas Weber 77e2682580 ast: Fix many codegen bugs 2020-08-03 22:53:36 -05:00
Thomas Weber 658f915e80 ast: Get some pen projects to run correctly 2020-08-03 22:53:36 -05:00
Thomas Weber fed01dda6d ast: Get more things to run 2020-08-03 22:53:36 -05:00
Thomas Weber 51057b03a0 ast: More work on new compiler 2020-08-03 22:53:36 -05:00
Thomas Weber 703e7bab9c ast: Cleanup 2020-08-03 22:53:36 -05:00
Thomas Weber 67ab60cf9e ast: Basic AST generation feature parity with old compiler 2020-08-03 22:53:20 -05:00
Thomas Weber ca2bee3c82 ast: Add a lot more things to the AST generator 2020-08-03 22:41:31 -05:00
Thomas Weber 9a53a18479 ast: Add a lot more opcodes to the AST generator 2020-08-03 22:41:23 -05:00
Thomas Weber c068c90db3 eslint fixes 2020-08-03 22:41:18 -05:00
Thomas Weber e8549beb88 ast: Sorting, cleanup 2020-08-03 22:41:13 -05:00
Thomas Weber 72cf86545c ast: Get more of the new codegen to work 2020-08-03 22:41:09 -05:00