* builtins.toXML: propagate the string context. This is a regression
from the old ATerm-based evaluator.
This commit is contained in:
parent
07ca66cf24
commit
f16fe2af8d
|
@ -902,12 +902,18 @@ string EvalState::forceString(Value & v)
|
|||
}
|
||||
|
||||
|
||||
string EvalState::forceString(Value & v, PathSet & context)
|
||||
void copyContext(const Value & v, PathSet & context)
|
||||
{
|
||||
string s = forceString(v);
|
||||
if (v.string.context)
|
||||
for (const char * * p = v.string.context; *p; ++p)
|
||||
context.insert(*p);
|
||||
}
|
||||
|
||||
|
||||
string EvalState::forceString(Value & v, PathSet & context)
|
||||
{
|
||||
string s = forceString(v);
|
||||
copyContext(v, context);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -938,9 +944,7 @@ string EvalState::coerceToString(Value & v, PathSet & context,
|
|||
string s;
|
||||
|
||||
if (v.type == tString) {
|
||||
if (v.string.context)
|
||||
for (const char * * p = v.string.context; *p; ++p)
|
||||
context.insert(*p);
|
||||
copyContext(v, context);
|
||||
return v.string.s;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,6 +161,8 @@ void mkString(Value & v, const char * s);
|
|||
void mkString(Value & v, const string & s, const PathSet & context = PathSet());
|
||||
void mkPath(Value & v, const char * s);
|
||||
|
||||
void copyContext(const Value & v, PathSet & context);
|
||||
|
||||
|
||||
typedef std::map<Path, Hash> DrvHashes;
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ static void printValueAsXML(EvalState & state, bool strict, bool location,
|
|||
|
||||
case tString:
|
||||
/* !!! show the context? */
|
||||
copyContext(v, context);
|
||||
doc.writeEmptyElement("string", singletonAttrs("value", v.string.s));
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue