added syntax tree representation for variable getters

snap7
jmoenig 2022-01-07 14:03:41 +01:00
rodzic 74affa6824
commit 82ef33cf00
3 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -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!

Wyświetl plik

@ -16,7 +16,7 @@
<script src="src/morphic.js?version=2021-12-10"></script>
<script src="src/symbols.js?version=2021-03-03"></script>
<script src="src/widgets.js?version=2021-17-09"></script>
<script src="src/blocks.js?version=2022-01-05"></script>
<script src="src/blocks.js?version=2022-01-07"></script>
<script src="src/threads.js?version=2022-01-04"></script>
<script src="src/objects.js?version=2022-01-03"></script>
<script src="src/scenes.js?version=2021-11-24"></script>

Wyświetl plik

@ -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;
};