diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-04-04T16·58+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-04-04T16·59+0200 |
commit | b62d36963c45ccaebb328fceaf0bb40f9c02a14b (patch) | |
tree | d33902351ffed1c44fffb4acdc31938626da2795 /src/libexpr/primops.cc | |
parent | c28de6d96e7bfea834a44deac5217d4696fa8d86 (diff) |
forceInt: Show position info
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r-- | src/libexpr/primops.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 403edefab6e4..b33b76bca121 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -954,7 +954,7 @@ static void elemAt(EvalState & state, const Pos & pos, Value & list, int n, Valu /* Return the n-1'th element of a list. */ static void prim_elemAt(EvalState & state, const Pos & pos, Value * * args, Value & v) { - elemAt(state, pos, *args[0], state.forceInt(*args[1]), v); + elemAt(state, pos, *args[0], state.forceInt(*args[1], pos), v); } @@ -1061,27 +1061,27 @@ static void prim_length(EvalState & state, const Pos & pos, Value * * args, Valu static void prim_add(EvalState & state, const Pos & pos, Value * * args, Value & v) { - mkInt(v, state.forceInt(*args[0]) + state.forceInt(*args[1])); + mkInt(v, state.forceInt(*args[0], pos) + state.forceInt(*args[1], pos)); } static void prim_sub(EvalState & state, const Pos & pos, Value * * args, Value & v) { - mkInt(v, state.forceInt(*args[0]) - state.forceInt(*args[1])); + mkInt(v, state.forceInt(*args[0], pos) - state.forceInt(*args[1], pos)); } static void prim_mul(EvalState & state, const Pos & pos, Value * * args, Value & v) { - mkInt(v, state.forceInt(*args[0]) * state.forceInt(*args[1])); + mkInt(v, state.forceInt(*args[0], pos) * state.forceInt(*args[1], pos)); } static void prim_div(EvalState & state, const Pos & pos, Value * * args, Value & v) { - NixInt i2 = state.forceInt(*args[1]); + NixInt i2 = state.forceInt(*args[1], pos); if (i2 == 0) throw EvalError(format("division by zero, at %1%") % pos); - mkInt(v, state.forceInt(*args[0]) / i2); + mkInt(v, state.forceInt(*args[0], pos) / i2); } @@ -1116,8 +1116,8 @@ static void prim_toString(EvalState & state, const Pos & pos, Value * * args, Va non-negative. */ static void prim_substring(EvalState & state, const Pos & pos, Value * * args, Value & v) { - int start = state.forceInt(*args[0]); - int len = state.forceInt(*args[1]); + int start = state.forceInt(*args[0], pos); + int len = state.forceInt(*args[1], pos); PathSet context; string s = state.coerceToString(*args[2], context); |