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); 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? // 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 hasParent = (parentContext != null);
let contextName = `$implicit${implicitContextCounter++}`; let contextName = `$implicit${implicitContextCounter++}`;

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

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

Loading…
Cancel
Save