Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
aheejin committed Oct 7, 2024
1 parent 0524e12 commit 9f75c90
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,22 +371,17 @@ bool WebAssemblyAsmTypeCheck::checkTryTable(SMLoc ErrorLoc,
if (Level < BlockInfoStack.size()) {
const auto &DestBlockInfo =
BlockInfoStack[BlockInfoStack.size() - Level - 1];
if (DestBlockInfo.IsLoop) {
if (compareTypes(SentTypes, DestBlockInfo.Sig.Params)) {
std::string ErrorMsg =
ErrorMsgBase + "type mismatch, catch tag type is " +
getTypesString(SentTypes) + ", but destination's type is " +
getTypesString(DestBlockInfo.Sig.Params);
Error |= typeError(ErrorLoc, ErrorMsg);
}
} else {
if (compareTypes(SentTypes, DestBlockInfo.Sig.Returns)) {
std::string ErrorMsg =
ErrorMsgBase + "type mismatch, catch tag type is " +
getTypesString(SentTypes) + ", but destination's type is " +
getTypesString(DestBlockInfo.Sig.Returns);
Error |= typeError(ErrorLoc, ErrorMsg);
}
ArrayRef<wasm::ValType> DestTypes;
if (DestBlockInfo.IsLoop)
DestTypes = DestBlockInfo.Sig.Params;
else
DestTypes = DestBlockInfo.Sig.Returns;
if (compareTypes(SentTypes, DestTypes)) {
std::string ErrorMsg =
ErrorMsgBase + "type mismatch, catch tag type is " +
getTypesString(SentTypes) + ", but destination's type is " +
getTypesString(DestTypes);
Error |= typeError(ErrorLoc, ErrorMsg);
}
} else {
Error = typeError(ErrorLoc, ErrorMsgBase + "invalid depth " +
Expand Down

0 comments on commit 9f75c90

Please sign in to comment.