Esempio n. 1
0
 public Microsoft.FSharp.Quotations.FSharpExpr GetInvokerExpression(MethodBase syntheticMethodBase, Microsoft.FSharp.Quotations.FSharpExpr[] parameters)
 {
     Helpers.TraceCall();
     if (syntheticMethodBase is System.Reflection.ConstructorInfo)
     {
         Debug.Assert(false, "NYI");
         throw new NotImplementedException();
     }
     else if (syntheticMethodBase is System.Reflection.MethodInfo)
     {
         var am = syntheticMethodBase as ArtificialMethodInfo;
         if (am.DeclaringType.FullName == "N.T" && am.Name == "M")
         {
             return(FSharpExpr.Lambda(FSharpVar.Global("", typeof(int[])), FSharpExpr.Value <int[]>(new[] { 1, 2, 3 })));
         }
         else
         {
             Debug.Assert(false, "NYI");
             throw new NotImplementedException();
         }
     }
     else
     {
         Debug.Assert(false, "GetInvokerExpression() invoked with neither ConstructorInfo nor MethodInfo!");
         return(null);
     }
 }
Esempio n. 2
0
        public FSharpExpr GetInvokerExpression(System.Reflection.MethodBase syntheticMethodBase, FSharpExpr[] parameters)
        {
            if (syntheticMethodBase is System.Reflection.ConstructorInfo)
            {
                var ac = syntheticMethodBase as ArtificialConstructorInfo;
                if (ac.DeclaringType.FullName == "N.T")
                {
                    return(FSharpExpr.DefaultValue(ac.DeclaringType.BaseType));
                }
                Debug.Assert(false, "NYI");
                throw new NotImplementedException();
            }
            else if (syntheticMethodBase is System.Reflection.MethodInfo)
            {
                var am = syntheticMethodBase as ArtificialMethodInfo;
                if (am.DeclaringType.FullName == "N.T" && am.Name == "M")
                {
                    return(FSharpExpr.Lambda(FSharpVar.Global("", typeof(int[])), FSharpExpr.Value <int[]>(new[] { 1, 2, 3 })));
                }
                else if (am.DeclaringType.FullName == "N.T" && am.Name == "get_StaticProp")
                {
                    return(FSharpExpr.Lambda(FSharpVar.Global("", typeof(decimal)), FSharpExpr.Value <decimal>(4.2M)));
                }
                else if (am.DeclaringType.FullName == "N.T" && am.Name == "add_Event1")
                {
                    // Dummy expr... since we do not care about what it really does...
                    return(FSharpExpr.Lambda(FSharpVar.Global("", typeof(int)), FSharpExpr.Value <int>(1)));
                }
                else if (am.DeclaringType.FullName == "N.T" && am.Name == "remove_Event1")
                {
                    // Dummy expr... since we do not care about what it really does...
                    return(FSharpExpr.Lambda(FSharpVar.Global("", typeof(int)), FSharpExpr.Value <int>(1)));
                }
                else
                {
                    Debug.Assert(false, "NYI");
                    throw new NotImplementedException();
                }
            }
            else
            {
                Debug.Assert(false, "GetInvokerExpression() invoked with neither ConstructorInfo nor MethodInfo!");
                return(null);
            }
            //Expression<Func<S>> e = () => new S(9);
            //return e.Body;

            //throw new NotImplementedException();
        }
Esempio n. 3
0
        public Microsoft.FSharp.Quotations.FSharpExpr GetInvokerExpression(MethodBase syntheticMethodBase, Microsoft.FSharp.Quotations.FSharpExpr[] parameters)
        {
            Helpers.TraceCall();
            if (syntheticMethodBase is System.Reflection.ConstructorInfo)
            {
                var ac = syntheticMethodBase as ArtificialConstructorInfo;
                if (ac.DeclaringType.FullName == "N.T")
                {
                    return(FSharpExpr.DefaultValue(ac.DeclaringType.BaseType));
                }
                Debug.Assert(false, "NYI");
                throw new NotImplementedException();
            }
            else if (syntheticMethodBase is System.Reflection.MethodInfo)
            {
                var am = syntheticMethodBase as ArtificialMethodInfo;
                if (am.DeclaringType.FullName == "N.T" && am.Name == "M")
                {
                    return(FSharpExpr.Lambda(FSharpVar.Global("", typeof(int[])), FSharpExpr.Value <int[]>(new[] { 1, 2, 3 })));
                }
                else if (am.DeclaringType.FullName == "N.T" && am.Name == "get_StaticProp")
                {
                    return(FSharpExpr.Lambda(FSharpVar.Global("", typeof(decimal)), FSharpExpr.Value <decimal>(4.2M)));
                }
                else
                {
                    Debug.Assert(false, "NYI");
                    throw new NotImplementedException();
                }
            }
            else
            {
                Debug.Assert(false, "GetInvokerExpression() invoked with neither ConstructorInfo nor MethodInfo!");
                return(null);
            }
            //Expression<Func<S>> e = () => new S(9);
            //return e.Body;

            //throw new NotImplementedException();
        }
