mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 12:10:59 +01:00
Merging the trunk back into my branch: just merged revision 8628
This commit is contained in:
parent
d69dd855d5
commit
3800f55b54
12 changed files with 159 additions and 79 deletions
|
|
@ -616,6 +616,9 @@ static char * deepestStack = (char *) -1; /* for measuring stack usage */
|
|||
|
||||
Expr evalExpr2(EvalState & state, Expr e)
|
||||
{
|
||||
/* When changing this function, make sure that you don't cause a
|
||||
(large) increase in stack consumption! */
|
||||
|
||||
char x;
|
||||
if (&x < deepestStack) deepestStack = &x;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace nix {
|
|||
|
||||
MakeError(EvalError, Error)
|
||||
MakeError(AssertionError, EvalError)
|
||||
MakeError(ThrownError, AssertionError)
|
||||
MakeError(Abort, EvalError)
|
||||
MakeError(TypeError, EvalError)
|
||||
|
||||
|
|
|
|||
|
|
@ -271,6 +271,14 @@ static Expr prim_abort(EvalState & state, const ATermVector & args)
|
|||
}
|
||||
|
||||
|
||||
static Expr prim_throw(EvalState & state, const ATermVector & args)
|
||||
{
|
||||
PathSet context;
|
||||
throw ThrownError(format("user-thrown exception: `%1%'") %
|
||||
evalString(state, args[0], context));
|
||||
}
|
||||
|
||||
|
||||
/* Return an environment variable. Use with care. */
|
||||
static Expr prim_getEnv(EvalState & state, const ATermVector & args)
|
||||
{
|
||||
|
|
@ -1026,6 +1034,7 @@ void EvalState::addPrimOps()
|
|||
addPrimOp("isNull", 1, prim_isNull);
|
||||
addPrimOp("dependencyClosure", 1, prim_dependencyClosure);
|
||||
addPrimOp("abort", 1, prim_abort);
|
||||
addPrimOp("throw", 1, prim_throw);
|
||||
addPrimOp("__getEnv", 1, prim_getEnv);
|
||||
|
||||
addPrimOp("relativise", 2, prim_relativise);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue