Return error status when number of operands don't match while parsing.
Previously an error would be emitted but parsing would continue as false was being returned.
PiperOrigin-RevId: 212192167
diff --git a/lib/Parser/Parser.cpp b/lib/Parser/Parser.cpp
index cde5341..3a817e9 100644
--- a/lib/Parser/Parser.cpp
+++ b/lib/Parser/Parser.cpp
@@ -1832,8 +1832,8 @@
}
if (requiredOperandCount != -1 && result.size() != requiredOperandCount)
- emitError(startLoc,
- "expected " + Twine(requiredOperandCount) + " operands");
+ return emitError(startLoc,
+ "expected " + Twine(requiredOperandCount) + " operands");
return false;
}