From 82ef33cf004d0470ac834fca195e757a501cbb2b Mon Sep 17 00:00:00 2001 From: jmoenig Date: Fri, 7 Jan 2022 14:03:41 +0100 Subject: [PATCH] added syntax tree representation for variable getters --- HISTORY.md | 3 +++ snap.html | 2 +- src/blocks.js | 8 ++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index e16a9bdd..1a6a8904 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -11,6 +11,9 @@ * **Translation Updates:** * Catalan library translations, thanks, Joan! +### 2022-01-07 +* blocks: added syntax tree representation for variable getters + ### 2022-01-06 * Catalan library translations, thanks, Joan! diff --git a/snap.html b/snap.html index d0ba0029..70766adc 100755 --- a/snap.html +++ b/snap.html @@ -16,7 +16,7 @@ - + diff --git a/src/blocks.js b/src/blocks.js index 6689abc5..b813e646 100644 --- a/src/blocks.js +++ b/src/blocks.js @@ -160,7 +160,7 @@ CustomCommandBlockMorph, ToggleButtonMorph, DialMorph, SnapExtensions*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2022-January-05'; +modules.blocks = '2022-January-07'; var SyntaxElementMorph; var BlockMorph; @@ -3750,7 +3750,7 @@ BlockMorph.prototype.components = function (parameterNames = []) { return seq.length() === 1 ? seq.at(1) : seq; }; -BlockMorph.prototype.syntaxTree = function (parameterNames) { +BlockMorph.prototype.syntaxTree = function (parameterNames) { // +++ var expr = this.fullCopy(), nb = expr.nextBlock ? expr.nextBlock() : null, inputs, parts; @@ -3808,6 +3808,10 @@ BlockMorph.prototype.syntaxTree = function (parameterNames) { } }); parts.at(1).updateEmptySlots(); + if (expr.selector === 'reportGetVar') { + parts.add(expr.blockSpec); + expr.setSpec('var'); + } parameterNames.forEach(name => parts.add(name)); return parts; };