summaryrefslogtreecommitdiffstats
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2020-12-17 14:42:52 +0100
committerSilvan Mosberger <contact@infinisil.com>2020-12-17 14:45:22 +0100
commitd67e02919c7f941615407dfd14cfdab6a28c4c26 (patch)
tree313f21e0433f71af1be5f479c86b319871ff20e6 /src/libexpr/eval.cc
parent730b152b190135adef2f53c7a80cfd1111d37ead (diff)
Rename ValueType -> InternalType, NormalType -> ValueType
And Value::type to Value::internalType, such that type() can be used in the next commit to get the new ValueType
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 1d11039ad..e14eb01c7 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -77,7 +77,7 @@ void printValue(std::ostream & str, std::set<const Value *> & active, const Valu
return;
}
- switch (v.type) {
+ switch (v.internalType) {
case tInt:
str << v.integer;
break;
@@ -165,7 +165,7 @@ const Value *getPrimOp(const Value &v) {
return primOp;
}
-string showType(NormalType type)
+string showType(ValueType type)
{
switch (type) {
case nInt: return "an integer";
@@ -186,7 +186,7 @@ string showType(NormalType type)
string showType(const Value & v)
{
- switch (v.type) {
+ switch (v.internalType) {
case tString: return v.string.context ? "a string with context" : "a string";
case tPrimOp:
return fmt("the built-in function '%s'", string(v.primOp->name));
@@ -205,9 +205,9 @@ string showType(const Value & v)
bool Value::isTrivial() const
{
return
- type != tApp
- && type != tPrimOpApp
- && (type != tThunk
+ internalType != tApp
+ && internalType != tPrimOpApp
+ && (internalType != tThunk
|| (dynamic_cast<ExprAttrs *>(thunk.expr)
&& ((ExprAttrs *) thunk.expr)->dynamicAttrs.empty())
|| dynamic_cast<ExprLambda *>(thunk.expr)
@@ -1562,7 +1562,7 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v)
NixFloat nf = 0;
bool first = !forceString;
- NormalType firstType = nString;
+ ValueType firstType = nString;
for (auto & i : *es) {
Value vTmp;
@@ -1728,7 +1728,7 @@ void copyContext(const Value & v, PathSet & context)
std::vector<std::pair<Path, std::string>> Value::getContext()
{
std::vector<std::pair<Path, std::string>> res;
- assert(type == tString);
+ assert(internalType == tString);
if (string.context)
for (const char * * p = string.context; *p; ++p)
res.push_back(decodeContext(*p));