Commit Graph
376 Commits
Author SHA1 Message Date
Karishma Chadha 34b0aff637 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
Paul Kaplan a9e95f3b01 Merge pull request #829 from kchadha/broadcast-message-typed-variable
Broadcast message functionality
2017-12-01 11:51:38 -05:00
Karishma Chadha e5378d323d Adding unit tests for new lookupOrCreate funciton, fixing a bug that came up during testing (using lookupVariableById on a null target). Skipping integration tests that do not work right now because SB2 import of broadcast message blocks has not been implemented yet. 2017-11-29 10:43:07 -05:00
Karishma Chadha b674a0c047 Code cleanup and refactoring, and getting scratch3_event broadcast functionality to look up the variable name instead of getting it ad-hoc. 2017-11-28 22:33:27 -05:00
Karishma Chadha 0a15190b85 Broadcast message functionality (works with creating new messages, and switching back and forth between them as well). This commit includes a temporary workaround for the issue where the default broadcast message, 'message1' wasn't triggering a var_create event (filed in LLK/scratch-blocks#1258). 2017-11-21 16:48:48 -05:00
DD Liu 58dd57fe48 Merge pull request #784 from fsih/perSpriteMonitors
Execute monitors on a given target ID when block is sprite-specific
2017-11-21 10:23:53 -05:00
DD ec9d8094bd fix review comments 2017-11-20 17:23:59 -05:00
DD 6d26023104 revert unnecessary changes'
:
2017-11-20 13:00:37 -05:00
griffpatch 6ed2ca6caa Cache Block Inputs & Procedure Definitions
* Cache Block Inputs & Procedure Definitions

* @mzgoddard requested changes on this pull request

* Move all caching into a single reusable field _cache.
* Invalidate 'all' caches on any change.
* Use 'typeof' instead of hasOwnProperty.
* Take caching out of Block and use lookup instead.
2017-11-20 10:22:51 -05:00
DD Liu 2d9722e69c Merge pull request #787 from fsih/deleteMonitorBlocks
Delete monitor block when variable is deleted
2017-11-16 17:20:26 -05:00
DD 255e160ebb Change it so we dont have to do string manipulation on IDs to get data out of events 2017-11-16 17:19:51 -05:00
Paul Kaplan bbb8904467 Merge pull request #789 from paulkaplan/custom-procedure-update
Update naming and implementation for custom procedure blocks
2017-11-16 17:07:03 -05:00
Paul Kaplan 34dfbb50ba Update naming and implementation for custom procedure blocks 2017-11-16 14:17:08 -05:00
Michael "Z" Goddard 3d92553459 Return restarted threads in list from startHats
Add restarted threads to the list of newThreads returned by startHats.
2017-11-16 11:23:51 -05:00
Michael "Z" Goddard 9864403bc9 A thread in the runtime but with the DONE status is not active
return false from isActiveThread if thread's status is done even when
its contained in the runtime threads list. As it is done, the thread
will not be run until either its replaced by a new copy of the thread
or the thread is removed from the list and another is added at a later
time.
2017-11-16 11:23:51 -05:00
kchadha 9df3b8ad86 Merge pull request #780 from mzgoddard/runtime-profiler
Runtime profiler
2017-11-16 10:02:37 -05:00
DD 0958db2618 Move data to blocks files 2017-11-15 17:53:43 -05:00
Paul Kaplan 1e27d21b15 Merge pull request #782 from kchadha/list-typed-variable
List typed variable
2017-11-15 12:48:56 -05:00
DD c8d5ba1d5e Delete block does nothing if the block doesnt exist 2017-11-15 11:56:49 -05:00
DD aa0064948a Delete monitor block when variable is deleted 2017-11-15 11:37:27 -05:00
Karishma Chadha fe86e38210 Addressing PR review comments. 2017-11-15 09:17:20 -05:00
DD 757dccd565 Move is sprite specific verification into VM in a temporary way. Remove monitors when their sprites are deleted. 2017-11-14 18:25:54 -05:00
Michael "Z" Goddard f73dae828e Add enableProfiling and disableProfiling to Runtime 2017-11-14 14:57:32 -05:00
Michael "Z" Goddard 516d4f6f30 Add Profiler events to Runtime, Sequencer and execute 2017-11-14 14:57:32 -05:00
Michael "Z" Goddard a5b55a5128 Add runtime Profiler
Profile internal virtual machine performance down to which blocks take
how long.
2017-11-14 14:57:31 -05:00
DD 9048a9b9e7 Pipe through whether a monitor is sprite-specific 2017-11-14 12:20:24 -05:00
Karishma Chadha 386045f033 Some code cleanup. 2017-11-13 16:55:57 -05:00
Karishma Chadha 26d4a3a069 Refactoring representation of variable type. 2017-11-13 16:29:38 -05:00
Karishma Chadha 038a65b460 Finishing up lists. 2017-11-13 14:24:30 -05:00
Karishma Chadha b18938963f Fixing linting errors 2017-11-13 14:22:36 -05:00
Karishma Chadha 70959cc7f5 First cut at turning lists into typed variables 2017-11-09 17:19:34 -05:00
Andrew Sliwinski 3fa1599b90 Merge pull request #701 from Scimonster/variable-xml-names
Correctly deserialize HTML entities in block DOM
2017-11-08 08:03:56 -05:00
Ray Schamp b07bbd4745 Merge pull request #765 from mzgoddard/execute-is-promise-deopt
Write src/engine/execute so it can be optimized
2017-11-07 12:19:58 -05:00
Ray Schamp 180e545b4e Merge pull request #766 from mzgoddard/execute-handle-report-block-utility
Extract handleReport and BlockUtility from inside the execute function
2017-11-07 12:19:23 -05:00
Ray Schamp 5290570fc5 Merge pull request #758 from mzgoddard/done-threads-indexof
Constant time check if a thread is in doneThreads
2017-11-07 10:30:15 -05:00
Michael "Z" Goddard bbe7981703 Extract blockUtility from execute to reduce allocations
blockUtility as an object literal inside execute creates 11 objects,
one for the object, and 10 for the function closures. As a separate
object and allocated once, setting its sequencer and thread members,
block functions can share the same util object. Extract blockUtility to
cut down on allocations.
2017-11-07 10:21:51 -05:00
Michael "Z" Goddard 78847de660 Extract handleReport and add arguments to prevent closure alloc
`handleReport` inside `src/engine/execute.js`'s `execute` method needs
to allocate a closure to be able to refer to the higher scoped
variables. `execute` is called frequently that this has a noticable
impact on memory allocation and later collection. Extract handleReport
and add arguments to prevent the allocation.
2017-11-07 10:21:51 -05:00
Andrew Sliwinski 1efc312c36 Merge pull request #767 from mzgoddard/docs-blocks-param-names
Replace duplicate documentation on getProcedureParamNames
2017-11-06 19:34:51 -05:00
Michael "Z" Goddard 888da915a5 Replace duplicate documentation on getProcedureParamNames
Replace the duplicate getProcedureDefintion documentation block above
getProcedureParamNames.
2017-11-06 17:28:34 -05:00
Michael "Z" Goddard cd9004ce5b Write src/engine/execute so it can be optimized
Testing with implicitly casted `value` and `value.then` is deoptimizing
isPromise, which deoptimizes execute. In this case deoptimizing means
that the JavaScript VM cannot compile the functions into a form that
can be run faster.
2017-11-06 15:54:22 -05:00
Eric Rosenbaum 0540640684 Merge pull request #754 from ericrosenbaum/feature/pen-block-icon
Extension block icons (including pen icon)
2017-11-06 10:02:23 -05:00
Michael "Z" Goddard 6d82c0f115 In place filter threads at end of stepThreads
Skip a large array allocation by filtering done threads in place with a
for loop.
2017-11-03 17:48:52 -04:00
Michael "Z" Goddard 4e24a3f380 Constant time check if thread is in doneThreads
Remove indexOf tests for thread existence in doneThreads. Maintain a
list of null and thread objects mirroring the index position of threads
that are done in runtime.threads. Filter out null values after
filtering out done threads from runtime.threads.

