1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

Do big rename to clean up code

- `PathReferences` -> `References`

- `PathReferences<StorePath>` -> `StoreReference`

- `references` -> `others`

- `hasSelfReference` -> `self`

And get rid of silly subclassing
This commit is contained in:
John Ericson 2023-01-06 15:36:05 -05:00
parent 9cfa78e58a
commit 46e942ff9e
16 changed files with 146 additions and 112 deletions

View file

@ -1535,7 +1535,8 @@ static void prim_readFile(EvalState & state, const PosIdx pos, Value * * args, V
StorePathSet refs;
if (state.store->isInStore(path)) {
try {
refs = state.store->queryPathInfo(state.store->toStorePath(path).first)->references;
// FIXME: Are self references becoming non-self references OK?
refs = state.store->queryPathInfo(state.store->toStorePath(path).first)->referencesPossiblyToSelf();
} catch (Error &) { // FIXME: should be InvalidPathError
}
// Re-scan references to filter down to just the ones that actually occur in the file.
@ -1971,7 +1972,7 @@ static void addPath(
try {
auto [storePath, subPath] = state.store->toStorePath(path);
// FIXME: we should scanForReferences on the path before adding it
refs = state.store->queryPathInfo(storePath)->references;
refs = state.store->queryPathInfo(storePath)->referencesPossiblyToSelf();
path = state.store->toRealPath(storePath) + subPath;
} catch (Error &) { // FIXME: should be InvalidPathError
}
@ -2010,7 +2011,7 @@ static void addPath(
.method = method,
.hash = *expectedHash,
},
{},
.references = {},
});
if (!expectedHash || !state.store->isValidPath(*expectedStorePath)) {