Update src/extensions/pm_operatorsExpansion/index.js
Browse files
src/extensions/pm_operatorsExpansion/index.js
CHANGED
@@ -2,7 +2,7 @@ const BlockType = require('../../extension-support/block-type');
|
|
2 |
const ArgumentType = require('../../extension-support/argument-type');
|
3 |
const createTranslate = require('../../extension-support/tw-l10n');
|
4 |
const Cast = require('../../util/cast');
|
5 |
-
const MathJS = require('mathjs');
|
6 |
|
7 |
const blockSeparator = '<sep gap="36"/>'; // At default scale, about 28px
|
8 |
|
@@ -17,10 +17,38 @@ ${blockSeparator}
|
|
17 |
%b34> ` +/* or if falsey */`
|
18 |
%b35> ` +/* if is true */`
|
19 |
${blockSeparator}
|
20 |
-
<block type="operator_nand"
|
21 |
-
<
|
22 |
-
<
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
<block type="operator_randomBoolean" />
|
25 |
${blockSeparator}
|
26 |
%b20> ` +/* evaluate math expression */`
|
@@ -954,7 +982,7 @@ class pmOperatorsExpansion {
|
|
954 |
return new TypedInput(`(${num1} || ${num2})`, TYPE_UNKNOWN);
|
955 |
},
|
956 |
ifIsTruthy: (node, compiler, {TypedInput, TYPE_UNKNOWN}) => {
|
957 |
-
const num1 = compiler.descendInput(node.one).
|
958 |
const num2 = compiler.descendInput(node.two).asUnknown();
|
959 |
|
960 |
return new TypedInput(`(${num1} && ${num2})`, TYPE_UNKNOWN);
|
|
|
2 |
const ArgumentType = require('../../extension-support/argument-type');
|
3 |
const createTranslate = require('../../extension-support/tw-l10n');
|
4 |
const Cast = require('../../util/cast');
|
5 |
+
const MathJS = require('./mathjs.js');
|
6 |
|
7 |
const blockSeparator = '<sep gap="36"/>'; // At default scale, about 28px
|
8 |
|
|
|
17 |
%b34> ` +/* or if falsey */`
|
18 |
%b35> ` +/* if is true */`
|
19 |
${blockSeparator}
|
20 |
+
<block type="operator_nand">
|
21 |
+
<value name="OPERAND1">
|
22 |
+
<shadow type="checkbox" />
|
23 |
+
</value>
|
24 |
+
<value name="OPERAND2">
|
25 |
+
<shadow type="checkbox" />
|
26 |
+
</value>
|
27 |
+
</block>
|
28 |
+
<block type="operator_nor">
|
29 |
+
<value name="OPERAND1">
|
30 |
+
<shadow type="checkbox" />
|
31 |
+
</value>
|
32 |
+
<value name="OPERAND2">
|
33 |
+
<shadow type="checkbox" />
|
34 |
+
</value>
|
35 |
+
</block>
|
36 |
+
<block type="operator_xor">
|
37 |
+
<value name="OPERAND1">
|
38 |
+
<shadow type="checkbox" />
|
39 |
+
</value>
|
40 |
+
<value name="OPERAND2">
|
41 |
+
<shadow type="checkbox" />
|
42 |
+
</value>
|
43 |
+
</block>
|
44 |
+
<block type="operator_xnor">
|
45 |
+
<value name="OPERAND1">
|
46 |
+
<shadow type="checkbox" />
|
47 |
+
</value>
|
48 |
+
<value name="OPERAND2">
|
49 |
+
<shadow type="checkbox" />
|
50 |
+
</value>
|
51 |
+
</block>
|
52 |
<block type="operator_randomBoolean" />
|
53 |
${blockSeparator}
|
54 |
%b20> ` +/* evaluate math expression */`
|
|
|
982 |
return new TypedInput(`(${num1} || ${num2})`, TYPE_UNKNOWN);
|
983 |
},
|
984 |
ifIsTruthy: (node, compiler, {TypedInput, TYPE_UNKNOWN}) => {
|
985 |
+
const num1 = compiler.descendInput(node.one).asBoolean();
|
986 |
const num2 = compiler.descendInput(node.two).asUnknown();
|
987 |
|
988 |
return new TypedInput(`(${num1} && ${num2})`, TYPE_UNKNOWN);
|