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: 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(`
|
||||
$assertUniqueKeys( %%keyList%% )
|
||||
|
@ -162,8 +163,13 @@ module.exports = {
|
|||
});
|
||||
|
||||
let hasDynamicBindings = bindings.some((binding) => typeof binding.name !== "string");
|
||||
let hasOverrides = bindings.some((binding) => binding.name === "__overrides");
|
||||
|
||||
if (isRecursive) {
|
||||
if (hasOverrides) {
|
||||
throw new Error(`The __overrides feature is not supported in jsNix`);
|
||||
}
|
||||
|
||||
if (hasDynamicBindings) {
|
||||
return objectRecursiveDynamic(bindings);
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
let ignoredTests = new Set([
|
||||
// We do not support the overrides feature at all, and probably never will
|
||||
"eval-okay-overrides"
|
||||
]);
|
||||
|
||||
try {
|
||||
const tape = require("tape-catch");
|
||||
const fs = require("fs");
|
||||
|
@ -31,6 +36,10 @@ try {
|
|||
|
||||
for (let test of tests) {
|
||||
try {
|
||||
if (ignoredTests.has(test)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let expression = fs.readFileSync(path.join(testsPath, `${test}.nix`), "utf8");
|
||||
let expectedResult = fs.readFileSync(path.join(testsPath, `${test}.exp`), "utf8").replace(/\n$/, "");
|
||||
|
||||
|
|
Loading…
Reference in a new issue