Fix logical/boolean operators

This commit is contained in:
Sven Slootweg 2023-09-09 23:46:19 +02:00
parent 95ea366ade
commit 070900db8f

View file

@ -73,7 +73,11 @@ let trivial = {
return defer((node) => { return defer((node) => {
// FIXME: Verify that all the 'operator' values match between Nix and JS! // FIXME: Verify that all the 'operator' values match between Nix and JS!
// FIXME: Need to replace this with utility functions to deal with eg. paths // FIXME: Need to replace this with utility functions to deal with eg. paths
return types.binaryExpression(node.operator, node.left, node.right); if (node.operator === "&&" || node.operator === "||") {
return types.logicalExpression(node.operator, node.left, node.right);
} else {
return types.binaryExpression(node.operator, node.left, node.right);
}
}); });
}, },
NixWithExpression: (node, { defer, setContext, getContextOptional }) => { NixWithExpression: (node, { defer, setContext, getContextOptional }) => {