summaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authorZoltan Herczeg <zherczeg.u-szeged@partner.samsung.com>2022-03-08 22:57:59 +0100
committerGitHub <noreply@github.com>2022-03-08 13:57:59 -0800
commit720a7f2127442b84d47c4a9e4f51741b4f68a5ff (patch)
treeac64d37883a42238036ac90ceaccb23764bcbc1a /src/interp
parentccbe21aac55a088069f15064e210684803e6a169 (diff)
downloadwabt-720a7f2127442b84d47c4a9e4f51741b4f68a5ff.tar.gz
wabt-720a7f2127442b84d47c4a9e4f51741b4f68a5ff.tar.bz2
wabt-720a7f2127442b84d47c4a9e4f51741b4f68a5ff.zip
Improve the maintenace of ObjectKind types. (#1852)
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/interp.cc7
-rw-r--r--src/interp/interp.h5
2 files changed, 10 insertions, 2 deletions
diff --git a/src/interp/interp.cc b/src/interp/interp.cc
index bf07f5c9..161724b1 100644
--- a/src/interp/interp.cc
+++ b/src/interp/interp.cc
@@ -41,9 +41,12 @@ const char* GetName(ExternKind kind) {
const char* GetName(ObjectKind kind) {
static const char* kNames[] = {
- "Null", "Foreign", "Trap", "DefinedFunc", "HostFunc", "Table",
- "Memory", "Global", "Tag", "Module", "Instance", "Thread",
+ "Null", "Foreign", "Trap", "Exception", "DefinedFunc", "HostFunc",
+ "Table", "Memory", "Global", "Tag", "Module", "Instance",
};
+
+ WABT_STATIC_ASSERT(WABT_ARRAY_SIZE(kNames) == kCommandTypeCount);
+
return kNames[int(kind)];
}
diff --git a/src/interp/interp.h b/src/interp/interp.h
index 97faec2d..eaa3f2c4 100644
--- a/src/interp/interp.h
+++ b/src/interp/interp.h
@@ -91,8 +91,13 @@ enum class ObjectKind {
Tag,
Module,
Instance,
+
+ First = Null,
+ Last = Instance,
};
+static const int kCommandTypeCount = WABT_ENUM_COUNT(ObjectKind);
+
const char* GetName(Mutability);
const std::string GetName(ValueType);
const char* GetName(ExternKind);