diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-10-04 14:15:51 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-04 14:15:51 -0400 |
| commit | 97bb82ebcdf8f1391b9d93b5a8d7b1dfc4e88e52 (patch) | |
| tree | f120ba282cbea96d23ed179737984a4610d3b520 /source/core/slang-dictionary.h | |
| parent | b3dfe383c6d31ff3dbd76dcfb32de8d536382f3e (diff) | |
Removing exceptions from core/compiler-core (#1953)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Refactor Stream. Working on all tests.
* Split out CharEncode.
* Make method names lower camel.
m_prefix in Writer/Reader
* Tidy up around CharEncode interface.
* Small improvements around encode/decode.
* Better use of types.
* Remove readLine from TextReader.
* Remove exceptions from Stream/Text handling.
* Fix some typos.
* Fix tabbing.
* Fix missing override.
* Remove remaining exception throw/catch via using signal mechanism.
* Remove exceptions that are not used anymore.
* Document the Stream interface.
* Remove index for decoding 'get byte' function.
* Fix CharReader -> ByteReader.
Diffstat (limited to 'source/core/slang-dictionary.h')
| -rw-r--r-- | source/core/slang-dictionary.h | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/source/core/slang-dictionary.h b/source/core/slang-dictionary.h index 51b61de60..eef7d6908 100644 --- a/source/core/slang-dictionary.h +++ b/source/core/slang-dictionary.h @@ -171,7 +171,7 @@ namespace Slang } if (insertPos != -1) return FindPositionResult(-1, insertPos); - throw InvalidOperationException("Hash map is full. This indicates an error in Key::Equal or Key::getHashCode."); + SLANG_ASSERT_FAILURE("Hash map is full. This indicates an error in Key::Equal or Key::getHashCode."); } TValue & _Insert(KeyValuePair<TKey, TValue>&& kvPair, int pos) { @@ -217,12 +217,12 @@ namespace Slang return true; } else - throw InvalidOperationException("Inconsistent find result returned. This is a bug in Dictionary implementation."); + SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); } void Add(KeyValuePair<TKey, TValue>&& kvPair) { if (!AddIfNotExists(_Move(kvPair))) - throw KeyExistsException("The key already exists in Dictionary."); + SLANG_ASSERT_FAILURE("The key already exists in Dictionary."); } TValue& Set(KeyValuePair<TKey, TValue>&& kvPair) { @@ -236,7 +236,7 @@ namespace Slang return _Insert(_Move(kvPair), pos.InsertionPosition); } else - throw InvalidOperationException("Inconsistent find result returned. This is a bug in Dictionary implementation."); + SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); } public: class Iterator @@ -358,7 +358,7 @@ namespace Slang return nullptr; } else - throw InvalidOperationException("Inconsistent find result returned. This is a bug in Dictionary implementation."); + SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); } /// This differs from TryGetValueOrAdd, in that it always returns the Value held in the Dictionary. @@ -379,7 +379,7 @@ namespace Slang return _Insert(_Move(kvPair), pos.InsertionPosition); } else - throw InvalidOperationException("Inconsistent find result returned. This is a bug in Dictionary implementation."); + SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); } template<typename KeyType> @@ -440,7 +440,7 @@ namespace Slang return dict->hashMap[pos.ObjectPosition].Value; } else - throw KeyNotFoundException("The key does not exists in dictionary."); + SLANG_ASSERT_FAILURE("The key does not exists in dictionary."); } inline TValue & operator()() const { @@ -742,8 +742,7 @@ namespace Slang } if (insertPos != -1) return FindPositionResult(-1, insertPos); - throw InvalidOperationException( - "Hash map is full. This indicates an error in Key::Equal or Key::GetHashCode."); + SLANG_ASSERT_FAILURE("Hash map is full. This indicates an error in Key::Equal or Key::GetHashCode."); } TValue& _Insert(KeyValuePair<TKey, TValue>&& kvPair, int pos) { @@ -791,13 +790,12 @@ namespace Slang return true; } else - throw InvalidOperationException("Inconsistent find result returned. This is a " - "bug in Dictionary implementation."); + SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); } void Add(KeyValuePair<TKey, TValue>&& kvPair) { if (!AddIfNotExists(_Move(kvPair))) - throw KeyExistsException("The key already exists in Dictionary."); + SLANG_ASSERT_FAILURE("The key already exists in Dictionary."); } TValue& Set(KeyValuePair<TKey, TValue>&& kvPair) { @@ -814,8 +812,7 @@ namespace Slang return _Insert(_Move(kvPair), pos.InsertionPosition); } else - throw InvalidOperationException("Inconsistent find result returned. This is a " - "bug in Dictionary implementation."); + SLANG_ASSERT_FAILURE("Inconsistent find result returned. This is a bug in Dictionary implementation."); } public: @@ -923,7 +920,7 @@ namespace Slang } else { - throw KeyNotFoundException("The key does not exists in dictionary."); + SLANG_ASSERT_FAILURE("The key does not exists in dictionary."); } } inline TValue& operator()() const { return GetValue(); } |
