mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2024-12-22 22:16:38 +08:00
fix tars2node bug for json_support
This commit is contained in:
parent
f5240831e3
commit
4721f4ffc3
@ -212,15 +212,42 @@ string CodeGenerator::generateDispatch(const NamespacePtr &nPtr, const Interface
|
||||
{
|
||||
if (vParamDecl[i]->isOut())
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
//_data_.rsp ? rsp.readFromObject(_data_.rsp) : rsp;
|
||||
StructPtr sPtr = StructPtr::dynamicCast(vParamDecl[i]->getTypeIdPtr()->getTypePtr());
|
||||
if (sPtr)
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< " = " << getDefault(vParamDecl[i]->getTypeIdPtr(), "", nPtr->getId(), true)
|
||||
<< ";" << endl;
|
||||
dstr << TAB << "_data_." << vParamDecl[i]->getTypeIdPtr()->getId() << " ? " << vParamDecl[i]->getTypeIdPtr()->getId() << ".readFromObject("
|
||||
<< "_data_." << vParamDecl[i]->getTypeIdPtr()->getId() << ") : " << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< ";" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< " = _data_." << vParamDecl[i]->getTypeIdPtr()->getId() << " || " << getDefault(vParamDecl[i]->getTypeIdPtr(), "", nPtr->getId(), true)
|
||||
<< ";" << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< " = _data_." << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< ";" << endl;
|
||||
StructPtr sPtr = StructPtr::dynamicCast(vParamDecl[i]->getTypeIdPtr()->getTypePtr());
|
||||
if (sPtr)
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< " = " << getDefault(vParamDecl[i]->getTypeIdPtr(), "", nPtr->getId(), true)
|
||||
<< ";" << endl;
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId() << ".readFromObject("
|
||||
<< "_data_." << vParamDecl[i]->getTypeIdPtr()->getId() << ")"
|
||||
<< ";" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< " = _data_." << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< ";" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
DEL_TAB;
|
||||
|
@ -200,15 +200,41 @@ string CodeGenerator::generateTSServerDispatch(const NamespacePtr &nPtr, const I
|
||||
{
|
||||
if (vParamDecl[i]->isOut())
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
StructPtr sPtr = StructPtr::dynamicCast(vParamDecl[i]->getTypeIdPtr()->getTypePtr());
|
||||
if (sPtr)
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< " = " << getDefault(vParamDecl[i]->getTypeIdPtr(), "", nPtr->getId(), true)
|
||||
<< ";" << endl;
|
||||
dstr << TAB << "_data_." << vParamDecl[i]->getTypeIdPtr()->getId() << " ? " << vParamDecl[i]->getTypeIdPtr()->getId() << ".readFromObject("
|
||||
<< "_data_." << vParamDecl[i]->getTypeIdPtr()->getId() << ") : " << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< ";" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< " = _data_." << vParamDecl[i]->getTypeIdPtr()->getId() << " || " << getDefault(vParamDecl[i]->getTypeIdPtr(), "", nPtr->getId(), true)
|
||||
<< ";" << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< " = _data_." << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< ";" << endl;
|
||||
StructPtr sPtr = StructPtr::dynamicCast(vParamDecl[i]->getTypeIdPtr()->getTypePtr());
|
||||
if (sPtr)
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< " = " << getDefault(vParamDecl[i]->getTypeIdPtr(), "", nPtr->getId(), true)
|
||||
<< ";" << endl;
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId() << ".readFromObject("
|
||||
<< "_data_." << vParamDecl[i]->getTypeIdPtr()->getId() << ")"
|
||||
<< ";" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< " = _data_." << vParamDecl[i]->getTypeIdPtr()->getId()
|
||||
<< ";" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
DEL_TAB;
|
||||
|
Loading…
Reference in New Issue
Block a user