From 75205189d5e33a33193fa76a29f7518a9797299d Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 21 Mar 2015 15:41:00 +0800 Subject: Move wildcard use to Path::resolve, add 'bool' type --- src/types.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/types.cpp') diff --git a/src/types.cpp b/src/types.cpp index abf6b2da..4082bc96 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -16,6 +16,7 @@ const char* coretype_name(const eCoreType ct ) { case CORETYPE_INVAL:return "-"; case CORETYPE_ANY: return "_"; case CORETYPE_CHAR: return "char"; + case CORETYPE_BOOL: return "bool"; case CORETYPE_UINT: return "usize"; case CORETYPE_INT: return "isize"; case CORETYPE_U8: return "u8"; @@ -38,6 +39,8 @@ bool TypeRef::deref(bool is_implicit) { switch(m_class) { + case TypeRef::NONE: + throw ::std::runtime_error("Dereferencing ! - bugcheck"); case TypeRef::ANY: // TODO: Check if the _ is bounded by Deref, if so use that throw ::std::runtime_error("Dereferencing _"); @@ -103,6 +106,7 @@ void TypeRef::merge_with(const TypeRef& other) switch(m_class) { + case TypeRef::NONE: case TypeRef::ANY: case TypeRef::UNIT: case TypeRef::PRIMITIVE: @@ -148,6 +152,8 @@ void TypeRef::resolve_args(::std::function fcn) DEBUG("" << *this); switch(m_class) { + case TypeRef::NONE: + throw ::std::runtime_error("TypeRef::resolve_args on !"); case TypeRef::ANY: // TODO: Is resolving args on an ANY an erorr? break; @@ -204,6 +210,8 @@ void TypeRef::match_args(const TypeRef& other, ::std::function>(::Deserialiser& d, TypeRef::Class& c) { d.item(n); #define _(x) if(n == #x) c = TypeRef::x; /**/ _(ANY) + else _(NONE) else _(UNIT) else _(PRIMITIVE) else _(FUNCTION) -- cgit v1.2.3