summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorMichael Ball <cycomachead@gmail.com>2014-11-21 03:08:41 -0800
committerMichael Ball <cycomachead@gmail.com>2014-11-21 03:08:41 -0800
commit3e8146d043b1f1dc6f37e0a8cbd2e5d3dafb90c7 (patch)
tree0a36d8b40781b5c3adc38c382cd866bbd7499598 /blocks.js
parentdbf2e6665b4ff7ef8cb863bcfef5939117a2f795 (diff)
parentf2d0c2eba5d6b012fc3fb1167c82b64b2f8ed447 (diff)
downloadsnap-byow-3e8146d043b1f1dc6f37e0a8cbd2e5d3dafb90c7.tar.gz
snap-byow-3e8146d043b1f1dc6f37e0a8cbd2e5d3dafb90c7.zip
Merge in recent changes (split block improvements #619)
Diffstat (limited to 'blocks.js')
-rw-r--r--blocks.js33
1 files changed, 25 insertions, 8 deletions
diff --git a/blocks.js b/blocks.js
index 73ef884..82ef601 100644
--- a/blocks.js
+++ b/blocks.js
@@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph, Costume*/
// Global stuff ////////////////////////////////////////////////////////
-modules.blocks = '2014-October-01';
+modules.blocks = '2014-November-17';
var SyntaxElementMorph;
@@ -394,10 +394,8 @@ SyntaxElementMorph.prototype.allInputs = function () {
};
SyntaxElementMorph.prototype.allEmptySlots = function () {
-/*
- answer empty input slots of all children excluding myself,
- but omit those in nested rings (lambdas) and JS-Function primitives
-*/
+ // answer empty input slots of all children excluding myself,
+ // but omit those in nested rings (lambdas) and JS-Function primitives
var empty = [];
if (!(this instanceof RingMorph) &&
(this.selector !== 'reportJSFunction')) {
@@ -412,6 +410,21 @@ SyntaxElementMorph.prototype.allEmptySlots = function () {
return empty;
};
+SyntaxElementMorph.prototype.allReportBlocks = function () {
+ // answer report blocks of all children including myself,
+ // but omit those in nested rings (lambdas)
+ if (this.selector === 'doReport') {return [this]; }
+ var reports = [];
+ if (!(this instanceof RingMorph)) {
+ this.children.forEach(function (morph) {
+ if (morph.allReportBlocks) {
+ reports = reports.concat(morph.allReportBlocks());
+ }
+ });
+ }
+ return reports;
+};
+
SyntaxElementMorph.prototype.replaceInput = function (oldArg, newArg) {
var scripts = this.parentThatIsA(ScriptsMorph),
replacement = newArg,
@@ -3169,9 +3182,13 @@ BlockMorph.prototype.snap = function () {
I inherit from BlockMorph adding the following most important
public accessors:
- nextBlock() - set / get the block attached to my bottom
- bottomBlock() - answer the bottom block of my stack
- blockSequence() - answer an array of blocks starting with myself
+ nextBlock() - set / get the block attached to my bottom
+ bottomBlock() - answer the bottom block of my stack
+ blockSequence() - answer an array of blocks starting with myself
+
+ and the following "lexical awareness" indicator:
+
+ partOfCustomCommand - temporary bool set by the evaluator
*/
// CommandBlockMorph inherits from BlockMorph: