diff options
| author | Michael Ball <cycomachead@gmail.com> | 2014-11-24 15:13:51 -0800 |
|---|---|---|
| committer | Michael Ball <cycomachead@gmail.com> | 2014-11-24 15:13:51 -0800 |
| commit | 94f94467b5be3d05f108620d1a17f6d4179bf621 (patch) | |
| tree | 0d62b96277a2c919d28632850cb5d8938ec69092 /blocks.js | |
| parent | 9e5fb9a4cba980c977d4e11e5c9a4e7f9c8596db (diff) | |
| parent | 4be96bb240ea8518fa95218cba7111846af93baa (diff) | |
| download | snap-94f94467b5be3d05f108620d1a17f6d4179bf621.tar.gz snap-94f94467b5be3d05f108620d1a17f6d4179bf621.zip | |
Merge branch 'master' of git://github.com/jmoenig/Snap--Build-Your-Own-Blocks into shared-url
* 'master' of git://github.com/jmoenig/Snap--Build-Your-Own-Blocks: (34 commits)
tail-call-elimination for reporters - experiment
allow recursive reporters to be stopped by user
updated history
fixed #131
Fixed #34
Fixed #644
Fixed #372
Fixed #416
Fixed #318
Fix “stop this block” primitive for tail-call-elimination
Fix "stop this block"’s lexical awareness
Add a new Favicon to Snap! (Clearer Lambda)
integrate translation update
push morphic.js version date
fix ‘line’ option in ‘split’ block for Windows files
integrate percent sign fix for JSLint
Updated the “About” Dialog
renamed Process::callback to "onComplete"
Fixed #364 avoid “freezing” when calling LAUNCH on empty ring
Fixed #642, avoid “freezing” when calling CONS on non-list/null
...
Diffstat (limited to 'blocks.js')
| -rw-r--r-- | blocks.js | 43 |
1 files changed, 35 insertions, 8 deletions
@@ -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, @@ -3169,9 +3189,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: @@ -3189,6 +3214,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: |
