summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2014-11-17 10:22:39 +0100
committerjmoenig <jens@moenig.org>2014-11-17 10:22:39 +0100
commitea05f7859fe5a042f0c0dd49b189c594b9a798d3 (patch)
treede4e5748aafed23ae41565ab580c43367f443883 /blocks.js
parentb36a358173fcf4f2a4a77a9c202d6dc0d6c1a7b8 (diff)
downloadsnap-ea05f7859fe5a042f0c0dd49b189c594b9a798d3.tar.gz
snap-ea05f7859fe5a042f0c0dd49b189c594b9a798d3.zip
Treat REPORT blocks inside custom command definitions as STOP THIS BLOCK / IGNORE INPUTS
this also enables all existing FINCH blocks and other hardware extensions again, which used the REPORT (HTTP://) pattern
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: