jroesch commented on a change in pull request #6274:
URL: https://github.com/apache/incubator-tvm/pull/6274#discussion_r493098856
##########
File path: src/parser/parser.cc
##########
@@ -661,15 +754,21 @@ class Parser {
Consume(TokenType::kDefn);
auto global_tok = Match(TokenType::kGlobal);
auto global_name = global_tok.ToString();
- auto global = GlobalVar(global_name);
- try {
- global_names.Add(global_name, global);
- } catch (const DuplicateKeyError& e) {
- this->diag_ctx->Emit(Diagnostic::Error(global_tok->span) << "a
function with the name "
- << "`@"
<< global_name << "` "
- << "was
previously defined");
- }
- auto func = ParseFunctionDef();
+ auto global = AddOrGet(&global_names, global_name);
+ auto func = WithSpan<relay::Function>([&]() {
+ // try {
Review comment:
Fix the error handling around this, was blanket catching exceptions
earlier which is an issue.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]