private EXPR DispatchPayload(
DynamicMetaObjectBinder payload,
ArgumentObject[] arguments,
Dictionary<int, LocalVariableSymbol> dictionary)
{
EXPR pResult = null;
if (payload is CSharpBinaryOperationBinder)
{
pResult = BindBinaryOperation(payload as CSharpBinaryOperationBinder, arguments, dictionary);
}
else if (payload is CSharpUnaryOperationBinder)
{
pResult = BindUnaryOperation(payload as CSharpUnaryOperationBinder, arguments, dictionary);
}
else if (payload is CSharpSetMemberBinder)
{
pResult = BindAssignment(payload as CSharpSetMemberBinder, arguments, dictionary);
}
else if (payload is CSharpConvertBinder)
{
Debug.Assert(arguments.Length == 1);
{
CSharpConvertBinder conversion = payload as CSharpConvertBinder;
switch (conversion.ConversionKind)
{
case CSharpConversionKind.ImplicitConversion:
pResult = BindImplicitConversion(arguments, conversion.Type, dictionary, false);
break;
case CSharpConversionKind.ExplicitConversion:
pResult = BindExplicitConversion(arguments, conversion.Type, dictionary);
break;
case CSharpConversionKind.ArrayCreationConversion:
pResult = BindImplicitConversion(arguments, conversion.Type, dictionary, true);
break;
default:
Debug.Assert(false, "Unknown conversion kind");
throw Error.InternalCompilerError();
}
}
}
else if (payload is ICSharpInvokeOrInvokeMemberBinder)
{
EXPR callingObject = CreateCallingObjectForCall(payload as ICSharpInvokeOrInvokeMemberBinder, arguments, dictionary);
pResult = BindCall(payload as ICSharpInvokeOrInvokeMemberBinder, callingObject, arguments, dictionary);
}
else if (payload is CSharpGetMemberBinder)
{
Debug.Assert(arguments.Length == 1);
pResult = BindProperty(payload, arguments[0], dictionary[0], null, false);
}
else if (payload is CSharpGetIndexBinder)
{
EXPR indexerArguments = CreateArgumentListEXPR(arguments, dictionary, 1, arguments.Length);
pResult = BindProperty(payload, arguments[0], dictionary[0], indexerArguments, false);
}
else if (payload is CSharpSetIndexBinder)
{
pResult = BindAssignment(payload as CSharpSetIndexBinder, arguments, dictionary);
}
else if (payload is CSharpIsEventBinder)
{
pResult = BindIsEvent(payload as CSharpIsEventBinder, arguments, dictionary);
}
else
{
Debug.Assert(false, "Unknown payload kind");
throw Error.InternalCompilerError();
}
return pResult;
}