5nix::PosIdx
displOf(
const nix::Expr *E, nix::Displacement Displ) {
6 if (
const auto *CE =
dynamic_cast<const nix::ExprAttrs *
>(E))
8 if (
const auto *CE =
dynamic_cast<const nix::ExprLet *
>(E))
10 if (
const auto *CE =
dynamic_cast<const nix::ExprLambda *
>(E))
13 assert(
false &&
"The requested expr is not an env creator");
17nix::PosIdx
displOf(
const nix::ExprAttrs *E, nix::Displacement Displ) {
18 assert(E->recursive &&
"Only recursive ExprAttr has displacement values");
20 auto DefIt = E->attrs.begin();
21 std::advance(DefIt, Displ);
23 return DefIt->second.pos;
26nix::PosIdx
displOf(
const nix::ExprLet *E, nix::Displacement Displ) {
27 auto DefIt = E->attrs->attrs.begin();
28 std::advance(DefIt, Displ);
30 return DefIt->second.pos;
33nix::PosIdx
displOf(
const nix::ExprLambda *E, nix::Displacement Displ) {
41 assert(E->hasFormals() &&
"Lambda must has formals to create displ");
42 return E->formals->formals[Displ].pos;
Get nix::PosIdx of an nix::Expr, from nix::Displacement.
Access EvalCache in nix::EvalState.
nix::PosIdx displOf(const nix::Expr *E, nix::Displacement Displ)
Get nix::PosIdx of an nix::Expr, from nix::Displacement.