From 167a175d181dcfa7b20e453178425d3e0021db8f Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 9 Jul 2013 21:10:16 +0200 Subject: Codification changes, Boolean slot bug fix * Collapsed codification primitives (code, header) into a single block * Added isEmptySlot() to BooleanArgMorph (thanks, Brian, for the bug report!) --- blocks.js | 21 +++++++++++++++++++-- history.txt | 5 +++++ objects.js | 17 +++++------------ threads.js | 14 +++++++++++++- 4 files changed, 42 insertions(+), 15 deletions(-) diff --git a/blocks.js b/blocks.js index 35b073f..2280501 100644 --- a/blocks.js +++ b/blocks.js @@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2013-July-05'; +modules.blocks = '2013-July-09'; var SyntaxElementMorph; var BlockMorph; @@ -1025,6 +1025,18 @@ SyntaxElementMorph.prototype.labelPart = function (spec) { true ); break; + case '%codeKind': + part = new InputSlotMorph( + null, + false, + { + code : ['code'], + header : ['header'] + }, + true + ); + part.setContents(['code']); + break; case '%l': part = new ArgMorph('list'); break; @@ -4900,7 +4912,6 @@ ArgMorph.prototype.isEmptySlot = function () { return this.type !== null; }; - // CommandSlotMorph //////////////////////////////////////////////////// /* @@ -7093,6 +7104,12 @@ BooleanSlotMorph.prototype.drawDiamond = function (context) { context.stroke(); }; +// BooleanSlotMorph implicit formal parameters: + +BooleanSlotMorph.prototype.isEmptySlot = function () { + return true; +}; + // ArrowMorph ////////////////////////////////////////////////////////// /* diff --git a/history.txt b/history.txt index c020c58..3f89833 100755 --- a/history.txt +++ b/history.txt @@ -1790,3 +1790,8 @@ ______ 130708 ------ * Store: fixed serialization placement-bug for sprites + +130709 +------ +* Objects, Blocks, Threads: Collapsed codification primitives (code, header) into a single block +* Blocks: Added isEmptySlot() to BooleanArgMorph (thanks, Brian, for the bug report!) diff --git a/objects.js b/objects.js index 038b61e..785a43d 100644 --- a/objects.js +++ b/objects.js @@ -123,7 +123,7 @@ PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.objects = '2013-July-04'; +modules.objects = '2013-July-09'; var SpriteMorph; var StageMorph; @@ -1019,15 +1019,10 @@ SpriteMorph.prototype.initBlocks = function () { }, // Code mapping - experimental - doMapHeader: { // experimental + doMapCodeOrHeader: { // experimental type: 'command', category: 'other', - spec: 'map %cmdRing to header %code' - }, - doMapCode: { // experimental - type: 'command', - category: 'other', - spec: 'map %cmdRing to code %code' + spec: 'map %cmdRing to %codeKind %code' }, doMapStringCode: { // experimental type: 'command', @@ -1800,8 +1795,7 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push('='); if (StageMorph.prototype.enableCodeMapping) { - blocks.push(block('doMapHeader')); - blocks.push(block('doMapCode')); + blocks.push(block('doMapCodeOrHeader')); blocks.push(block('doMapStringCode')); blocks.push(block('doMapListCode')); blocks.push('-'); @@ -4054,8 +4048,7 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push('='); if (StageMorph.prototype.enableCodeMapping) { - blocks.push(block('doMapHeader')); - blocks.push(block('doMapCode')); + blocks.push(block('doMapCodeOrHeader')); blocks.push(block('doMapStringCode')); blocks.push(block('doMapListCode')); blocks.push('-'); diff --git a/threads.js b/threads.js index ab904ad..5aea6ec 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2013-July-04'; +modules.threads = '2013-July-09'; var ThreadManager; var Process; @@ -2291,6 +2291,18 @@ Process.prototype.reportTimer = function () { blocks - not needed to run or debug Snap */ +Process.prototype.doMapCodeOrHeader = function (aContext, anOption, aString) { + if (this.inputOption(anOption) === 'code') { + return this.doMapCode(aContext, aString); + } + if (this.inputOption(anOption) === 'header') { + return this.doMapHeader(aContext, aString); + } + throw new Error( + ' \'' + anOption + '\'\nis not a valid option' + ); +}; + Process.prototype.doMapHeader = function (aContext, aString) { if (aContext instanceof Context) { if (aContext.expression instanceof SyntaxElementMorph) { -- cgit v1.3.1