Skip to content

Commit

Permalink
Merge pull request #913 from throw-out/fix_optional_param_match fix #912
Browse files Browse the repository at this point in the history


[unity]fix:reflection invoke optional param match
  • Loading branch information
zombieyang committed Jul 15, 2022
2 parents a8e8fdc + 9eeed32 commit 7b5ccbb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions unity/Assets/Puerts/Runtime/Src/Wrapper/ReflectionWrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public Parameters(ParameterInfo[] parameterInfos, GeneralGetterManager generalGe
byRefValueSetFuncs = new GeneralSetter[parameterInfos.Length];
paramIsByRef = new bool[parameterInfos.Length];
isOut = new bool[parameterInfos.Length];
optionalParamPos = this.paramLength + 1;
optionalParamPos = this.paramLength;
for (int i = 0; i < parameterInfos.Length; i++)
{
var parameterInfo = parameterInfos[i];
Expand Down Expand Up @@ -109,7 +109,7 @@ public Parameters(ParameterInfo[] parameterInfos, GeneralGetterManager generalGe

public bool IsMatch(JSCallInfo jsCallInfo)
{
if (hasParamsArray && optionalParamPos > paramLength)
if (hasParamsArray && optionalParamPos >= paramLength)
{
if (jsCallInfo.Length < paramLength - 1)
{
Expand All @@ -120,7 +120,7 @@ public bool IsMatch(JSCallInfo jsCallInfo)
{
return false;
}
else if (jsCallInfo.Length < optionalParamPos - 1)
else if (jsCallInfo.Length < optionalParamPos)
{
return false;
}
Expand Down

0 comments on commit 7b5ccbb

Please sign in to comment.