From b1b78855074dc66aa214dd24904664bf5d2c9120 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 11 Sep 2023 02:13:05 +0200 Subject: [PATCH] Implement object merge operator --- src/transformers/attribute-sets.js | 1 + src/transformers/index.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/transformers/attribute-sets.js b/src/transformers/attribute-sets.js index 709d1cd..07b75fd 100644 --- a/src/transformers/attribute-sets.js +++ b/src/transformers/attribute-sets.js @@ -166,6 +166,7 @@ module.exports = { let hasOverrides = bindings.some((binding) => binding.name === "__overrides"); if (isRecursive) { + // __overrides is only respected in recursive attribute sets, in the upstream implementation if (hasOverrides) { throw new Error(`The __overrides feature is not supported in jsNix`); } diff --git a/src/transformers/index.js b/src/transformers/index.js index f930706..06992d1 100644 --- a/src/transformers/index.js +++ b/src/transformers/index.js @@ -75,6 +75,11 @@ let trivial = { // FIXME: Need to replace this with utility functions to deal with eg. paths if (node.operator === "&&" || node.operator === "||") { return types.logicalExpression(node.operator, node.left, node.right); + } if (node.operator === "//") { + return types.objectExpression([ + types.spreadElement(node.left), + types.spreadElement(node.right) + ]); } else { return types.binaryExpression(node.operator, node.left, node.right); }