@@ -289,26 +289,17 @@ namespace eosio { namespace cdt {
289
289
290
290
virtual bool VisitCXXMethodDecl (CXXMethodDecl* decl) {
291
291
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
295
292
if (decl->isEosioAction ()) {
296
293
name = generation_utils::get_action_name (decl);
297
294
validate_name (name, [&](auto s) {
298
295
CDT_ERROR (" codegen_error" , decl->getLocation (), std::string (" action name (" )+s+" ) is not a valid eosio name" );
299
296
});
300
297
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
- }
307
298
std::string full_action_name = decl->getNameAsString () + ((decl->getParent ()) ? decl->getParent ()->getNameAsString () : " " );
308
299
if (cg.actions .count (full_action_name) == 0 ) {
309
300
create_action_dispatch (decl);
301
+ cg.actions .insert (full_action_name); // insert the method action, so we don't create the dispatcher twice
310
302
}
311
- cg.actions .insert (full_action_name); // insert the method action, so we don't create the dispatcher twice
312
303
313
304
if (decl->isEosioReadOnly ()) {
314
305
read_only_actions.insert (decl);
@@ -326,18 +317,11 @@ namespace eosio { namespace cdt {
326
317
CDT_ERROR (" codegen_error" , decl->getLocation (), std::string (" name (" )+s+" ) is invalid" );
327
318
});
328
319
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
-
336
320
std::string full_notify_name = decl->getNameAsString () + ((decl->getParent ()) ? decl->getParent ()->getNameAsString () : " " );
337
321
if (cg.notify_handlers .count (full_notify_name) == 0 ) {
338
322
create_notify_dispatch (decl);
323
+ cg.notify_handlers .insert (full_notify_name); // insert the method action, so we don't create the dispatcher twice
339
324
}
340
- cg.notify_handlers .insert (full_notify_name); // insert the method action, so we don't create the dispatcher twice
341
325
}
342
326
343
327
// We allow a method to be tagged as both `action` and `call`
@@ -347,17 +331,11 @@ namespace eosio { namespace cdt {
347
331
CDT_ERROR (" codegen_error" , decl->getLocation (), std::string (" call name (" )+s+" ) is not a valid eosio name" );
348
332
});
349
333
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
- }
356
334
std::string full_call_name = decl->getNameAsString () + ((decl->getParent ()) ? decl->getParent ()->getNameAsString () : " " );
357
335
if (cg.calls .count (full_call_name) == 0 ) {
358
336
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
359
338
}
360
- cg.calls .insert (full_call_name); // insert the method call, so we don't create the dispatcher twice
361
339
}
362
340
363
341
return true ;
0 commit comments