+ void checkAllReactMethods(const CXXRecordDecl *SrcState)
+ {
+ unsigned i = 0;
+ IdentifierInfo& II = ASTCtx->Idents.get("react");
+ for (DeclContext::lookup_const_result ReactRes = SrcState->lookup(DeclarationName(&II));
+ ReactRes.first != ReactRes.second; ++ReactRes.first, ++i) {
+ if (i >= reactMethodInReactions.size() || reactMethodInReactions[i] == false) {
+ CXXMethodDecl *React = dyn_cast<CXXMethodDecl>(*ReactRes.first);
+ Diag(React->getParamDecl(0)->getLocStart(), diag_warning)
+ << React->getParamDecl(0)->getType().getAsString() << " missing in typedef reactions";
+ }
+ }
+ }
+
+ bool HandleCustomReaction(const CXXRecordDecl *SrcState, const Type *EventType)
+ {
+ unsigned i = 0;
+ IdentifierInfo& II = ASTCtx->Idents.get("react");
+ // TODO: Lookup for react even in base classes - probably by using Sema::LookupQualifiedName()
+ for (DeclContext::lookup_const_result ReactRes = SrcState->lookup(DeclarationName(&II));
+ ReactRes.first != ReactRes.second; ++ReactRes.first) {
+ if (CXXMethodDecl *React = dyn_cast<CXXMethodDecl>(*ReactRes.first)) {
+ if (React->getNumParams() >= 1) {
+ const ParmVarDecl *p = React->getParamDecl(0);
+ const Type *ParmType = p->getType().getTypePtr();
+ if (i == reactMethodInReactions.size()) reactMethodInReactions.push_back(false);
+ if (ParmType->isLValueReferenceType())
+ ParmType = dyn_cast<LValueReferenceType>(ParmType)->getPointeeType().getTypePtr();
+ if (ParmType == EventType) {
+ FindTransitVisitor(model, SrcState, EventType).TraverseStmt(React->getBody());
+ reactMethodInReactions[i] = true;
+ return true;
+ }
+ } else
+ Diag(React->getLocStart(), diag_warning)
+ << React << "has not a parameter";
+ } else
+ Diag((*ReactRes.first)->getSourceRange().getBegin(), diag_warning)
+ << (*ReactRes.first)->getDeclKindName() << "is not supported as react method";
+ i++;
+ }
+ return false;
+ }
+