Value: extract Value::StringWithContext

This commit is contained in:
Robert Hensing 2023-11-12 03:02:02 +01:00
parent 7ba4e073e8
commit 2eb59c34b5

View file

@ -158,18 +158,13 @@ public:
inline bool isPrimOp() const { return internalType == tPrimOp; }; inline bool isPrimOp() const { return internalType == tPrimOp; };
inline bool isPrimOpApp() const { return internalType == tPrimOpApp; }; inline bool isPrimOpApp() const { return internalType == tPrimOpApp; };
union
{
NixInt integer;
bool boolean;
/** /**
* Strings in the evaluator carry a so-called `context` which * Strings in the evaluator carry a so-called `context` which
* is a list of strings representing store paths. This is to * is a list of strings representing store paths. This is to
* allow users to write things like * allow users to write things like
*
* "--with-freetype2-library=" + freetype + "/lib" * "--with-freetype2-library=" + freetype + "/lib"
*
* where `freetype` is a derivation (or a source to be copied * where `freetype` is a derivation (or a source to be copied
* to the store). If we just concatenated the strings without * to the store). If we just concatenated the strings without
* keeping track of the referenced store paths, then if the * keeping track of the referenced store paths, then if the
@ -185,10 +180,17 @@ public:
* For canonicity, the store paths should be in sorted order. * For canonicity, the store paths should be in sorted order.
*/ */
struct { struct StringWithContext {
const char * c_str; const char * c_str;
const char * * context; // must be in sorted order const char * * context; // must be in sorted order
} string; };
union
{
NixInt integer;
bool boolean;
StringWithContext string;
struct { struct {
InputAccessor * accessor; InputAccessor * accessor;