Implement boolean negation, array concatenation operators
This commit is contained in:
parent
2dc3ce056e
commit
c29e8b974e
|
@ -82,7 +82,7 @@ let trivial = {
|
|||
},
|
||||
NixUnaryOperation: (_node, { defer }) => {
|
||||
return defer((node) => {
|
||||
if (node.operator === "-") {
|
||||
if (node.operator === "-" || node.operator === "!") {
|
||||
return types.unaryExpression(node.operator, node.argument, true);
|
||||
} else {
|
||||
throw new Error(`Unsupported operator: ${node.operator}`);
|
||||
|
@ -100,6 +100,11 @@ let trivial = {
|
|||
types.spreadElement(node.left),
|
||||
types.spreadElement(node.right)
|
||||
]);
|
||||
} else if (node.operator === "++") {
|
||||
return types.arrayExpression([
|
||||
types.spreadElement(node.left),
|
||||
types.spreadElement(node.right)
|
||||
]);
|
||||
} else {
|
||||
return types.binaryExpression(node.operator, node.left, node.right);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue