* Make printing an expression as XML interruptible.

This commit is contained in:
Eelco Dolstra 2007-01-13 14:48:41 +00:00
parent 11158028be
commit 792878af91
2 changed files with 7 additions and 0 deletions

View file

@ -684,6 +684,9 @@ Expr strictEvalExpr(EvalState & state, Expr e, bool canonicalise)
if (!matchBind(*i, name, e, pos)) abort(); /* can't happen */ if (!matchBind(*i, name, e, pos)) abort(); /* can't happen */
as2 = ATinsert(as2, makeBind(name, strictEvalExpr(state, e, canonicalise), as2 = ATinsert(as2, makeBind(name, strictEvalExpr(state, e, canonicalise),
canonicalise ? makeNoPos() : pos)); canonicalise ? makeNoPos() : pos));
}
if (canonicalise) {
} }
/* !!! sort attributes if canonicalise == true */ /* !!! sort attributes if canonicalise == true */
return makeAttrs(ATreverse(as2)); return makeAttrs(ATreverse(as2));
@ -716,6 +719,7 @@ Expr strictEvalExpr(EvalState & state, Expr e, bool canonicalise)
formals2 = ATinsert(formals2, makeFormal(name, valids, dummy)); formals2 = ATinsert(formals2, makeFormal(name, valids, dummy));
} }
return makeFunction(ATreverse(formals2), body, return makeFunction(ATreverse(formals2), body,
canonicalise ? makeNoPos() : pos); canonicalise ? makeNoPos() : pos);
} }

View file

@ -2,6 +2,7 @@
#include "xml-writer.hh" #include "xml-writer.hh"
#include "nixexpr-ast.hh" #include "nixexpr-ast.hh"
#include "aterm.hh" #include "aterm.hh"
#include "util.hh"
namespace nix { namespace nix {
@ -24,6 +25,8 @@ static void printTermAsXML(Expr e, XMLWriter & doc, PathSet & context)
ATermList as, es, formals; ATermList as, es, formals;
ATerm body, pos; ATerm body, pos;
checkInterrupt();
if (matchStr(e, s, context)) /* !!! show the context? */ if (matchStr(e, s, context)) /* !!! show the context? */
doc.writeEmptyElement("string", singletonAttrs("value", s)); doc.writeEmptyElement("string", singletonAttrs("value", s));