This has a small side effect that threads that normally became DONE and
were added to doneThreads before being removed or restarted will not be
in doneThreads in this version. Restarted threads (_restartThread) do
not appear in this version but new copies will be in Runtime
this.threads supporting glow and monitor updates. Removed threads
(_removeThread) do not appear in this version if they are removed after
they were seen as DONE by the prior version. Threads removed before
they are seen as DONE do not appear in doneThreads in the prior or this
version.

Threads that are removed before normally becoming DONE do not appear in
doneThreads in either case. Threads that are restarted before the loop
checks if the thread is done do not appear in doneThreads in either
case.
2017-11-03 17:46:50 -04:00
Paul Kaplan c1ba902ebb Use category info that has colors when building menu blocks 2017-11-03 13:50:50 -04:00
Eric Rosenbaum 2ac464c53e Prepend icon to each extension block 2017-11-03 11:35:42 -04:00
Paul Kaplan 18398d010b Add hideFromPalette flag for hiding legacy blocks 2017-11-01 11:30:15 -04:00
Paul Kaplan d126f799d8 Prevent imported local variables from being duplicated on the stage. 2017-10-25 11:17:29 -04:00
Chris Willis-Ford c4e79c9732 Merge pull request #713 from cwillisf/fix-extension-hats
Fix extension hats
2017-10-13 16:03:51 -07:00
Chris Willis-Ford a8ae7bc5b4 Merge pull request #700 from cwillisf/extension-menus
Extensions: implement drop-down menus
2017-10-13 09:49:42 -07:00
Chris Willis-Ford 7051ccfd69 Merge pull request #687 from cwillisf/builtin-extensions
Builtin extensions
2017-10-13 09:48:56 -07:00