Example #1
0
        public DynamicCallSiteInfo InitializeCallSite(FieldReference storageField, string bindingType, TypeReference targetType, JSExpression[] arguments)
        {
            DynamicCallSiteInfo callSiteInfo;

            switch (bindingType)
            {
            case "GetIndex":
                callSiteInfo = new DynamicCallSiteInfo.GetIndex(targetType, arguments);
                break;

            case "SetIndex":
                callSiteInfo = new DynamicCallSiteInfo.SetIndex(targetType, arguments);
                break;

            case "GetMember":
                callSiteInfo = new DynamicCallSiteInfo.GetMember(targetType, arguments);
                break;

            case "SetMember":
                callSiteInfo = new DynamicCallSiteInfo.SetMember(targetType, arguments);
                break;

            case "Invoke":
                callSiteInfo = new DynamicCallSiteInfo.Invoke(targetType, arguments);
                break;

            case "InvokeMember":
                callSiteInfo = new DynamicCallSiteInfo.InvokeMember(targetType, arguments);
                break;

            case "UnaryOperation":
                callSiteInfo = new DynamicCallSiteInfo.UnaryOperation(targetType, arguments);
                break;

            case "BinaryOperation":
                callSiteInfo = new DynamicCallSiteInfo.BinaryOperation(targetType, arguments);
                break;

            case "Convert":
                callSiteInfo = new DynamicCallSiteInfo.Convert(targetType, arguments);
                break;

            default:
                throw new NotImplementedException(String.Format("Call sites of type '{0}' not implemented.", bindingType));
            }

            return(CallSites[storageField.FullName] = callSiteInfo);
        }
Example #2
0
        public DynamicCallSiteInfo InitializeCallSite (FieldReference storageField, string bindingType, TypeReference targetType, JSExpression[] arguments) {
            DynamicCallSiteInfo callSiteInfo;

            switch (bindingType) {
                case "GetIndex":
                    callSiteInfo = new DynamicCallSiteInfo.GetIndex(targetType, arguments);
                break;
                case "SetIndex":
                    callSiteInfo = new DynamicCallSiteInfo.SetIndex(targetType, arguments);
                break;
                case "GetMember":
                    callSiteInfo = new DynamicCallSiteInfo.GetMember(targetType, arguments);
                break;
                case "SetMember":
                    callSiteInfo = new DynamicCallSiteInfo.SetMember(targetType, arguments);
                break;
                case "Invoke":
                    callSiteInfo = new DynamicCallSiteInfo.Invoke(targetType, arguments);
                break;
                case "InvokeMember":
                    callSiteInfo = new DynamicCallSiteInfo.InvokeMember(targetType, arguments);
                break;
                case "UnaryOperation":
                    callSiteInfo = new DynamicCallSiteInfo.UnaryOperation(targetType, arguments);
                break;
                case "BinaryOperation":
                    callSiteInfo = new DynamicCallSiteInfo.BinaryOperation(targetType, arguments);
                break;
                case "Convert":
                    callSiteInfo = new DynamicCallSiteInfo.Convert(targetType, arguments);
                break;
                default:
                    throw new NotImplementedException(String.Format("Call sites of type '{0}' not implemented.", bindingType));
            }

            return CallSites[storageField.FullName] = callSiteInfo;
        }