tars2node js fix JSON_VERSION support bug

This commit is contained in:
kivenchen 2021-10-13 18:59:14 +08:00
parent d488739c3c
commit b3c317fbd1
2 changed files with 37 additions and 4 deletions

Binary file not shown.

View File

@ -211,18 +211,51 @@ string CodeGenerator::generateDispatch(const NamespacePtr &nPtr, const Interface
for (size_t i = 0; i < vParamDecl.size(); i++)
{
if (vParamDecl[i]->isOut())
{
//taf_data.rsp ? rsp.readFromObject(taf_data.rsp) : rsp;
StructPtr sPtr = StructPtr::dynamicCast(vParamDecl[i]->getTypeIdPtr()->getTypePtr());
if (sPtr)
{
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
<< " = _data_." << vParamDecl[i]->getTypeIdPtr()->getId() << " || " << getDefault(vParamDecl[i]->getTypeIdPtr(), "", nPtr->getId(), true)
<< " = " << 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;
}
// 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 << "var " << 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 << "var " << vParamDecl[i]->getTypeIdPtr()->getId()
<< " = _data_." << vParamDecl[i]->getTypeIdPtr()->getId()
<< ";" << endl;
}
}
}
DEL_TAB;
//// =========