kopia lustrzana https://github.com/backface/turtlestitch
added arity control for assembling polyadic inputs
rodzic
7cc6048def
commit
2705c8ffb1
|
@ -3,6 +3,7 @@
|
|||
## in development:
|
||||
|
||||
* **New Features:**
|
||||
* arity control for assembling polyadic inputs using JOIN (pass a list whose first item is an integer representing the number of slots followed by the contents of those slots)
|
||||
* **Notable Changes:**
|
||||
* same blocks with empty variadic inputs compare as equal regardless of their arity
|
||||
* made "When I receive any messagge" non-thread-safe by default (again) to enable tail recursive broadcasts
|
||||
|
@ -20,6 +21,7 @@
|
|||
|
||||
### 2022-01-04
|
||||
* manifest: fixed #2954
|
||||
* threads, blocks: added arity control for assembling polyadic inputs
|
||||
|
||||
### 2022-01-03
|
||||
* Italian translation update, thanks, Stefano!
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
<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=2021-12-20"></script>
|
||||
<script src="src/threads.js?version=2022-01-02"></script>
|
||||
<script src="src/blocks.js?version=2022-01-04"></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>
|
||||
<script src="src/gui.js?version=2021-12-22"></script>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
written by Jens Mönig
|
||||
jens@moenig.org
|
||||
|
||||
Copyright (C) 2021 by Jens Mönig
|
||||
Copyright (C) 2022 by Jens Mönig
|
||||
|
||||
This file is part of Snap!.
|
||||
|
||||
|
@ -160,7 +160,7 @@ CustomCommandBlockMorph, ToggleButtonMorph, DialMorph, SnapExtensions*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.blocks = '2021-December-20';
|
||||
modules.blocks = '2022-January-04';
|
||||
|
||||
var SyntaxElementMorph;
|
||||
var BlockMorph;
|
||||
|
@ -3849,7 +3849,7 @@ BlockMorph.prototype.copyWithInputs = function (inputs) {
|
|||
// distribute inputs among the slots
|
||||
slots = cpy.inputs();
|
||||
slots.forEach((slot) => {
|
||||
var inp;
|
||||
var inp, i, cnt;
|
||||
if (slot instanceof MultiArgMorph && slot.inputs().length) {
|
||||
slot.inputs().forEach(entry => {
|
||||
inp = dta[count];
|
||||
|
@ -3885,8 +3885,26 @@ BlockMorph.prototype.copyWithInputs = function (inputs) {
|
|||
slot.nestedBlock(inp);
|
||||
}
|
||||
} else {
|
||||
if (inp instanceof List && inp.length() === 0) {
|
||||
nop(); // ignore, i.e. leave slot as is
|
||||
if (inp instanceof List) {
|
||||
if (inp.length() === 0) {
|
||||
nop(); // ignore, i.e. leave slot as is
|
||||
} else if (slot instanceof MultiArgMorph) {
|
||||
slot.collapseAll();
|
||||
for (i = 1; i <= inp.at(1); i += 1) {
|
||||
cnt = inp.at(i + 1);
|
||||
if (cnt instanceof List) {
|
||||
cnt = Process.prototype.assemble(cnt);
|
||||
}
|
||||
if (cnt instanceof Context) {
|
||||
slot.replaceInput(
|
||||
slot.addInput(),
|
||||
cnt.expression.fullCopy()
|
||||
);
|
||||
} else {
|
||||
slot.addInput(cnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (slot instanceof ColorSlotMorph) {
|
||||
slot.setColor(Color.fromString(inp));
|
||||
} else if (slot instanceof InputSlotMorph ||
|
||||
|
|
|
@ -64,7 +64,7 @@ SnapExtensions, AlignmentMorph, TextMorph, Cloud, HatBlockMorph*/
|
|||
|
||||
/*jshint esversion: 6*/
|
||||
|
||||
modules.threads = '2022-January-03';
|
||||
modules.threads = '2022-January-04';
|
||||
|
||||
var ThreadManager;
|
||||
var Process;
|
||||
|
@ -4574,6 +4574,9 @@ Process.prototype.assemble = function (blocks) {
|
|||
if (blocks.isEmpty()) {
|
||||
return blocks;
|
||||
}
|
||||
if (this.reportIsA(blocks.at(1), 'number')) {
|
||||
return blocks.map(each => this.assemble(each));
|
||||
}
|
||||
return blocks.map(each => this.assemble(each)).itemsArray().reduce(
|
||||
(a, b) => a.copyWithNext(b)
|
||||
);
|
||||
|
|
Ładowanie…
Reference in New Issue