summaryrefslogtreecommitdiff
path: root/src/hir/type.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-08-18 09:39:52 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-08-18 09:39:52 +0800
commit7ee9fc53ab6caa32261496cb76eebda40fbfe000 (patch)
tree45eaa56967f93259fd4146fc37f6077c272aa8d5 /src/hir/type.hpp
parent6498c9b315cda96114072a0fdb3dc86f8b1232fe (diff)
downloadmrust-7ee9fc53ab6caa32261496cb76eebda40fbfe000.tar.gz
HIR Typecheck - Refactor coerce/unsize handling
Diffstat (limited to 'src/hir/type.hpp')
-rw-r--r--src/hir/type.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/hir/type.hpp b/src/hir/type.hpp
index cc0894d2..e3aeec43 100644
--- a/src/hir/type.hpp
+++ b/src/hir/type.hpp
@@ -127,6 +127,20 @@ public:
(Infer, struct {
unsigned int index;
InferClass ty_class;
+
+ /// Returns true if the ivar is a literal
+ bool is_lit() const {
+ switch(this->ty_class)
+ {
+ case InferClass::None:
+ case InferClass::Diverge:
+ return false;
+ case InferClass::Integer:
+ case InferClass::Float:
+ return true;
+ }
+ throw "";
+ }
}),
(Diverge, struct {}),
(Primitive, ::HIR::CoreType),