Don't support overrides
This commit is contained in:
parent
5a7548bd32
commit
334ce73755
|
@ -13,6 +13,7 @@ const objectLiteral = require("./templates/object-literal");
|
||||||
|
|
||||||
// TODO: Optimize lazy evaluation wrappers by only unpacking them selectively when used in an actual expression; in particular, that avoids the "wrapper that just calls another wrapper" overhead when passing attributes as function arguments
|
// TODO: Optimize lazy evaluation wrappers by only unpacking them selectively when used in an actual expression; in particular, that avoids the "wrapper that just calls another wrapper" overhead when passing attributes as function arguments
|
||||||
// TODO: Change to a prototype-based scope object chain? This should produce more consistent output regardless of whether a given set of bindings is static vs. dynamic and recursive vs. non-recursive
|
// TODO: Change to a prototype-based scope object chain? This should produce more consistent output regardless of whether a given set of bindings is static vs. dynamic and recursive vs. non-recursive
|
||||||
|
// TODO: Implement __overrides support. Maybe. If I am ever truly desperate for a torturous task. nixpkgs yote it all the way back in 2014 because it is so broken.
|
||||||
|
|
||||||
let tmplAssertKeys = template(`
|
let tmplAssertKeys = template(`
|
||||||
$assertUniqueKeys( %%keyList%% )
|
$assertUniqueKeys( %%keyList%% )
|
||||||
|
@ -162,8 +163,13 @@ module.exports = {
|
||||||
});
|
});
|
||||||
|
|
||||||
let hasDynamicBindings = bindings.some((binding) => typeof binding.name !== "string");
|
let hasDynamicBindings = bindings.some((binding) => typeof binding.name !== "string");
|
||||||
|
let hasOverrides = bindings.some((binding) => binding.name === "__overrides");
|
||||||
|
|
||||||
if (isRecursive) {
|
if (isRecursive) {
|
||||||
|
if (hasOverrides) {
|
||||||
|
throw new Error(`The __overrides feature is not supported in jsNix`);
|
||||||
|
}
|
||||||
|
|
||||||
if (hasDynamicBindings) {
|
if (hasDynamicBindings) {
|
||||||
return objectRecursiveDynamic(bindings);
|
return objectRecursiveDynamic(bindings);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
let ignoredTests = new Set([
|
||||||
|
// We do not support the overrides feature at all, and probably never will
|
||||||
|
"eval-okay-overrides"
|
||||||
|
]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const tape = require("tape-catch");
|
const tape = require("tape-catch");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
@ -31,6 +36,10 @@ try {
|
||||||
|
|
||||||
for (let test of tests) {
|
for (let test of tests) {
|
||||||
try {
|
try {
|
||||||
|
if (ignoredTests.has(test)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
let expression = fs.readFileSync(path.join(testsPath, `${test}.nix`), "utf8");
|
let expression = fs.readFileSync(path.join(testsPath, `${test}.nix`), "utf8");
|
||||||
let expectedResult = fs.readFileSync(path.join(testsPath, `${test}.exp`), "utf8").replace(/\n$/, "");
|
let expectedResult = fs.readFileSync(path.join(testsPath, `${test}.exp`), "utf8").replace(/\n$/, "");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue