added "compile / un-compile" options to HOF-prims

pull/89/head
jmoenig 2019-05-03 08:39:05 +02:00
rodzic 1ca1fc4634
commit 364f780a88
2 zmienionych plików z 43 dodań i 1 usunięć

Wyświetl plik

@ -28,7 +28,7 @@
* new "get pen attribute" reporter
* new "write" command in pen category (used to be "label" in tools)
* new "numbers", "is empty", "map","keep", "combine" and "for each" primitives in list category
* new JIT-compiler "blitz-HOF" primitives for "map", "keep" & "combine" via "relabel"
* new JIT-compiler "blitz-HOF" primitives for "map", "keep" & "combine" via "compile"
* new "for" loop and "if then else" reporter primitives in the Control category
* added "neg", "lg" (log2) and "2^" selectors to monadic function reporter in Operators
* added "^" reporter (power of) in the Operators category
@ -79,6 +79,7 @@
### 2019-05-02
* Blocks: reverted reordering MY block dropdown by data type - back to similarities
* Blocks: added "compile / un-compile" options to HOF-prims
### 2019-05-02
* Blocks: reordered MY block dropdown by data type

Wyświetl plik

@ -2794,6 +2794,47 @@ BlockMorph.prototype.userMenu = function () {
}
}
// JIT-compile HOFs - experimental
if (
contains(
['reportMap', 'reportKeep', 'reportCombine'],
this.selector
)
) {
alternatives = {
reportMap : 'reportAtomicMap',
reportKeep : 'reportAtomicKeep',
reportCombine : 'reportAtomicCombine'
};
menu.addItem(
'compile',
function () {
myself.setSelector(alternatives[myself.selector]);
myself.changed();
},
'experimental!\nmake this reporter fast and uninterruptable\n' +
'CAUTION: Errors in the ring\ncan break your Snap! session!'
);
} else if (
contains(
['reportAtomicMap', 'reportAtomicKeep', 'reportAtomicCombine'],
this.selector
)
) {
alternatives = {
reportAtomicMap : 'reportMap',
reportAtomicKeep : 'reportKeep',
reportAtomicCombine : 'reportCombine'
};
menu.addItem(
'un-compile',
function () {
myself.setSelector(alternatives[myself.selector]);
myself.changed();
}
);
}
menu.addItem(
"duplicate",
function () {