From 3f48e1c0d84bf4909954154ad147559656e87516 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Wed, 19 Jul 2017 09:36:35 -0700 Subject: Try to improve handling of failures during compilation The change is mostly about trying to make sure the compiler "fails safe" when it encounters an internal assumption that isn't met. Most internal errors will now throw exceptions (yes, exceptions are evil, but this will work for now), and these get caught in `spCompile` so that they don't propagate to the user (they just see a message that compilation aborted due to an internal error). Subsequent changes are going to need to work on diagnosing as many of these situations as possible, so that users can at least know what construct in their code was unexpected or unhandled by the compiler. --- source/slang/token.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/slang/token.cpp') diff --git a/source/slang/token.cpp b/source/slang/token.cpp index ff2ded818..69baf5e70 100644 --- a/source/slang/token.cpp +++ b/source/slang/token.cpp @@ -10,7 +10,7 @@ char const* TokenTypeToString(TokenType type) switch( type ) { default: - assert(!"unexpected"); + SLANG_ASSERT(!"unexpected"); return ""; #define TOKEN(NAME, DESC) case TokenType::NAME: return DESC; -- cgit v1.2.3