"use strict"; const NoChange = require("astformer/actions/no-change"); // FIXME module.exports = { name: "desugar-interpolation-expressions", visitors: { NixAttributePath: (node) => { if (node.attr.length === 1 && node.attr[0].type === "NixInterpolationExpression") { // Special case: something like `{ ${foo} = "bar"; }` where the interpolation is expressed without surrounding string literal syntax return { ... node, // TODO: Move construction to _nixTypes attr: [ { type: "NixStringLiteral", parts: [ { type: "NixInterpolationLiteral", value: "" }, node.attr[0], { type: "NixInterpolationLiteral", value: "" }, ] }, ] }; } else { return NoChange; } } } };