1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-20 11:11:03 -04:00
nix/tests/unit/libexpr
Eelco Dolstra fecff520d7 Add a ListBuilder helper for constructing list values
Previously, `state.mkList()` would set the type of the value to tList
and allocate the list vector, but it would not initialize the values
in the list. This has two problems:

* If an exception occurs, the list is left in an undefined state.

* More importantly, for multithreaded evaluation, if a value
  transitions from thunk to non-thunk, it should be final (i.e. other
  threads should be able to access the value safely).

To address this, there now is a `ListBuilder` class (analogous to
`BindingsBuilder`) to build the list vector prior to the call to
`Value::mkList()`. Typical usage:

   auto list = state.buildList(size);
   for (auto & v : list)
       v = ... set value ...;
   vRes.mkList(list);
2024-03-15 18:26:37 +01:00
..
flake Fix extraction of name for defaultPackage URLs 2024-02-27 07:53:05 +01:00
value Add a ListBuilder helper for constructing list values 2024-03-15 18:26:37 +01:00
derived-path.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
error_traces.cc Fix tests 2024-02-08 15:55:20 -08:00
eval.cc allowed-uris: Match whole schemes also when scheme is not followed by slashes 2023-12-11 12:18:04 +01:00
json.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
local.mk Move url-name utility to libexpr/flake 2023-12-22 09:33:02 +01:00
primops.cc use byte indexed locations for PosIdx 2024-03-06 23:48:42 +01:00
search-path.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
trivial.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00