scratch-vm/test/unit
Michael "Z" Goddard 6b7582f1c7
Report block result to stackFrame.justReported
- Add stackFrame.justReported

Report the block result to a known key `justReported` instead of a
dynamic key on `reported`. Assuming blocks with a promised value are
relatively infrequent the most common recursive input flow immediately
reads the value "just" reported. In the assumed uncommon case of a
promised thread status, empty the already argValues assigned values
onto the currentStackFrame's reported member. In the next execute call
on this stackFrame, values assigned to reported are read back off onto
argValues, and execute will returned to the assumed common case. This
is a safe assumption since a thread in the promise state will not exit
that state until the next frame when javascript has a chance to call
the resolve handle, setting the thread's state back to another
executable state.

Using direct assignment to `justReported` saves building an object
dynamically. Instead of always building `reported` and `argValues` only
`argValues` is built until a promised state is reached. This also gives
a known time when `reported` is used, allowing cleanup of a
stackFrame's reported to only happen when it was used to persist
already reported values.
2018-01-24 17:00:12 -05:00
..
blocks_control.js Fix remaining lint issues 2017-08-26 13:24:10 -04:00
blocks_event.js Bugfix for scratch-gui issue #994, where executing a broadcast block from the flyout was creating a conflicting variable, causing a fatal error. 2017-12-04 18:01:29 -05:00
blocks_looks.js Add unit tests for new reporter blocks in looks 2018-01-04 10:42:51 -05:00
blocks_operators.js Pass with --fix 2017-08-26 13:24:10 -04:00
blocks_procedures.js Revert "Fix test" 2017-12-13 15:37:44 -05:00
blocks_sensing.js Add setDragMode primitive and unit test 2017-12-29 09:38:21 -05:00
blocks_sounds.js Move music-related unit tests into a separate file 2017-11-07 16:26:20 -05:00
dispatch.js Refactor common code in {central,worker}-dispatch 2017-08-09 17:30:00 -04:00
engine_adapter.js Correctly deserialize HTML entities in block DOM 2017-10-09 01:19:55 +03:00
engine_blocks.js Delete monitor block when variable is deleted 2017-11-15 11:37:27 -05:00
engine_runtime.js fix file name in test 2017-05-30 10:24:09 -04:00
engine_sequencer.js Update naming and implementation for custom procedure blocks 2017-11-16 14:17:08 -05:00
engine_target.js Bugfix for scratch-gui issue #994, where executing a broadcast block from the flyout was creating a conflicting variable, causing a fatal error. 2017-12-04 18:01:29 -05:00
engine_thread.js Report block result to stackFrame.justReported 2018-01-24 17:00:12 -05:00
extension_music.js Note player (#806) 2017-11-21 10:36:28 -05:00
io_clock.js Use ES6 linting rules in the project root 2017-04-24 15:37:58 -04:00
io_deviceManager.js Address feedback from review 2017-11-27 15:00:53 -05:00
io_keyboard.js Use ES6 linting rules in the project root 2017-04-24 15:37:58 -04:00
io_mouse.js Update the mouse io to give scratch coordinates and client coordinates 2018-01-09 10:37:16 -05:00
serialization_sb2.js Fix tests & a typo 2017-11-03 11:42:20 -07:00
serialization_sb3.js Fix tests & a typo 2017-11-03 11:42:20 -07:00
spec.js Add to the vm spec 2017-05-22 08:17:28 -04:00
sprites_rendered-target.js Update specmap and sb2 import to add new fields to layering blocks. 2017-12-28 14:53:35 -05:00
util_cast.js Use ES6 linting rules in the project root 2017-04-24 15:37:58 -04:00
util_color.js Use ES6 linting rules in the project root 2017-04-24 15:37:58 -04:00
util_math.js Use ES6 linting rules in the project root 2017-04-24 15:37:58 -04:00
util_string.js Specify dataFormat when loading asset for import 2017-05-24 15:35:10 -07:00
util_timer.js Pass with --fix 2017-08-26 13:24:10 -04:00
util_xml.js Use ES6 linting rules in the project root 2017-04-24 15:37:58 -04:00
virtual-machine.js Fixing unit test. 2017-12-21 19:06:11 -05:00