summaryrefslogtreecommitdiff
path: root/src/generate-names.cc
diff options
context:
space:
mode:
authorKarlSchimpf <karlschimpf@gmail.com>2017-06-22 07:59:09 -0700
committerGitHub <noreply@github.com>2017-06-22 07:59:09 -0700
commit917d3bfa6593c9a85c81b674770aec2ca404a4a2 (patch)
treeff279590a68c00714889d1667da9739f7e7cbd9a /src/generate-names.cc
parentc0ae2e69b53f12e57833270e1b48a01864fb5156 (diff)
downloadwabt-917d3bfa6593c9a85c81b674770aec2ca404a4a2.tar.gz
wabt-917d3bfa6593c9a85c81b674770aec2ca404a4a2.tar.bz2
wabt-917d3bfa6593c9a85c81b674770aec2ca404a4a2.zip
Fix the validator to be able to validate exception handling constructs. (#514)
* Save state. * Add exception declaration syntax. * Extend validator to handle exception declarations. * Fix binary writer to handle exception declarations. * Fix code to handle external exception kind. * Regenerate lexer. * Fix bug with last merge. * Add exception declarations, and add examples. * Fix nits. * Initial extensions for expr visitor. * Save state. * Fix issues with master merge. * Reconcile issues with merge of tools wast2wasm and wast-desugar. * Save state. * Save work to move to mtv. * Fix resolving names on try/throw constructs. * Completed implementation of validation for exception handling. * Fix nits. * Combine Catch and CatchAll in IR. * Remove tryblock visitors. * Clean up to only use one visitor for each catch. * Rework the structure of try blocks and catches. * Remove the need for common CLI options. * Fix issues raised by binji. * Fix re2c generated file. * Fix memory leak, and fix nits.
Diffstat (limited to 'src/generate-names.cc')
-rw-r--r--src/generate-names.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/generate-names.cc b/src/generate-names.cc
index 258d9b05..0f1a39da 100644
--- a/src/generate-names.cc
+++ b/src/generate-names.cc
@@ -65,6 +65,7 @@ class NameGenerator : public ExprVisitor::DelegateNop {
Result VisitFuncType(Index func_type_index, FuncType* func_type);
Result VisitTable(Index table_index, Table* table);
Result VisitMemory(Index memory_index, Memory* memory);
+ Result VisitExcept(Index except_index, Exception* except);
Module* module_ = nullptr;
ExprVisitor visitor_;
@@ -191,6 +192,12 @@ Result NameGenerator::VisitMemory(Index memory_index, Memory* memory) {
return Result::Ok;
}
+Result NameGenerator::VisitExcept(Index except_index, Exception* except) {
+ MaybeGenerateAndBindName(&module_->except_bindings, "$e", except_index,
+ &except->name);
+ return Result::Ok;
+}
+
Result NameGenerator::VisitModule(Module* module) {
module_ = module;
for (Index i = 0; i < module->globals.size(); ++i)
@@ -203,6 +210,8 @@ Result NameGenerator::VisitModule(Module* module) {
CHECK_RESULT(VisitTable(i, module->tables[i]));
for (Index i = 0; i < module->memories.size(); ++i)
CHECK_RESULT(VisitMemory(i, module->memories[i]));
+ for (Index i = 0; i < module->excepts.size(); ++i)
+ CHECK_RESULT(VisitExcept(i, module->excepts[i]));
module_ = nullptr;
return Result::Ok;
}