"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/utils/sformat.fs" between
fsharp-4.1.33.tar.gz and fsharp-4.5.tar.gz

About: Mono is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C# and the Common Language Runtime. fsharp is the F# compiler and core library.

sformat.fs  (fsharp-4.1.33):sformat.fs  (fsharp-4.5)
skipping to change at line 369 skipping to change at line 369
[<NoEquality; NoComparison>] [<NoEquality; NoComparison>]
type TypeInfo = type TypeInfo =
| TupleType of Type list | TupleType of Type list
| FunctionType of Type * Type | FunctionType of Type * Type
| RecordType of (string * Type) list | RecordType of (string * Type) list
| SumType of (string * (string * Type) list) list | SumType of (string * (string * Type) list) list
| UnitType | UnitType
| ObjectType of Type | ObjectType of Type
let isNamedType(typ:Type) = not (typ.IsArray || typ.IsByRef || typ.IsPoi nter) let isNamedType (ty:Type) = not (ty.IsArray || ty.IsByRef || ty.IsPointe r)
let equivHeadTypes (ty1:Type) (ty2:Type) = let equivHeadTypes (ty1:Type) (ty2:Type) =
isNamedType(ty1) && isNamedType(ty1) &&
if ty1.IsGenericType then if ty1.IsGenericType then
ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.G etGenericTypeDefinition()) ty2.IsGenericType && (ty1.GetGenericTypeDefinition()).Equals(ty2.G etGenericTypeDefinition())
else else
ty1.Equals(ty2) ty1.Equals(ty2)
let option = typedefof<obj option> let option = typedefof<obj option>
let func = typedefof<(obj -> obj)> let func = typedefof<(obj -> obj)>
let isOptionTy typ = equivHeadTypes typ (typeof<int option>) let isOptionTy ty = equivHeadTypes ty (typeof<int option>)
let isUnitType typ = equivHeadTypes typ (typeof<unit>) let isUnitType ty = equivHeadTypes ty (typeof<unit>)
let isListType typ = let isListType ty =
FSharpType.IsUnion typ && FSharpType.IsUnion ty &&
(let cases = FSharpType.GetUnionCases typ (let cases = FSharpType.GetUnionCases ty
cases.Length > 0 && equivHeadTypes (typedefof<list<_>>) cases.[0].D eclaringType) cases.Length > 0 && equivHeadTypes (typedefof<list<_>>) cases.[0].D eclaringType)
[<NoEquality; NoComparison>] [<NoEquality; NoComparison>]
type ValueInfo = type ValueInfo =
| TupleValue of (obj * Type) list | TupleValue of (obj * Type) list
| FunctionClosureValue of System.Type | FunctionClosureValue of System.Type
| RecordValue of (string * obj * Type) list | RecordValue of (string * obj * Type) list
| ConstructorValue of string * (string * (obj * Type)) list | ConstructorValue of string * (string * (obj * Type)) list
| ExceptionValue of System.Type * (string * (obj * Type)) list | ExceptionValue of System.Type * (string * (obj * Type)) list
| UnitValue | UnitValue
skipping to change at line 462 skipping to change at line 462
let props = FSharpType.GetRecordFields(reprty,bindingFlags) let props = FSharpType.GetRecordFields(reprty,bindingFlags)
#endif #endif
RecordValue(props |> Array.map (fun prop -> prop.Name, prop. GetValue(obj,null), prop.PropertyType) |> Array.toList) RecordValue(props |> Array.map (fun prop -> prop.Name, prop. GetValue(obj,null), prop.PropertyType) |> Array.toList)
else else
ObjectValue(obj) ObjectValue(obj)
// This one is like the above but can make use of additional // This one is like the above but can make use of additional
// statically-known type information to aid in the // statically-known type information to aid in the
// analysis of null values. // analysis of null values.
let GetValueInfo bindingFlags (x : 'a, typ : Type) (* x could be nu ll *) = let GetValueInfo bindingFlags (x : 'a, ty : Type) (* x could be nul l *) =
let obj = (box x) let obj = (box x)
match obj with match obj with
| null -> | null ->
let isNullaryUnion = let isNullaryUnion =
match typ.GetCustomAttributes(typeof<CompilationRepresenta tionAttribute>, false) with match ty.GetCustomAttributes(typeof<CompilationRepresentat ionAttribute>, false) with
| [|:? CompilationRepresentationAttribute as attr|] -> | [|:? CompilationRepresentationAttribute as attr|] ->
(attr.Flags &&& CompilationRepresentationFlags.UseNull AsTrueValue) = CompilationRepresentationFlags.UseNullAsTrueValue (attr.Flags &&& CompilationRepresentationFlags.UseNull AsTrueValue) = CompilationRepresentationFlags.UseNullAsTrueValue
| _ -> false | _ -> false
if isNullaryUnion then if isNullaryUnion then
let nullaryCase = FSharpType.GetUnionCases typ |> Array.fil ter (fun uc -> uc.GetFields().Length = 0) |> Array.item 0 let nullaryCase = FSharpType.GetUnionCases ty |> Array.filt er (fun uc -> uc.GetFields().Length = 0) |> Array.item 0
ConstructorValue(nullaryCase.Name, []) ConstructorValue(nullaryCase.Name, [])
elif isUnitType typ then UnitValue elif isUnitType ty then UnitValue
else ObjectValue(obj) else ObjectValue(obj)
| _ -> | _ ->
GetValueInfoOfObject bindingFlags (obj) GetValueInfoOfObject bindingFlags (obj)
module Display = module Display =
open ReflectUtils open ReflectUtils
open LayoutOps open LayoutOps
open TaggedTextOps open TaggedTextOps
let string_of_int (i:int) = i.ToString() let string_of_int (i:int) = i.ToString()
let typeUsesSystemObjectToString (typ:System.Type) = let typeUsesSystemObjectToString (ty:System.Type) =
#if FX_PORTABLE_OR_NETSTANDARD
try try
#if FX_RESHAPED_REFLECTION #if FX_RESHAPED_REFLECTION
let methInfo = typ.GetRuntimeMethod("ToString",[| |]) let methInfo = ty.GetRuntimeMethod("ToString",[| |])
methInfo.DeclaringType = typeof<System.Object>
#else #else
let methInfo = typ.GetMethod("ToString",[| |]) let methInfo = ty.GetMethod("ToString",BindingFlags.Public ||| B
methInfo.DeclaringType = typeof<System.Object> indingFlags.Instance,null,[| |],null)
#endif #endif
with e -> false
#else
try let methInfo = typ.GetMethod("ToString",BindingFlags.Public |||
BindingFlags.Instance,null,[| |],null)
methInfo.DeclaringType = typeof<System.Object> methInfo.DeclaringType = typeof<System.Object>
with e -> false with e -> false
#endif
/// If "str" ends with "ending" then remove it from "str", otherwise no change. /// If "str" ends with "ending" then remove it from "str", otherwise no change.
let trimEnding (ending:string) (str:string) = let trimEnding (ending:string) (str:string) =
if str.EndsWith(ending,StringComparison.Ordinal) then if str.EndsWith(ending,StringComparison.Ordinal) then
str.Substring(0,str.Length - ending.Length) str.Substring(0,str.Length - ending.Length)
else str else str
let catchExn f = try Choice1Of2 (f ()) with e -> Choice2Of2 e let catchExn f = try Choice1Of2 (f ()) with e -> Choice2Of2 e
// An implementation of break stack. // An implementation of break stack.
// Uses mutable state, relying on linear threading of the state. // Uses mutable state, relying on linear threading of the state.
skipping to change at line 737 skipping to change at line 730
let _ = outAttribute tag attrs false let _ = outAttribute tag attrs false
z z
let _ = addL z0 0 layout let _ = addL z0 0 layout
() ()
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// pprinter: using general-purpose reflection... // pprinter: using general-purpose reflection...
// -------------------------------------------------------------------- // --------------------------------------------------------------------
let getValueInfo bindingFlags (x:'a, typ:Type) = Value.GetValueInfo bind ingFlags (x, typ) let getValueInfo bindingFlags (x:'a, ty:Type) = Value.GetValueInfo bindi ngFlags (x, ty)
let unpackCons recd = let unpackCons recd =
match recd with match recd with
| [(_,h);(_,t)] -> (h,t) | [(_,h);(_,t)] -> (h,t)
| _ -> failwith "unpackCons" | _ -> failwith "unpackCons"
let getListValueInfo bindingFlags (x:obj, typ:Type) = let getListValueInfo bindingFlags (x:obj, ty:Type) =
match x with match x with
| null -> None | null -> None
| _ -> | _ ->
match getValueInfo bindingFlags (x, typ) with match getValueInfo bindingFlags (x, ty) with
| ConstructorValue ("Cons",recd) -> Some (unpackCons recd) | ConstructorValue ("Cons",recd) -> Some (unpackCons recd)
| ConstructorValue ("Empty",[]) -> None | ConstructorValue ("Empty",[]) -> None
| _ -> failwith "List value had unexpected ValueInfo" | _ -> failwith "List value had unexpected ValueInfo"
let compactCommaListL xs = sepListL (sepL Literals.comma) xs // compact, no spaces around "," let compactCommaListL xs = sepListL (sepL Literals.comma) xs // compact, no spaces around ","
let nullL = wordL (tagKeyword "null") let nullL = wordL (tagKeyword "null")
let measureL = wordL (tagPunctuation "()") let measureL = wordL (tagPunctuation "()")
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// pprinter: attributes // pprinter: attributes
skipping to change at line 802 skipping to change at line 795
^^ sepListL (rightL Literals.semicolon) xs ^^ sepListL (rightL Literals.semicolon) xs
^^ (rightL (tagPunctuation "|]")) ^^ (rightL (tagPunctuation "|]"))
let makeArray2L xs = leftL Literals.leftBracket ^^ aboveListL xs ^^ righ tL Literals.rightBracket let makeArray2L xs = leftL Literals.leftBracket ^^ aboveListL xs ^^ righ tL Literals.rightBracket
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// pprinter: anyL - support functions // pprinter: anyL - support functions
// -------------------------------------------------------------------- // --------------------------------------------------------------------
let getProperty (ty: Type) (obj: obj) name = let getProperty (ty: Type) (obj: obj) name =
#if FX_PORTABLE_OR_NETSTANDARD #if FX_RESHAPED_REFLECTION
let prop = ty.GetProperty(name, (BindingFlags.Instance ||| BindingFl ags.Public ||| BindingFlags.NonPublic)) let prop = ty.GetProperty(name, (BindingFlags.Instance ||| BindingFl ags.Public ||| BindingFlags.NonPublic))
if not (isNull prop) then prop.GetValue(obj,[||]) if not (isNull prop) then prop.GetValue(obj,[||])
#if FX_NO_MISSINGMETHODEXCEPTION
// Profile 7, 47, 78 and 259 raise MissingMemberException
else
let msg = System.String.Concat([| "Method '"; ty.FullName; ".";
name; "' not found." |])
raise (System.MissingMemberException(msg))
#else
// Others raise MissingMethodException // Others raise MissingMethodException
else else
let msg = System.String.Concat([| "Method '"; ty.FullName; "."; name; "' not found." |]) let msg = System.String.Concat([| "Method '"; ty.FullName; "."; name; "' not found." |])
raise (System.MissingMethodException(msg)) raise (System.MissingMethodException(msg))
#endif
#else #else
ty.InvokeMember(name, (BindingFlags.GetProperty ||| BindingFlags.Ins tance ||| BindingFlags.Public ||| BindingFlags.NonPublic), null, obj, [| |],Cult ureInfo.InvariantCulture) ty.InvokeMember(name, (BindingFlags.GetProperty ||| BindingFlags.Ins tance ||| BindingFlags.Public ||| BindingFlags.NonPublic), null, obj, [| |],Cult ureInfo.InvariantCulture)
#endif #endif
let getField obj (fieldInfo: FieldInfo) = let getField obj (fieldInfo: FieldInfo) =
fieldInfo.GetValue(obj) fieldInfo.GetValue(obj)
let formatChar isChar c = let formatChar isChar c =
match c with match c with
| '\'' when isChar -> "\\\'" | '\'' when isChar -> "\\\'"
| '\"' when not isChar -> "\\\"" | '\"' when not isChar -> "\\\""
skipping to change at line 876 skipping to change at line 862
| BracketIfTuple = 3 | BracketIfTuple = 3
| NeverBracket = 4 | NeverBracket = 4
// In fsi.exe, certain objects are not printed for top-level bindings. // In fsi.exe, certain objects are not printed for top-level bindings.
[<StructuralEquality; NoComparison>] [<StructuralEquality; NoComparison>]
type ShowMode = type ShowMode =
| ShowAll | ShowAll
| ShowTopLevelBinding | ShowTopLevelBinding
// polymorphic and inner recursion limitations prevent us defining polyL in the recursive loop // polymorphic and inner recursion limitations prevent us defining polyL in the recursive loop
let polyL bindingFlags (objL: ShowMode -> int -> Precedence -> ValueInfo let polyL bindingFlags (objL: ShowMode -> int -> Precedence -> ValueInfo
-> obj -> Layout) showMode i prec (x:'a ,typ : Type) (* x could be null *) = -> obj -> Layout) showMode i prec (x:'a ,ty : Type) (* x could be null *) =
objL showMode i prec (getValueInfo bindingFlags (x, typ)) (box x) objL showMode i prec (getValueInfo bindingFlags (x, ty)) (box x)
let anyL showMode bindingFlags (opts:FormatOptions) (x:'a, typ:Type) = let anyL showMode bindingFlags (opts:FormatOptions) (x:'a, ty:Type) =
// showMode = ShowTopLevelBinding on the outermost expression when c alled from fsi.exe, // showMode = ShowTopLevelBinding on the outermost expression when c alled from fsi.exe,
// This allows certain outputs, e.g. objects that would print as <se q> to be suppressed, etc. See 4343. // This allows certain outputs, e.g. objects that would print as <se q> to be suppressed, etc. See 4343.
// Calls to layout proper sub-objects should pass showMode = ShowAll . // Calls to layout proper sub-objects should pass showMode = ShowAll .
// Precedences to ensure we add brackets in the right places // Precedences to ensure we add brackets in the right places
// Keep a record of objects encountered along the way // Keep a record of objects encountered along the way
let path = Dictionary<obj,int>(10,HashIdentity.Reference) let path = Dictionary<obj,int>(10,HashIdentity.Reference)
// Roughly count the "nodes" printed, e.g. leaf items and inner node s, but not every bracket and comma. // Roughly count the "nodes" printed, e.g. leaf items and inner node s, but not every bracket and comma.
let size = ref opts.PrintSize let size = ref opts.PrintSize
let exceededPrintSize() = !size<=0 let exceededPrintSize() = !size<=0
let countNodes n = if !size > 0 then size := !size - n else () // no need to keep decrementing (and avoid wrap around) let countNodes n = if !size > 0 then size := !size - n else () // no need to keep decrementing (and avoid wrap around)
let stopShort _ = exceededPrintSize() // for unfoldL let stopShort _ = exceededPrintSize() // for unfoldL
// Recursive descent // Recursive descent
let rec objL depthLim prec (x:obj, typ:Type) = polyL bindingFlags ob let rec objL depthLim prec (x:obj, ty:Type) = polyL bindingFlags obj
jWithReprL ShowAll depthLim prec (x, typ) // showMode for inner expr WithReprL ShowAll depthLim prec (x, ty) // showMode for inner expr
and sameObjL depthLim prec (x:obj, typ:Type) = polyL bindingFlags ob and sameObjL depthLim prec (x:obj, ty:Type) = polyL bindingFlags obj
jWithReprL showMode depthLim prec (x, typ) // showMode preserved WithReprL showMode depthLim prec (x, ty) // showMode preserved
and objWithReprL showMode depthLim prec (info:ValueInfo) (x:obj) (* x could be null *) = and objWithReprL showMode depthLim prec (info:ValueInfo) (x:obj) (* x could be null *) =
try try
if depthLim<=0 || exceededPrintSize() then wordL (tagPunctuati on "...") else if depthLim<=0 || exceededPrintSize() then wordL (tagPunctuati on "...") else
match x with match x with
| null -> | null ->
reprL showMode (depthLim-1) prec info x reprL showMode (depthLim-1) prec info x
| _ -> | _ ->
if (path.ContainsKey(x)) then if (path.ContainsKey(x)) then
wordL (tagPunctuation "...") wordL (tagPunctuation "...")
skipping to change at line 1048 skipping to change at line 1034
if b then (leftL Literals.leftParen) ^^ basicL ^^ (rightL Litera ls.rightParen) else basicL if b then (leftL Literals.leftParen) ^^ basicL ^^ (rightL Litera ls.rightParen) else basicL
and reprL showMode depthLim prec repr x (* x could be null *) = and reprL showMode depthLim prec repr x (* x could be null *) =
let showModeFilter lay = match showMode with ShowAll -> lay | Sh owTopLevelBinding -> emptyL let showModeFilter lay = match showMode with ShowAll -> lay | Sh owTopLevelBinding -> emptyL
match repr with match repr with
| TupleValue vals -> | TupleValue vals ->
let basicL = sepListL (rightL Literals.comma) (List.map (obj L depthLim Precedence.BracketIfTuple ) vals) let basicL = sepListL (rightL Literals.comma) (List.map (obj L depthLim Precedence.BracketIfTuple ) vals)
bracketIfL (prec <= Precedence.BracketIfTuple) basicL bracketIfL (prec <= Precedence.BracketIfTuple) basicL
| RecordValue items -> | RecordValue items ->
let itemL (name,x,typ) = let itemL (name,x,ty) =
countNodes 1 // record labels are counted as nodes. [REVIE W: discussion under 4090]. countNodes 1 // record labels are counted as nodes. [REVIE W: discussion under 4090].
(tagRecordField name,objL depthLim Precedence.BracketIfTup le (x, typ)) (tagRecordField name,objL depthLim Precedence.BracketIfTup le (x, ty))
makeRecordL (List.map itemL items) makeRecordL (List.map itemL items)
| ConstructorValue (constr,recd) when // x is List<T>. Note: "nu ll" is never a valid list value. | ConstructorValue (constr,recd) when // x is List<T>. Note: "nu ll" is never a valid list value.
x<>null && isListType (x.G etType()) -> x<>null && isListType (x.G etType()) ->
match constr with match constr with
| "Cons" -> | "Cons" ->
let (x,xs) = unpackCons recd let (x,xs) = unpackCons recd
let project xs = getListValueInfo bindingFlags xs let project xs = getListValueInfo bindingFlags xs
let itemLs = objL depthLim Precedence.BracketIfTuple x : : boundedUnfoldL (objL depthLim Precedence.BracketIfTuple) project stopShort xs (opts.PrintLength - 1) let itemLs = objL depthLim Precedence.BracketIfTuple x : : boundedUnfoldL (objL depthLim Precedence.BracketIfTuple) project stopShort xs (opts.PrintLength - 1)
makeListL itemLs makeListL itemLs
skipping to change at line 1163 skipping to change at line 1149
| :? System.Collections.IEnumerable as ie -> | :? System.Collections.IEnumerable as ie ->
let showContent = let showContent =
// do not display content of IQueryable since its ex ecution may take significant time // do not display content of IQueryable since its ex ecution may take significant time
opts.ShowIEnumerable && (ie.GetType().GetInterfaces( ) |> Array.exists(fun ty -> ty.FullName = "System.Linq.IQueryable") |> not) opts.ShowIEnumerable && (ie.GetType().GetInterfaces( ) |> Array.exists(fun ty -> ty.FullName = "System.Linq.IQueryable") |> not)
if showContent then if showContent then
let word = "seq" let word = "seq"
let it = ie.GetEnumerator() let it = ie.GetEnumerator()
let ty = ie.GetType().GetInterfaces() |> Array.filter (fun ty -> ty.IsGenericType && ty.Name = "IEnumerable`1") |> Array.tryItem 0 let ty = ie.GetType().GetInterfaces() |> Array.filter (fun ty -> ty.IsGenericType && ty.Name = "IEnumerable`1") |> Array.tryItem 0
let ty = Option.map (fun (typ:Type) -> typ.GetGeneric Arguments().[0]) ty let ty = Option.map (fun (ty:Type) -> ty.GetGenericAr guments().[0]) ty
try try
let itemLs = boundedUnfoldL (objL depthLim Preceden ce.BracketIfTuple) (fun () -> if it.MoveNext() then Some((it.Current, match ty w ith | None -> it.Current.GetType() | Some ty -> ty),()) else None) stopShort () (1+opts.PrintLength/30) let itemLs = boundedUnfoldL (objL depthLim Preceden ce.BracketIfTuple) (fun () -> if it.MoveNext() then Some((it.Current, match ty w ith | None -> it.Current.GetType() | Some ty -> ty),()) else None) stopShort () (1+opts.PrintLength/30)
(wordL (tagClass word) --- makeListL itemLs) |> bra cketIfL (prec <= Precedence.BracketIfTupleOrNotAtomic) (wordL (tagClass word) --- makeListL itemLs) |> bra cketIfL (prec <= Precedence.BracketIfTupleOrNotAtomic)
finally finally
match it with match it with
| :? System.IDisposable as e -> e.Dispose() | :? System.IDisposable as e -> e.Dispose()
| _ -> () | _ -> ()
else else
// Sequence printing is turned off for declared-value s, and maybe be disabled to users. // Sequence printing is turned off for declared-value s, and maybe be disabled to users.
skipping to change at line 1186 skipping to change at line 1172
wordL (tagText "<seq>") |> showModeFilter wordL (tagText "<seq>") |> showModeFilter
| _ -> | _ ->
if showMode = ShowTopLevelBinding && typeUsesSystemObje ctToString ty then if showMode = ShowTopLevelBinding && typeUsesSystemObje ctToString ty then
emptyL emptyL
else else
countNodes 1 countNodes 1
let basicL = LayoutOps.objL obj // This buries an ob j in the layout, rendered at squash time via a leafFormatter. let basicL = LayoutOps.objL obj // This buries an ob j in the layout, rendered at squash time via a leafFormatter.
// If the leafFormat ter was directly here, then layout leaves could store strings. // If the leafFormat ter was directly here, then layout leaves could store strings.
match obj with match obj with
| _ when opts.ShowProperties -> | _ when opts.ShowProperties ->
#if FX_PORTABLE_OR_NETSTANDARD #if FX_RESHAPED_REFLECTION
let props = ty.GetProperties(BindingFlags.Instance ||| BindingFlags.Public) let props = ty.GetProperties(BindingFlags.Instance ||| BindingFlags.Public)
#else #else
let props = ty.GetProperties(BindingFlags.GetField ||| BindingFlags.Instance ||| BindingFlags.Public) let props = ty.GetProperties(BindingFlags.GetField ||| BindingFlags.Instance ||| BindingFlags.Public)
#endif #endif
let fields = ty.GetFields(BindingFlags.Instance || | BindingFlags.Public) |> Array.map (fun i -> i :> MemberInfo) let fields = ty.GetFields(BindingFlags.Instance || | BindingFlags.Public) |> Array.map (fun i -> i :> MemberInfo)
let propsAndFields = let propsAndFields =
props |> Array.map (fun i -> i :> MemberInfo) props |> Array.map (fun i -> i :> MemberInfo)
|> Array.append fields |> Array.append fields
|> Array.filter (fun pi -> |> Array.filter (fun pi ->
// check if property is annotated with Syste m.Diagnostics.DebuggerBrowsable(Never). // check if property is annotated with Syste m.Diagnostics.DebuggerBrowsable(Never).
// Its evaluation may have unexpected side e ffects and\or block printing. // Its evaluation may have unexpected side e ffects and\or block printing.
match Seq.toArray (pi.GetCustomAttributes(ty peof<System.Diagnostics.DebuggerBrowsableAttribute>, false)) with match Seq.toArray (pi.GetCustomAttributes(ty peof<System.Diagnostics.DebuggerBrowsableAttribute>, false)) with
| [|:? System.Diagnostics.DebuggerBrowsableA ttribute as attr |] -> attr.State <> System.Diagnostics.DebuggerBrowsableState.N ever | [|:? System.Diagnostics.DebuggerBrowsableA ttribute as attr |] -> attr.State <> System.Diagnostics.DebuggerBrowsableState.N ever
| _ -> true | _ -> true
) )
// massively reign in deep printing of properties // massively reign in deep printing of properties
let nDepth = depthLim/10 let nDepth = depthLim/10
#if FX_PORTABLE_OR_NETSTANDARD #if NETSTANDARD1_6 || NETSTANDARD2_0
Array.Sort((propsAndFields),{ new IComparer<Member Info> with member this.Compare(p1,p2) = compare (p1.Name) (p2.Name) } ); Array.Sort((propsAndFields),{ new IComparer<Member Info> with member this.Compare(p1,p2) = compare (p1.Name) (p2.Name) } );
#else #else
Array.Sort((propsAndFields :> Array),{ new System. Collections.IComparer with member this.Compare(p1,p2) = compare ((p1 :?> MemberI nfo).Name) ((p2 :?> MemberInfo).Name) } ); Array.Sort((propsAndFields :> Array),{ new System. Collections.IComparer with member this.Compare(p1,p2) = compare ((p1 :?> MemberI nfo).Name) ((p2 :?> MemberInfo).Name) } );
#endif #endif
if propsAndFields.Length = 0 || (nDepth <= 0) then basicL if propsAndFields.Length = 0 || (nDepth <= 0) then basicL
else basicL --- else basicL ---
(propsAndFields (propsAndFields
|> Array.map |> Array.map
(fun m -> (fun m ->
((if m :? FieldInfo then tagField m. Name else tagProperty m.Name), ((if m :? FieldInfo then tagField m. Name else tagProperty m.Name),
(try Some (objL nDepth Precedenc e.BracketIfTuple ((getProperty ty obj m.Name), ty)) (try Some (objL nDepth Precedenc e.BracketIfTuple ((getProperty ty obj m.Name), ty))
with _ -> try Some (objL nDepth Precedence.BracketIfTuple ((getField obj (m :?> FieldInfo)), ty)) with _ -> try Some (objL nDepth Precedence.BracketIfTuple ((getField obj (m :?> FieldInfo)), ty))
with _ -> None))) with _ -> None)))
|> Array.toList |> Array.toList
|> makePropertiesL) |> makePropertiesL)
| _ -> basicL | _ -> basicL
| UnitValue -> countNodes 1; measureL | UnitValue -> countNodes 1; measureL
polyL bindingFlags objWithReprL showMode opts.PrintDepth Precedence. BracketIfTuple (x, typ) polyL bindingFlags objWithReprL showMode opts.PrintDepth Precedence. BracketIfTuple (x, ty)
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// pprinter: leafFormatter // pprinter: leafFormatter
// -------------------------------------------------------------------- // --------------------------------------------------------------------
let leafFormatter (opts:FormatOptions) (obj :obj) = let leafFormatter (opts:FormatOptions) (obj :obj) =
match obj with match obj with
| null -> tagKeyword "null" | null -> tagKeyword "null"
| :? double as d -> | :? double as d ->
let s = d.ToString(opts.FloatingPointFormat,opts.FormatProvider) let s = d.ToString(opts.FloatingPointFormat,opts.FormatProvider)
 End of changes. 26 change blocks. 
47 lines changed or deleted 32 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)