summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorGubolin <gubolin@fantasymail.de>2015-01-02 10:30:00 +0100
committerGubolin <gubolin@fantasymail.de>2015-01-02 10:30:00 +0100
commitaba651ba26bc9e79016b34070da5eacd407dac99 (patch)
tree8c92107550bbce2c715e32e90f4cd9a14fde7015 /blocks.js
parent98755a4467991b6fb31563b17f8c15b1c5266294 (diff)
parentb31df39d7f126eaa303c8dae1cf6a14c739a2cc5 (diff)
downloadsnap-anykey_issue387.tar.gz
snap-anykey_issue387.zip
resolve merge conflictanykey_issue387
Diffstat (limited to 'blocks.js')
-rw-r--r--blocks.js43
1 files changed, 35 insertions, 8 deletions
diff --git a/blocks.js b/blocks.js
index 959948e..e6bceeb 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-21';
var SyntaxElementMorph;
@@ -394,10 +394,10 @@ 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.
+ // Used by the evaluator when binding implicit formal parameters
+ // to empty input slots
var empty = [];
if (!(this instanceof RingMorph) &&
(this.selector !== 'reportJSFunction')) {
@@ -412,6 +412,26 @@ SyntaxElementMorph.prototype.allEmptySlots = function () {
return empty;
};
+SyntaxElementMorph.prototype.tagExitBlocks = function (stopTag, isCommand) {
+ // tag 'report' and 'stop this block' blocks of all children including
+ // myself, with either a stopTag (for "stop" blocks) or an indicator of
+ // being inside a command block definition, but omit those in nested
+ // rings (lambdas. Used by the evaluator when entering a procedure
+ if (this.selector === 'doReport') {
+ this.partOfCustomCommand = isCommand;
+ } else if (this.selector === 'doStopThis') {
+ this.exitTag = stopTag;
+ } else {
+ if (!(this instanceof RingMorph)) {
+ this.children.forEach(function (morph) {
+ if (morph.tagExitBlocks) {
+ morph.tagExitBlocks(stopTag, isCommand);
+ }
+ });
+ }
+ }
+};
+
SyntaxElementMorph.prototype.replaceInput = function (oldArg, newArg) {
var scripts = this.parentThatIsA(ScriptsMorph),
replacement = newArg,
@@ -3171,9 +3191,14 @@ 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" indicators:
+
+ partOfCustomCommand - temporary bool set by the evaluator
+ exitTag - temporary string or number set by the evaluator
*/
// CommandBlockMorph inherits from BlockMorph:
@@ -3191,6 +3216,8 @@ function CommandBlockMorph() {
CommandBlockMorph.prototype.init = function () {
CommandBlockMorph.uber.init.call(this);
this.setExtent(new Point(200, 100));
+ this.partOfCustomCommand = false;
+ this.exitTag = null;
};
// CommandBlockMorph enumerating: