@@ -4116,7 +4116,7 @@ type AttribNamedArg =
41164116 override x.ToString () = sprintf " AttribNamedArg(...)"
41174117
41184118/// Constants in expressions
4119- [<RequireQualifiedAccess>]
4119+ [<RequireQualifiedAccess; StructuredFormatDisplay ( " {DebugText} " ) >]
41204120type Const =
41214121 | Bool of bool
41224122 | SByte of sbyte
@@ -4137,6 +4137,30 @@ type Const =
41374137 | Unit
41384138 | Zero // null/zero-bit-pattern
41394139
4140+ [<DebuggerBrowsable( DebuggerBrowsableState.Never) >]
4141+ member x.DebugText = x.ToString()
4142+
4143+ override c.ToString () =
4144+ match c with
4145+ | Bool b -> ( if b then " true" else " false" )
4146+ | SByte x -> string x + " y"
4147+ | Byte x -> string x + " uy"
4148+ | Int16 x -> string x + " s"
4149+ | UInt16 x -> string x + " us"
4150+ | Int32 x -> string x
4151+ | UInt32 x -> string x + " u"
4152+ | Int64 x -> string x + " L"
4153+ | UInt64 x -> string x + " UL"
4154+ | IntPtr x -> string x + " n"
4155+ | UIntPtr x -> string x + " un"
4156+ | Single x -> string x + " f"
4157+ | Double x -> string x
4158+ | Char x -> " '" + string x + " '"
4159+ | String x -> " \" " + x + " \" "
4160+ | Decimal x -> string x + " M"
4161+ | Unit -> " ()"
4162+ | Zero -> " Const.Zero"
4163+
41404164/// Decision trees. Pattern matching has been compiled down to
41414165/// a decision tree by this point. The right-hand-sides (actions) of
41424166/// a decision tree by this point. The right-hand-sides (actions) of
@@ -4235,7 +4259,7 @@ type DecisionTreeTest =
42354259/// A target of a decision tree. Can be thought of as a little function, though is compiled as a local block.
42364260[<NoEquality; NoComparison; StructuredFormatDisplay( " {DebugText}" ) >]
42374261type DecisionTreeTarget =
4238- | TTarget of Vals * Expr * DebugPointForTarget
4262+ | TTarget of Val list * Expr * DebugPointForTarget
42394263
42404264 [<DebuggerBrowsable( DebuggerBrowsableState.Never) >]
42414265 member x.DebugText = x.ToString()
@@ -4359,7 +4383,7 @@ type Exprs = Expr list
43594383type Vals = Val list
43604384
43614385/// Represents an expression in the typed abstract syntax
4362- [<NoEquality; NoComparison; RequireQualifiedAccess (* ; StructuredFormatDisplay("{DebugText}") *) >]
4386+ [<NoEquality; NoComparison; RequireQualifiedAccess; StructuredFormatDisplay( " {DebugText}" ) >]
43634387type Expr =
43644388 /// A constant expression.
43654389 | Const of
@@ -4496,13 +4520,32 @@ type Expr =
44964520 /// appropriate type instantiation. These are immediately eliminated on subsequent rewrites.
44974521 | Link of Expr ref
44984522
4499- // Prefer to use the default formatting of this union type
4500- //[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
4501- //member x.DebugText = x.ToString()
4502- //
4503- //override __.ToString() = "Expr(...)"
4504-
4505- [<NoEquality; NoComparison; RequireQualifiedAccess (* ; StructuredFormatDisplay("{DebugText}") *) >]
4523+ [<DebuggerBrowsable( DebuggerBrowsableState.Never) >]
4524+ member expr.DebugText = expr.ToDebugString( 3 )
4525+
4526+ override expr.ToString () = expr.ToDebugString( 3 )
4527+
4528+ member expr.ToDebugString ( depth : int ) =
4529+ if depth = 0 then " .." else
4530+ let depth = depth - 1
4531+ match expr with
4532+ | Const ( c, _, _) -> c.ToString()
4533+ | Val ( v, _, _) -> v.LogicalName
4534+ | Sequential ( e1, e2, _, _, _) -> " Sequential(" + e1.ToDebugString( depth) + " , " + e2.ToDebugString( depth) + " )"
4535+ | Lambda (_, _, _, vs, body, _, _) -> sprintf " Lambda(%+A , " vs + body.ToDebugString( depth) + " )"
4536+ | TyLambda (_, tps, body, _, _) -> sprintf " TyLambda(%+A , " tps + body.ToDebugString( depth) + " )"
4537+ | App ( f, _, _, args, _) -> " App(" + f.ToDebugString( depth) + " , [" + String.concat " , " ( args |> List.map ( fun e -> e.ToDebugString( depth))) + " ])"
4538+ | LetRec _ -> " LetRec(..)"
4539+ | Let ( bind, body, _, _) -> " Let(" + bind.Var.DisplayName + " , " + bind.Expr.ToDebugString( depth) + " , " + body.ToDebugString( depth) + " )"
4540+ | Obj (_, _ objTy, _, _, _, _, _) -> " Obj(..)"
4541+ | Match (_, _, _ dt, _ tgs, _, _) -> " Match(..)"
4542+ | StaticOptimization (_, _, _, _) -> " StaticOptimization(..)"
4543+ | Op ( op, _, args, _) -> " Op(" + op.ToString() + " , " + String.concat " , " ( args |> List.map ( fun e -> e.ToDebugString( depth))) + " )"
4544+ | Quote _ -> " Quote(..)"
4545+ | TyChoose _ -> " TyChoose(..)"
4546+ | Link e -> " Link(" + e.Value.ToDebugString( depth) + " )"
4547+
4548+ [<NoEquality; NoComparison; RequireQualifiedAccess; StructuredFormatDisplay( " {DebugText}" ) >]
45064549type TOp =
45074550
45084551 /// An operation representing the creation of a union value of the particular union case
@@ -4619,11 +4662,45 @@ type TOp =
46194662 /// retTy -- the types of pushed values, if any
46204663 | ILCall of bool * bool * bool * bool * ValUseFlag * bool * bool * ILMethodRef * TypeInst * TypeInst * TTypes
46214664
4622- // Prefer to use the default formatting of this union type
4623- //[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
4624- //member x.DebugText = x.ToString()
4625- //
4626- //override __.ToString() = "TOp(...)"
4665+ [<DebuggerBrowsable( DebuggerBrowsableState.Never) >]
4666+ member x.DebugText = x.ToString()
4667+
4668+ override op.ToString () =
4669+ match op with
4670+ | UnionCase ucref -> " UnionCase(" + ucref.CaseName + " )"
4671+ | ExnConstr ecref -> " ExnConstr(" + ecref.LogicalName + " )"
4672+ | Tuple _ tupinfo -> " Tuple"
4673+ | AnonRecd _ anonInfo -> " AnonRecd(..)"
4674+ | AnonRecdGet _ -> " AnonRecdGet(..)"
4675+ | Array -> " NewArray"
4676+ | Bytes _ -> " Bytes(..)"
4677+ | UInt16s _ -> " UInt16s(..)"
4678+ | While _ -> " While"
4679+ | For _ -> " For"
4680+ | TryCatch _ -> " TryCatch"
4681+ | TryFinally _ -> " TryFinally"
4682+ | Recd (_, tcref) -> " Recd(" + tcref.LogicalName + " )"
4683+ | ValFieldSet rfref -> " ValFieldSet(" + rfref.FieldName + " )"
4684+ | ValFieldGet rfref -> " ValFieldGet(" + rfref.FieldName + " )"
4685+ | ValFieldGetAddr ( rfref, _) -> " ValFieldGetAddr(" + rfref.FieldName + " ,..)"
4686+ | UnionCaseTagGet tcref -> " UnionCaseTagGet(" + tcref.LogicalName + " )"
4687+ | UnionCaseProof ucref -> " UnionCaseProof(" + ucref.CaseName + " )"
4688+ | UnionCaseFieldGet ( ucref, _) -> " UnionCaseFieldGet(" + ucref.CaseName + " ,..)"
4689+ | UnionCaseFieldGetAddr ( ucref, _, _) -> " UnionCaseFieldGetAddr(" + ucref.CaseName + " ,..)"
4690+ | UnionCaseFieldSet ( ucref, _) -> " UnionCaseFieldSet(" + ucref.CaseName + " ,..)"
4691+ | ExnFieldGet ( tcref, _) -> " ExnFieldGet(" + tcref.LogicalName + " ,..)"
4692+ | ExnFieldSet ( tcref, _) -> " ExnFieldSet(" + tcref.LogicalName + " ,..)"
4693+ | TupleFieldGet _ -> " TupleFieldGet(..)"
4694+ | ILAsm _ -> " ILAsm(..)"
4695+ | RefAddrGet _ -> " RefAddrGet(..)"
4696+ | Coerce -> " Coerce"
4697+ | Reraise -> " Reraise"
4698+ | Return -> " Return"
4699+ | Goto n -> " Goto(" + string n + " )"
4700+ | Label n -> " Label(" + string n + " )"
4701+ | TraitCall info -> " TraitCall(" + info.MemberName + " )"
4702+ | LValueOp ( op, vref) -> sprintf " %+A (%s )" op vref.LogicalName
4703+ | ILCall (_,_,_,_,_,_,_, m,_,_,_) -> " ILCall(" + m.ToString() + " ,..)"
46274704
46284705/// Represents the kind of record construction operation.
46294706type RecordConstructionInfo =
0 commit comments