Open anasuti opened 6 years ago
Hi, I think this should be solved in the listener as it is not always easy to differentiate constructors from other functions. Destructors have their special prefix ~ so they are easy to catch, while for constructors I suggest making your own checks.
seems like the following c++ codeit is difficult to understand ctor and dtor declarations. This is the grammar I used: CPP14.g4 This is the constructor of the class DataComponent:
DataComponent::DataComponent(constchar*instanceId,PortableServer::POA_ptrpoa):poa(PortableServer::POA::_duplicate(poa)),initialized(0),started(0),ipDataInPort(NULL),ipCtrlOutPort(NULL),fsOutPort(NULL),notifOutPort(NULL) { this->resourceID=newchar[strlen(instanceId)+1]; strcpy(this->resourceID,instanceId); }
in the Listener enterFunctiondefinition we have the following:
attributespecifierseq= null declspecifierseq= DataComponent declarator= ::SDRLabWFDataComponent(constchar*instanceId,PortableServer::POA_ptrpoa) virtspecifierseq= null
how can the grammar understand if this is a ctor? same for destructor