mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
Fix GC bug in ExprPath
This commit is contained in:
parent
9e05daaa9e
commit
9411299875
5 changed files with 19 additions and 14 deletions
|
@ -890,10 +890,7 @@ void Value::mkStringMove(const char * s, const PathSet & context)
|
||||||
|
|
||||||
void Value::mkPath(const SourcePath & path)
|
void Value::mkPath(const SourcePath & path)
|
||||||
{
|
{
|
||||||
clearValue();
|
mkPath(&path.accessor, makeImmutableString(path.path));
|
||||||
internalType = tPath;
|
|
||||||
_path.accessor = &path.accessor;
|
|
||||||
_path.path = makeImmutableString(path.path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,16 +50,16 @@ struct Env
|
||||||
void copyContext(const Value & v, PathSet & context);
|
void copyContext(const Value & v, PathSet & context);
|
||||||
|
|
||||||
|
|
||||||
// FIXME: maybe change this to an std::variant<SourcePath, URL>.
|
|
||||||
typedef std::pair<std::string, std::string> SearchPathElem;
|
|
||||||
typedef std::list<SearchPathElem> SearchPath;
|
|
||||||
|
|
||||||
|
|
||||||
std::ostream & printValue(const EvalState & state, std::ostream & str, const Value & v);
|
std::ostream & printValue(const EvalState & state, std::ostream & str, const Value & v);
|
||||||
std::string printValue(const EvalState & state, const Value & v);
|
std::string printValue(const EvalState & state, const Value & v);
|
||||||
std::ostream & operator << (std::ostream & os, const ValueType t);
|
std::ostream & operator << (std::ostream & os, const ValueType t);
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME: maybe change this to an std::variant<SourcePath, URL>.
|
||||||
|
typedef std::pair<std::string, std::string> SearchPathElem;
|
||||||
|
typedef std::list<SearchPathElem> SearchPath;
|
||||||
|
|
||||||
|
|
||||||
/* Initialise the Boehm GC, if applicable. */
|
/* Initialise the Boehm GC, if applicable. */
|
||||||
void initGC();
|
void initGC();
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ void ExprString::show(const SymbolTable & symbols, std::ostream & str) const
|
||||||
|
|
||||||
void ExprPath::show(const SymbolTable & symbols, std::ostream & str) const
|
void ExprPath::show(const SymbolTable & symbols, std::ostream & str) const
|
||||||
{
|
{
|
||||||
str << s;
|
str << path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExprVar::show(const SymbolTable & symbols, std::ostream & str) const
|
void ExprVar::show(const SymbolTable & symbols, std::ostream & str) const
|
||||||
|
|
|
@ -183,12 +183,12 @@ struct ExprString : Expr
|
||||||
|
|
||||||
struct ExprPath : Expr
|
struct ExprPath : Expr
|
||||||
{
|
{
|
||||||
std::string s; // FIXME: remove
|
const SourcePath path;
|
||||||
Value v;
|
Value v;
|
||||||
ExprPath(SourcePath && path)
|
ExprPath(SourcePath && _path)
|
||||||
: s(path.path)
|
: path(_path)
|
||||||
{
|
{
|
||||||
v.mkPath(std::move(path));
|
v.mkPath(&path.accessor, path.path.c_str());
|
||||||
}
|
}
|
||||||
COMMON_METHODS
|
COMMON_METHODS
|
||||||
Value * maybeThunk(EvalState & state, Env & env);
|
Value * maybeThunk(EvalState & state, Env & env);
|
||||||
|
|
|
@ -263,6 +263,14 @@ public:
|
||||||
|
|
||||||
void mkPath(const SourcePath & path);
|
void mkPath(const SourcePath & path);
|
||||||
|
|
||||||
|
inline void mkPath(InputAccessor * accessor, const char * path)
|
||||||
|
{
|
||||||
|
clearValue();
|
||||||
|
internalType = tPath;
|
||||||
|
_path.accessor = accessor;
|
||||||
|
_path.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
inline void mkNull()
|
inline void mkNull()
|
||||||
{
|
{
|
||||||
clearValue();
|
clearValue();
|
||||||
|
|
Loading…
Reference in a new issue