Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::Expr Struct Reference
Inheritance diagram for nix::Expr:
nix::ExprAssert nix::ExprAttrs nix::ExprBlackHole nix::ExprCall nix::ExprConcatStrings nix::ExprFloat nix::ExprIf nix::ExprInt nix::ExprLambda nix::ExprLet nix::ExprList nix::ExprOpAnd nix::ExprOpConcatLists nix::ExprOpEq nix::ExprOpHasAttr nix::ExprOpImpl nix::ExprOpNEq nix::ExprOpNot nix::ExprOpOr nix::ExprOpUpdate nix::ExprPath nix::ExprPos nix::ExprSelect nix::ExprString nix::ExprVar nix::ExprWith

Classes

struct  AstSymbols

Public Member Functions

virtual void show (const SymbolTable &symbols, std::ostream &str) const
virtual void bindVars (EvalState &es, const std::shared_ptr< const StaticEnv > &env)
virtual void eval (EvalState &state, Env &env, Value &v)
void eval (EvalState &state, Env &env, Value &v, std::string_view errorCtx)
virtual Value * maybeThunk (EvalState &state, Env &env)
virtual void evalForUpdate (EvalState &state, Env &env, UpdateQueue &q, std::string_view errorCtx)
virtual void setName (Symbol name)
virtual void setDocComment (DocComment docComment)
virtual PosIdx getPos () const
virtual void resetCursedOr ()
virtual void warnIfCursedOr (const SymbolTable &symbols, const PosTable &positions)

Static Public Attributes

static Counter nrExprs

Member Function Documentation

◆ eval() [1/2]

◆ eval() [2/2]

void nix::Expr::eval ( EvalState & state,
Env & env,
Value & v,
std::string_view errorCtx )

Wrapper around the above that adds errorCtx to any thrown errors.

◆ evalForUpdate()

void nix::Expr::evalForUpdate ( EvalState & state,
Env & env,
UpdateQueue & q,
std::string_view errorCtx )
virtual

Only called when performing an attrset update: // or similar. Instead of writing to a Value &, this function writes to an UpdateQueue. This allows the expression to perform multiple updates in a delayed manner, gathering up all the updates before applying them.

Reimplemented in nix::ExprOpUpdate.

◆ maybeThunk()

Value * nix::Expr::maybeThunk ( EvalState & state,
Env & env )
virtual

Create a thunk for the delayed computation of the given expression in the given environment. But if the expression is a variable, then look it up right away. This significantly reduces the number of thunks allocated.

Reimplemented in nix::ExprFloat, nix::ExprInt, nix::ExprList, nix::ExprPath, nix::ExprString, and nix::ExprVar.


The documentation for this struct was generated from the following files:
  • libexpr/include/nix/expr/nixexpr.hh
  • libexpr/eval.cc
  • libexpr/nixexpr.cc