Skip to content

Commit

Permalink
[unreal]蓝图参数处理逻辑改为和引擎ScriptCore.cpp一致
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Nov 3, 2021
1 parent 5314dcb commit 448f13b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions unreal/Puerts/Source/JsEnv/Private/FunctionTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,19 @@ void FFunctionTranslator::CallJs(v8::Isolate* Isolate, v8::Local<v8::Context>& C
FOutParmRec** LastOut = nullptr;
if (!Stack.OutParms) LastOut = &Stack.OutParms;
//ScriptCore.cpp
for (TFieldIterator<PropertyMacro> It(Function.Get()); It && Stack.PeekCode() != EX_EndFunctionParms; ++It)
for (FProperty* Property = (FProperty*)(Function->ChildProperties); *Stack.Code != EX_EndFunctionParms; Property = (FProperty*)(Property->Next))
{
It->InitializeValue_InContainer(Params);
checkfSlow(Property, TEXT("NULL Property in Function %s"), *Function->GetPathName());

if( ((It->PropertyFlags & CPF_ReturnParm) != 0) || ((It->PropertyFlags & CPF_Parm) != CPF_Parm) )
Property->InitializeValue_InContainer(Params);

if ((Property->PropertyFlags & CPF_ReturnParm) != 0)
{
continue;
}
Stack.MostRecentPropertyAddress = nullptr;

if ( It->PropertyFlags & CPF_OutParm)
if ( Property->PropertyFlags & CPF_OutParm)
{
Stack.Step(Stack.Object, NULL);

Expand All @@ -386,8 +388,8 @@ void FFunctionTranslator::CallJs(v8::Isolate* Isolate, v8::Local<v8::Context>& C
CA_SUPPRESS(6263)
FOutParmRec* Out = (FOutParmRec*)FMemory_Alloca(sizeof(FOutParmRec));
ensure(Stack.MostRecentPropertyAddress);
Out->PropAddr = (Stack.MostRecentPropertyAddress != NULL) ? Stack.MostRecentPropertyAddress : It->ContainerPtrToValuePtr<uint8>(Params);
Out->Property = *It;
Out->PropAddr = (Stack.MostRecentPropertyAddress != NULL) ? Stack.MostRecentPropertyAddress : Property->ContainerPtrToValuePtr<uint8>(Params);
Out->Property = Property;

if (*LastOut)
{
Expand All @@ -402,7 +404,7 @@ void FFunctionTranslator::CallJs(v8::Isolate* Isolate, v8::Local<v8::Context>& C
}
else
{
Stack.Step(Stack.Object, It->ContainerPtrToValuePtr<uint8>(Params));
Stack.Step(Stack.Object, Property->ContainerPtrToValuePtr<uint8>(Params));
}
}
}
Expand Down

0 comments on commit 448f13b

Please sign in to comment.