Skip to content

Commit 9f5564b

Browse files
committed
arg exception fix
1 parent bb5b8d0 commit 9f5564b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Peachpie.CodeAnalysis/CodeGen/Symbols/SourceTypeSymbol.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,19 @@ void EmitPhpCallable(Emit.PEModuleBuilder module, DiagnosticBag diagnostics)
8888
// IPhpCallable.Invoke(Context <ctx>, PhpVaue[] arguments)
8989
//
9090

91-
// TODO: Switch to the Span based Invoke
92-
static bool IsArrayOverload(Symbol member)
91+
// TODO: Switch to the Span based Invoke(Context, ReadOnlySpan<PhpValue>)
92+
static bool Is_Invoke_Context_PhpValueArray(Symbol member)
9393
{
94-
return member is MethodSymbol method && method.Parameters[1].Type.IsArray();
94+
return
95+
member is MethodSymbol method &&
96+
method.Parameters.Length == 2 &&
97+
method.Parameters[1].Type.Is_PhpValueArray()
98+
;
9599
}
96100

97101
var invoke = new SynthesizedMethodSymbol(this, iphpcallable.FullName + ".Invoke", false, true, DeclaringCompilation.CoreTypes.PhpValue, isfinal: true)
98102
{
99-
ExplicitOverride = (MethodSymbol)iphpcallable.Symbol.GetMembers("Invoke").Single(IsArrayOverload),
103+
ExplicitOverride = (MethodSymbol)iphpcallable.Symbol.GetMembers("Invoke").Single(Is_Invoke_Context_PhpValueArray),
100104
ForwardedCall = __invoke,
101105
};
102106
invoke.SetParameters(

0 commit comments

Comments
 (0)