tars2node js&&ts fix JSON_VERSION support bug

This commit is contained in:
kivenchen 2021-10-13 19:35:44 +08:00
parent b3c317fbd1
commit f5799d8369
3 changed files with 52 additions and 6 deletions

Binary file not shown.

View File

@ -241,7 +241,7 @@ string CodeGenerator::generateDispatch(const NamespacePtr &nPtr, const Interface
StructPtr sPtr = StructPtr::dynamicCast(vParamDecl[i]->getTypeIdPtr()->getTypePtr());
if (sPtr)
{
dstr << TAB << "var " << vParamDecl[i]->getTypeIdPtr()->getId()
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
<< " = " << getDefault(vParamDecl[i]->getTypeIdPtr(), "", nPtr->getId(), true)
<< ";" << endl;
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId() << ".readFromObject("
@ -250,7 +250,7 @@ string CodeGenerator::generateDispatch(const NamespacePtr &nPtr, const Interface
}
else
{
dstr << TAB << "var " << vParamDecl[i]->getTypeIdPtr()->getId()
dstr << TAB << vParamDecl[i]->getTypeIdPtr()->getId()
<< " = _data_." << vParamDecl[i]->getTypeIdPtr()->getId()
<< ";" << endl;
}

View File

@ -198,12 +198,57 @@ string CodeGenerator::generateTSServerDispatch(const NamespacePtr &nPtr, const I
for (size_t i = 0; i < vParamDecl.size(); i++)
{
// if (vParamDecl[i]->isOut())
// {
// 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;
// }
if (vParamDecl[i]->isOut())
{
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;
}
// 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()
@ -211,6 +256,7 @@ string CodeGenerator::generateTSServerDispatch(const NamespacePtr &nPtr, const I
<< ";" << endl;
}
}
}
DEL_TAB;
//// =========