Esempio n. 4
0
        public Microsoft.FSharp.Quotations.FSharpExpr GetInvokerExpression(MethodBase syntheticMethodBase, Microsoft.FSharp.Quotations.FSharpExpr[] parameters)
        {
            Helpers.TraceCall();
            if (syntheticMethodBase is System.Reflection.ConstructorInfo)
            {
                var ac = syntheticMethodBase as ArtificialConstructorInfo;
                if (ac.DeclaringType.FullName == "N.T")
                {
                    return(FSharpExpr.DefaultValue(ac.DeclaringType.BaseType));
                }
                Debug.Assert(false, "NYI");
                throw new NotImplementedException();
            }
            else if (syntheticMethodBase is System.Reflection.MethodInfo)
            {
                var am = syntheticMethodBase as ArtificialMethodInfo;
                if (am.DeclaringType.FullName == "N.T" && am.Name == "M")
                {
                    var plist = ListModule.OfArray(new[] { FSharpExpr.Value(1), FSharpExpr.Value(2), FSharpExpr.Value(3) });
                    return(FSharpExpr.NewArray(typeof(int), plist));
                }
                else if (am.DeclaringType.FullName == "N.T" && am.Name == "get_StaticProp1")
                {
                    return(FSharpExpr.Lambda(FSharpVar.Global("", typeof(decimal)), FSharpExpr.Value <decimal>(4.2M)));
                }
                else if (am.DeclaringType.FullName == "N.T" && am.Name == "get_StaticProp2")
                {
                    return(FSharpExpr.Lambda(FSharpVar.Global("", typeof(System.Tuple <int, int, int, int, int, int, int, System.Tuple <int, int, int> >)), FSharpExpr.Value <System.Tuple <int, int, int, int, int, int, int, System.Tuple <int, int, int> > >(new System.Tuple <int, int, int, int, int, int, int, System.Tuple <int, int, int> >(1, 2, 3, 4, 5, 6, 7, new Tuple <int, int, int>(8, 9, 10)))));
                }
                else if (am.DeclaringType.FullName == "N.T" && am.Name == "get_StaticProp3")
                {
                    return(FSharpExpr.Lambda(FSharpVar.Global("", typeof(System.Tuple <int, int, int>)), FSharpExpr.Value <System.Tuple <int, int, int> >(new Tuple <int, int, int>(1, 2, 3))));
                }
                else if (am.DeclaringType.FullName == "N.T" && am.Name == "RaiseEvent1")
                {
                    Debug.Assert(false, "NYI");
                    throw new NotImplementedException();
                }
                else if (am.DeclaringType.FullName == "N.T" && am.Name == "M1")
                {
                    var plist = ListModule.OfArray(new[] { FSharpExpr.Value(1), FSharpExpr.Value(2), FSharpExpr.Value(3) });
                    return(FSharpExpr.NewArray(typeof(int), plist));
                }
                else if (am.DeclaringType.FullName == "N.I1" && am.Name == "M")
                {
                    var plist = ListModule.OfArray(new[] { FSharpExpr.Value(1), FSharpExpr.Value(2), FSharpExpr.Value(3) });
                    return(FSharpExpr.NewArray(typeof(int), plist));
                }
                else
                {
                    Debug.Assert(false, "NYI");
                    throw new NotImplementedException();
                }
            }
            else
            {
                Debug.Assert(false, "GetInvokerExpression() invoked with neither ConstructorInfo nor MethodInfo!");
                return(null);
            }
            //Expression<Func<S>> e = () => new S(9);
            //return e.Body;

            //throw new NotImplementedException();
        }