master
Sven Slootweg 8 months ago
parent 402b3ddb02
commit 2013a380c6

@ -76,9 +76,9 @@ let trivial = {
return types.binaryExpression(node.operator, node.left, node.right);
});
},
NixWithExpression: (node, { defer, setContext, getContext }) => {
NixWithExpression: (node, { defer, setContext, getContextOptional }) => {
// TODO: Can we optimize for the fast case (no nested `with`) by referencing the source attrset directly?
let parentContext = getContext("implicitContext");
let parentContext = getContextOptional("implicitContext");
let hasParent = (parentContext != null);
let contextName = `$implicit${implicitContextCounter++}`;

@ -16,7 +16,7 @@ let types = module.exports = {
NixAttributeSet: function (bindings, recursive = false) {
return {
type: "NixAttributeSet",
bind: bindings,
binding: bindings,
recursive: recursive
};
},
@ -60,7 +60,7 @@ let types = module.exports = {
NixLetIn: function (bindings, body) {
return {
type: "NixLetIn",
bind: bindings,
binding: bindings,
body: body
};
},

@ -11,9 +11,9 @@ const printAST = require("../src/print-ast");
assert(process.argv[2] != null);
let tree = parse(fs.readFileSync(process.argv[2], "utf8"));
for (let i = 0; i < 10000; i++) {
astformer(tree, transformers);
}
// for (let i = 0; i < 10000; i++) {
// astformer(tree, transformers);
// }
let transformed = astformer(tree, transformers);
printAST(transformed.ast);

Loading…
Cancel
Save