@@ -1696,6 +1696,8 @@ let resizeArrays (com: ICompiler) (ctx: Context) r (t: Type) (i: CallInfo) (this
16961696        Helper.LibCall( com,  " Seq" ,  " filter" ,  t,  [ arg;  ar],  ?loc= r)  |>  toArray com t |>  Some
16971697    |  " AddRange" ,  Some ar,  [ arg]  -> 
16981698        Helper.LibCall( com,  " Array" ,  " addRangeInPlace" ,  t,  [ arg;  ar],  ?loc= r)  |>  Some
1699+     |  " GetRange" ,  Some ar,  [ idx;  cnt]  -> 
1700+         Helper.LibCall( com,  " Array" ,  " getSubArray" ,  t,  [ ar;  idx;  cnt],  ?loc= r)  |>  Some
16991701    |  " Contains" ,  Some ( MaybeCasted( ar)),  [ arg]  -> 
17001702        match  ar.Type with 
17011703        |  Array _  -> 
@@ -1803,29 +1805,26 @@ let arrayModule (com: ICompiler) (ctx: Context) r (t: Type) (i: CallInfo) (_: Ex
18031805        Helper.LibCall( com,  " Array" ,  meth,  t,  args,  i.SignatureArgTypes,  ?loc= r)  |>  Some
18041806
18051807let  lists   ( com :  ICompiler )  ( ctx :  Context )  r  ( t :  Type )  ( i :  CallInfo )  ( thisArg :  Expr option )  ( args :  Expr list )  = 
1808+     let  meth  =  Naming.removeGetSetPrefix i.CompiledName |>  Naming.lowerFirst
18061809    match  i.CompiledName,  thisArg,  args with 
1807-     // Use methods for Head and Tail (instead of Get(ListHead) for example) to check for empty lists 
1808-     |  ReplaceName
1809-       [  " get_Head" ,    " head" 
1810-         " get_Tail" ,    " tail" 
1811-         " get_Item" ,    " item" 
1812-         " get_Length" ,  " length" 
1813-         " GetSlice" ,    " slice" ]  methName,  Some x,  _  -> 
1814-             let  args  =  match  args with  [ ExprType Unit]  ->  [ x]  |  args ->  args @  [ x] 
1815-             Helper.LibCall( com,  " List" ,  methName,  t,  args,  i.SignatureArgTypes,  ?loc= r)  |>  Some
1816-     |  " get_IsEmpty" ,  Some x,  _  ->  Test( x,  ListTest false ,  r)  |>  Some
1817-     |  " get_Empty" ,  None,  _  ->  NewList( None,  ( genArg com ctx r 0  i.GenericArgs))  |>  makeValue r |>  Some
1818-     |  " Cons" ,  None,  [ h; t]  ->  NewList( Some( h, t),  ( genArg com ctx r 0  i.GenericArgs))  |>  makeValue r |>  Some
1810+     |  ( " get_Head" |  " get_Tail" |  " get_IsEmpty" |  " get_Length" ),  Some x,  _  -> 
1811+         Helper.LibCall( com,  " List" ,  meth,  t,  [ x],  i.SignatureArgTypes,  ?loc= r)  |>  Some
1812+         // get r t x meth |> Some 
1813+     |  ( " get_Item" |  " GetSlice" ),  Some x,  _  -> 
1814+         Helper.LibCall( com,  " List" ,  meth,  t,  args @  [ x],  i.SignatureArgTypes,  ?loc= r)  |>  Some
1815+     |  ( " get_Empty" |  " Cons" ),  None,  _  -> 
1816+         Helper.LibCall( com,  " List" ,  meth,  t,  args,  i.SignatureArgTypes,  ?loc= r)  |>  Some
18191817    |  ( " GetHashCode" |  " Equals" |  " CompareTo" ),  Some callee,  _  -> 
18201818        Helper.InstanceCall( callee,  i.CompiledName,  t,  args,  i.SignatureArgTypes,  ?loc= r)  |>  Some
18211819    |  _  ->  None
18221820
18231821let  listModule   ( com :  ICompiler )  ( ctx :  Context )  r  ( t :  Type )  ( i :  CallInfo )  ( _ :  Expr option )  ( args :  Expr list )  = 
18241822    match  i.CompiledName,  args with 
1825-     |  " IsEmpty" ,  [ x]  ->  Test( x,  ListTest false ,  r)  |>  Some
1826-     |  " Empty" ,  _  ->  NewList( None,  ( genArg com ctx r 0  i.GenericArgs))  |>  makeValue r |>  Some
1827-     |  " Singleton" ,  [ x]  -> 
1828-         NewList( Some( x,  Value( NewList( None,  t),  None)),  ( genArg com ctx r 0  i.GenericArgs))  |>  makeValue r |>  Some
1823+     // | ("Head" | "Tail" | "IsEmpty") as meth, [x] -> get r t x (Naming.lowerFirst meth) |> Some 
1824+     // | "IsEmpty", [x] -> Test(x, ListTest false, r) |> Some 
1825+     // | "Empty", _ -> NewList(None, (genArg com ctx r 0 i.GenericArgs)) |> makeValue r |> Some 
1826+     // | "Singleton", [x] -> 
1827+     //     NewList(Some(x, Value(NewList(None, t), None)), (genArg com ctx r 0 i.GenericArgs)) |> makeValue r |> Some 
18291828    // Use a cast to give it better chances of optimization (e.g. converting list 
18301829    // literals to arrays) after the beta reduction pass 
18311830    |  " ToSeq" ,  [ x]  ->  toSeq t x |>  Some
@@ -2614,8 +2613,8 @@ let enumerables (com: ICompiler) (ctx: Context) r t (i: CallInfo) (thisArg: Expr
26142613
26152614let  enumerators   ( com :  ICompiler )  ( ctx :  Context )  r  ( t :  Type )  ( i :  CallInfo )  ( thisArg :  Expr option )  ( args :  Expr list )  = 
26162615    match  i.CompiledName,  thisArg with 
2617-     |  " get_Current" ,  Some x ->  get r t x " Current" |>  Some
2618-     |  meth,  Some x ->  Helper.InstanceCall( x,  meth,  t,  args,  i.SignatureArgTypes,  ?loc= r)  |>  Some
2616+     //  | "get_Current", Some x -> get r t x "Current" |> Some
2617+     |  meth,  Some x ->  Helper.InstanceCall( x,  Naming.removeGetSetPrefix  meth,  t,  args,  i.SignatureArgTypes,  ?loc= r)  |>  Some
26192618    |  _  ->  None
26202619
26212620let  events   ( com :  ICompiler )  ( ctx :  Context )  r  ( t :  Type )  ( i :  CallInfo )  ( thisArg :  Expr option )  ( args :  Expr list )  = 
0 commit comments