Skip to content

Commit 6bfccfd

Browse files
committed
Remove unneeded code for validating previous declaration match
1 parent 13e3b3b commit 6bfccfd

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

tools/include/eosio/codegen.hpp

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -289,26 +289,17 @@ namespace eosio { namespace cdt {
289289

290290
virtual bool VisitCXXMethodDecl(CXXMethodDecl* decl) {
291291
std::string name = decl->getNameAsString();
292-
static std::set<std::string> _action_set; //used for validations
293-
static std::set<std::string> _notify_set; //used for validations
294-
static std::set<std::string> _call_set; //used for validations
295292
if (decl->isEosioAction()) {
296293
name = generation_utils::get_action_name(decl);
297294
validate_name(name, [&](auto s) {
298295
CDT_ERROR("codegen_error", decl->getLocation(), std::string("action name (")+s+") is not a valid eosio name");
299296
});
300297

301-
if (!_action_set.count(name))
302-
_action_set.insert(name);
303-
else {
304-
auto itr = _action_set.find(name);
305-
CDT_CHECK_ERROR(*itr == name, "codegen_error", decl->getLocation(), "action declaration doesn't match previous declaration");
306-
}
307298
std::string full_action_name = decl->getNameAsString() + ((decl->getParent()) ? decl->getParent()->getNameAsString() : "");
308299
if (cg.actions.count(full_action_name) == 0) {
309300
create_action_dispatch(decl);
301+
cg.actions.insert(full_action_name); // insert the method action, so we don't create the dispatcher twice
310302
}
311-
cg.actions.insert(full_action_name); // insert the method action, so we don't create the dispatcher twice
312303

313304
if (decl->isEosioReadOnly()) {
314305
read_only_actions.insert(decl);
@@ -326,18 +317,11 @@ namespace eosio { namespace cdt {
326317
CDT_ERROR("codegen_error", decl->getLocation(), std::string("name (")+s+") is invalid");
327318
});
328319

329-
if (!_notify_set.count(name))
330-
_notify_set.insert(name);
331-
else {
332-
auto itr = _notify_set.find(name);
333-
CDT_CHECK_ERROR(*itr == name, "codegen_error", decl->getLocation(), "action declaration doesn't match previous declaration");
334-
}
335-
336320
std::string full_notify_name = decl->getNameAsString() + ((decl->getParent()) ? decl->getParent()->getNameAsString() : "");
337321
if (cg.notify_handlers.count(full_notify_name) == 0) {
338322
create_notify_dispatch(decl);
323+
cg.notify_handlers.insert(full_notify_name); // insert the method action, so we don't create the dispatcher twice
339324
}
340-
cg.notify_handlers.insert(full_notify_name); // insert the method action, so we don't create the dispatcher twice
341325
}
342326

343327
// We allow a method to be tagged as both `action` and `call`
@@ -347,17 +331,11 @@ namespace eosio { namespace cdt {
347331
CDT_ERROR("codegen_error", decl->getLocation(), std::string("call name (")+s+") is not a valid eosio name");
348332
});
349333

350-
if (!_call_set.count(name))
351-
_call_set.insert(name);
352-
else {
353-
auto itr = _call_set.find(name);
354-
CDT_CHECK_ERROR(*itr == name, "codegen_error", decl->getLocation(), "call declaration doesn't match previous declaration");
355-
}
356334
std::string full_call_name = decl->getNameAsString() + ((decl->getParent()) ? decl->getParent()->getNameAsString() : "");
357335
if (cg.calls.count(full_call_name) == 0) {
358336
create_call_dispatch(decl);
337+
cg.calls.insert(full_call_name); // insert the sync call method name, so we don't create the dispatcher twice
359338
}
360-
cg.calls.insert(full_call_name); // insert the method call, so we don't create the dispatcher twice
361339
}
362340

363341
return true;

0 commit comments

Comments
 (0)