MCPcopy Create free account
hub / github.com/NixOS/nix / forceString

Method forceString

src/libexpr/eval.cc:2379–2393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2377}
2378
2379std::string_view EvalState::forceString(Value & v, const PosIdx pos, std::string_view errorCtx)
2380{
2381 try {
2382 forceValue(v, pos);
2383 if (v.type() != nString)
2384 error<TypeError>(
2385 "expected a string but found %1%: %2%", showType(v), ValuePrinter(*this, v, errorPrintOptions))
2386 .atPos(pos)
2387 .debugThrow();
2388 return v.string_view();
2389 } catch (Error & e) {
2390 e.addTrace(positions[pos], errorCtx);
2391 throw;
2392 }
2393}
2394
2395void copyContext(const Value & v, NixStringContext & context, const ExperimentalFeatureSettings & xpSettings)
2396{

Callers 15

getLatestNixMethod · 0.80
showHelpFunction · 0.80
runMethod · 0.80
resolveMirrorUrlFunction · 0.80
main_nix_prefetch_urlFunction · 0.80
prim_warnFunction · 0.80
derivationStrictInternalFunction · 0.80
prim_toFileFunction · 0.80
prim_hashStringFunction · 0.80
prim_matchFunction · 0.80
prim_splitFunction · 0.80
prim_concatStringsSepFunction · 0.80

Calls 8

showTypeFunction · 0.85
ValuePrinterClass · 0.85
copyContextFunction · 0.85
debugThrowMethod · 0.80
atPosMethod · 0.80
string_viewMethod · 0.80
typeMethod · 0.45
addTraceMethod · 0.45

Tested by

no test coverage detected