diff options
author | Silvan Mosberger <contact@infinisil.com> | 2020-12-12 02:15:11 +0100 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2020-12-12 03:31:50 +0100 |
commit | bf9890396731a2bbe4f04a49684dee463d818906 (patch) | |
tree | 171d646c0540828a294346e887c214ba44b5472c /src/libexpr/value.hh | |
parent | 22ead43a0b8f94f5a4fb64cff14bf6a2a35d671c (diff) |
Add ValueType checking functions for types that have the same NormalType
Diffstat (limited to 'src/libexpr/value.hh')
-rw-r--r-- | src/libexpr/value.hh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libexpr/value.hh b/src/libexpr/value.hh index 0995dcd7b..e743da9c3 100644 --- a/src/libexpr/value.hh +++ b/src/libexpr/value.hh @@ -126,6 +126,20 @@ struct Value inline void setExternal() { type = tExternal; }; inline void setFloat() { type = tFloat; }; + // Functions needed to distinguish the type + // These should be removed eventually, by putting the functionality that's + // needed by callers into methods of this type + + // normalType() == nThunk + inline bool isThunk() const { return type == tThunk; }; + inline bool isApp() const { return type == tApp; }; + inline bool isBlackhole() const { return type == tBlackhole; }; + + // normalType() == nFunction + inline bool isLambda() const { return type == tLambda; }; + inline bool isPrimOp() const { return type == tPrimOp; }; + inline bool isPrimOpApp() const { return type == tPrimOpApp; }; + union { NixInt integer; |