未验证 提交 d5f5bd00 编写于 作者: D Don Syme 提交者: GitHub

more cleanup - spacing for commas and colons (#6343)

* spacing for commas and colons

* code review
上级 91bdb8a8
此差异已折叠。
此差异已折叠。
......@@ -33,12 +33,17 @@ type ppenv =
{ ilGlobals: ILGlobals
ppenvClassFormals: int
ppenvMethodFormals: int }
let ppenv_enter_method mgparams env =
{env with ppenvMethodFormals=mgparams}
let ppenv_enter_tdef gparams env =
{env with ppenvClassFormals=List.length gparams; ppenvMethodFormals=0}
let mk_ppenv ilg = { ilGlobals = ilg; ppenvClassFormals = 0; ppenvMethodFormals = 0 }
let debug_ppenv = mk_ppenv
let ppenv_enter_modul env = { env with ppenvClassFormals=0; ppenvMethodFormals=0 }
// --------------------------------------------------------------------
......@@ -46,8 +51,11 @@ let ppenv_enter_modul env = { env with ppenvClassFormals=0; ppenvMethodFormals=
// --------------------------------------------------------------------
let output_string (os: TextWriter) (s:string) = os.Write s
let output_char (os: TextWriter) (c:char) = os.Write c
let output_int os (i:int) = output_string os (string i)
let output_hex_digit os i =
assert (i >= 0 && i < 16)
if i > 9 then output_char os (char (int32 'A' + (i-10)))
......@@ -106,7 +114,9 @@ let output_array sep f os (a:_ []) =
f os (a.[a.Length - 1])
let output_parens f os a = output_string os "("; f os a; output_string os ")"
let output_angled f os a = output_string os "<"; f os a; output_string os ">"
let output_bracks f os a = output_string os "["; f os a; output_string os "]"
let output_id os n = output_sqstring os n
......@@ -114,6 +124,7 @@ let output_id os n = output_sqstring os n
let output_label os n = output_string os n
let output_lid os lid = output_seq "." output_string os lid
let string_of_type_name (_,n) = n
let output_byte os i =
......@@ -127,17 +138,27 @@ let output_bytes os (bytes:byte[]) =
let bits_of_float32 (x:float32) = System.BitConverter.ToInt32(System.BitConverter.GetBytes(x),0)
let bits_of_float (x:float) = System.BitConverter.DoubleToInt64Bits(x)
let output_u8 os (x:byte) = output_string os (string (int x))
let output_i8 os (x:sbyte) = output_string os (string (int x))
let output_u16 os (x:uint16) = output_string os (string (int x))
let output_i16 os (x:int16) = output_string os (string (int x))
let output_u32 os (x:uint32) = output_string os (string (int64 x))
let output_i32 os (x:int32) = output_string os (string x)
let output_u64 os (x:uint64) = output_string os (string (int64 x))
let output_i64 os (x:int64) = output_string os (string x)
let output_ieee32 os (x:float32) = output_string os "float32 ("; output_string os (string (bits_of_float32 x)); output_string os ")"
let output_ieee64 os (x:float) = output_string os "float64 ("; output_string os (string (bits_of_float x)); output_string os ")"
let rec goutput_scoref _env os = function
......@@ -155,8 +176,8 @@ and goutput_tref env os (x:ILTypeRef) =
and goutput_typ env os ty =
match ty with
| ILType.Boxed tr -> goutput_tspec env os tr
| ILType.TypeVar tv ->
| ILType.Boxed tr -> goutput_tspec env os tr
| ILType.TypeVar tv ->
// Special rule to print method type variables in Generic EE preferred form
// when an environment is available to help us do this.
let cgparams = env.ppenvClassFormals
......@@ -164,36 +185,36 @@ and goutput_typ env os ty =
if int tv < cgparams then
output_string os "!"
output_tyvar os tv
elif int tv - cgparams < mgparams then
elif int tv - cgparams < mgparams then
output_string os "!!"
output_int os (int tv - cgparams)
output_int os (int tv - cgparams)
else
output_string os "!"
output_tyvar os tv
output_int os (int tv)
| ILType.Byref typ -> goutput_typ env os typ; output_string os "&"
| ILType.Ptr typ -> goutput_typ env os typ; output_string os "*"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_SByte.TypeSpec.Name -> output_string os "int8"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Int16.TypeSpec.Name -> output_string os "int16"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Int32.TypeSpec.Name -> output_string os "int32"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Int64.TypeSpec.Name -> output_string os "int64"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_IntPtr.TypeSpec.Name -> output_string os "native int"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Byte.TypeSpec.Name -> output_string os "unsigned int8"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_UInt16.TypeSpec.Name -> output_string os "unsigned int16"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_UInt32.TypeSpec.Name -> output_string os "unsigned int32"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_UInt64.TypeSpec.Name -> output_string os "unsigned int64"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_UIntPtr.TypeSpec.Name -> output_string os "native unsigned int"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Double.TypeSpec.Name -> output_string os "float64"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Single.TypeSpec.Name -> output_string os "float32"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Bool.TypeSpec.Name -> output_string os "bool"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Char.TypeSpec.Name -> output_string os "char"
| ILType.Ptr typ -> goutput_typ env os typ; output_string os "*"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_SByte.TypeSpec.Name -> output_string os "int8"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Int16.TypeSpec.Name -> output_string os "int16"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Int32.TypeSpec.Name -> output_string os "int32"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Int64.TypeSpec.Name -> output_string os "int64"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_IntPtr.TypeSpec.Name -> output_string os "native int"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Byte.TypeSpec.Name -> output_string os "unsigned int8"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_UInt16.TypeSpec.Name -> output_string os "unsigned int16"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_UInt32.TypeSpec.Name -> output_string os "unsigned int32"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_UInt64.TypeSpec.Name -> output_string os "unsigned int64"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_UIntPtr.TypeSpec.Name -> output_string os "native unsigned int"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Double.TypeSpec.Name -> output_string os "float64"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Single.TypeSpec.Name -> output_string os "float32"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Bool.TypeSpec.Name -> output_string os "bool"
| ILType.Value tspec when tspec.Name = EcmaMscorlibILGlobals.typ_Char.TypeSpec.Name -> output_string os "char"
| ILType.Value tspec ->
output_string os "value class "
goutput_tref env os tspec.TypeRef
output_string os " "
goutput_gactuals env os tspec.GenericArgs
| ILType.Void -> output_string os "void"
| ILType.Void -> output_string os "void"
| ILType.Array (bounds,ty) ->
goutput_typ env os ty
output_string os "["
......@@ -253,30 +274,28 @@ and output_arr_bounds os = function
l
and goutput_permission _env os p =
let output_security_action os x =
let output_security_action os x =
output_string os
(match x with
| ILSecurityAction.Request -> "request"
| ILSecurityAction.Demand -> "demand"
| ILSecurityAction.Assert-> "assert"
| ILSecurityAction.Deny-> "deny"
| ILSecurityAction.PermitOnly-> "permitonly"
| ILSecurityAction.LinkCheck-> "linkcheck"
| ILSecurityAction.InheritCheck-> "inheritcheck"
| ILSecurityAction.ReqMin-> "reqmin"
| ILSecurityAction.ReqOpt-> "reqopt"
| ILSecurityAction.ReqRefuse-> "reqrefuse"
| ILSecurityAction.PreJitGrant-> "prejitgrant"
| ILSecurityAction.PreJitDeny-> "prejitdeny"
| ILSecurityAction.NonCasDemand-> "noncasdemand"
| ILSecurityAction.NonCasLinkDemand-> "noncaslinkdemand"
| ILSecurityAction.NonCasInheritance-> "noncasinheritance"
| ILSecurityAction.Request -> "request"
| ILSecurityAction.Demand -> "demand"
| ILSecurityAction.Assert-> "assert"
| ILSecurityAction.Deny-> "deny"
| ILSecurityAction.PermitOnly-> "permitonly"
| ILSecurityAction.LinkCheck-> "linkcheck"
| ILSecurityAction.InheritCheck-> "inheritcheck"
| ILSecurityAction.ReqMin-> "reqmin"
| ILSecurityAction.ReqOpt-> "reqopt"
| ILSecurityAction.ReqRefuse-> "reqrefuse"
| ILSecurityAction.PreJitGrant-> "prejitgrant"
| ILSecurityAction.PreJitDeny-> "prejitdeny"
| ILSecurityAction.NonCasDemand-> "noncasdemand"
| ILSecurityAction.NonCasLinkDemand-> "noncaslinkdemand"
| ILSecurityAction.NonCasInheritance-> "noncasinheritance"
| ILSecurityAction.LinkDemandChoice -> "linkdemandchoice"
| ILSecurityAction.InheritanceDemandChoice -> "inheritancedemandchoice"
| ILSecurityAction.DemandChoice -> "demandchoice")
match p with
| ILSecurityDecl (sa,b) ->
output_string os " .permissionset "
......@@ -459,10 +478,10 @@ let goutput_cuspec env os (IlxUnionSpec(IlxUnionRef(_,tref,_,_,_),i)) =
let output_basic_type os x =
output_string os
(match x with
| DT_I1 -> "i1"
| DT_U1 -> "u1"
| DT_I2 -> "i2"
| DT_U2 -> "u2"
| DT_I1 -> "i1"
| DT_U1 -> "u1"
| DT_I2 -> "i2"
| DT_U2 -> "u2"
| DT_I4 -> "i4"
| DT_U4 -> "u4"
| DT_I8 -> "i8"
......@@ -505,7 +524,6 @@ let goutput_fdef _tref env os (fd: ILFieldDef) =
output_string os "\n"
goutput_custom_attrs env os fd.CustomAttrs
let output_alignment os = function
Aligned -> ()
| Unaligned1 -> output_string os "unaligned. 1 "
......@@ -528,11 +546,11 @@ let rec goutput_apps env os = function
output_angled (goutput_gparam env) os (mkILSimpleTypar "T")
output_string os " "
goutput_apps env os cs
| Apps_app(ty,cs) ->
| Apps_app(ty,cs) ->
output_parens (goutput_typ env) os ty
output_string os " "
goutput_apps env os cs
| Apps_done ty ->
| Apps_done ty ->
output_string os "--> "
goutput_typ env os ty
......@@ -540,6 +558,7 @@ let rec goutput_apps env os = function
let output_short_u16 os (x:uint16) =
if int x < 256 then (output_string os ".s "; output_u16 os x)
else output_string os " "; output_u16 os x
let output_short_i32 os i32 =
if i32 < 256 && 0 >= i32 then (output_string os ".s "; output_i32 os i32)
else output_string os " "; output_i32 os i32
......@@ -553,7 +572,7 @@ let goutput_local env os (l: ILLocal) =
let goutput_param env os (l: ILParameter) =
match l.Name with
None -> goutput_typ env os l.Type
None -> goutput_typ env os l.Type
| Some n -> goutput_typ env os l.Type; output_string os " "; output_sqstring os n
let goutput_params env os ps =
......@@ -624,7 +643,7 @@ let rec goutput_instr env os inst =
output_string os "ldc."; output_basic_type os dt; output_string os " "; output_ieee32 os x
| (AI_ldc (dt, ILConst.R8 x)) ->
output_string os "ldc."; output_basic_type os dt; output_string os " "; output_ieee64 os x
| I_ldftn mspec -> output_string os "ldftn "; goutput_mspec env os mspec
| I_ldftn mspec -> output_string os "ldftn "; goutput_mspec env os mspec
| I_ldvirtftn mspec -> output_string os "ldvirtftn "; goutput_mspec env os mspec
| I_ldind (al,vol,dt) ->
output_alignment os al
......@@ -779,7 +798,6 @@ let goutput_ilmbody env os (il: ILMethodBody) =
output_seq ",\n " (goutput_local env) os il.Locals
output_string os ")\n"
let goutput_mbody is_entrypoint env os (md: ILMethodDef) =
if md.ImplAttributes &&& MethodImplAttributes.Native <> enum 0 then output_string os "native "
elif md.ImplAttributes &&& MethodImplAttributes.IL <> enum 0 then output_string os "cil "
......@@ -892,14 +910,15 @@ let output_type_layout_info os info =
let splitTypeLayout = function
| ILTypeDefLayout.Auto -> "auto",(fun _os () -> ())
| ILTypeDefLayout.Sequential info -> "sequential", (fun os () -> output_type_layout_info os info)
| ILTypeDefLayout.Explicit info -> "explicit", (fun os () -> output_type_layout_info os info)
| ILTypeDefLayout.Sequential info -> "sequential", (fun os () -> output_type_layout_info os info)
| ILTypeDefLayout.Explicit info -> "explicit", (fun os () -> output_type_layout_info os info)
let goutput_fdefs tref env os (fdefs: ILFieldDefs) =
List.iter (fun f -> (goutput_fdef tref env) os f; output_string os "\n" ) fdefs.AsList
let goutput_mdefs env os (mdefs: ILMethodDefs) =
Array.iter (fun f -> (goutput_mdef env) os f; output_string os "\n" ) mdefs.AsArray
let goutput_pdefs env os (pdefs: ILPropertyDefs) =
List.iter (fun f -> (goutput_pdef env) os f; output_string os "\n" ) pdefs.AsList
......@@ -954,7 +973,7 @@ and goutput_lambdas env os lambdas =
output_angled (goutput_gparam env) os gf
output_string os " "
(goutput_lambdas env) os l
| Lambdas_lambda (ps,l) ->
| Lambdas_lambda (ps,l) ->
output_parens (goutput_param env) os ps
output_string os " "
(goutput_lambdas env) os l
......@@ -1046,7 +1065,7 @@ let output_module_fragment_aux _refs os (ilg: ILGlobals) modul =
let env = ppenv_enter_modul env
goutput_tdefs false ([]) env os modul.TypeDefs
goutput_tdefs true ([]) env os modul.TypeDefs
with e ->
with e ->
output_string os "*** Error during printing : "; output_string os (e.ToString()); os.Flush()
reraise()
......@@ -1078,7 +1097,7 @@ let output_module os (ilg: ILGlobals) modul =
output_module_refs os refs
goutput_module_manifest env os modul
output_module_fragment_aux refs os ilg modul
with e ->
with e ->
output_string os "*** Error during printing : "; output_string os (e.ToString()); os.Flush()
raise e
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -31,17 +31,17 @@ type BlobBuildingStream () =
override this.CanSeek = false
override this.Length = int64(builder.Count)
override this.Write(buffer:byte array, offset:int, count:int) = builder.WriteBytes(buffer, offset, count)
override this.WriteByte(value:byte) = builder.WriteByte(value)
member this.WriteInt32(value:int) = builder.WriteInt32(value)
override this.Write(buffer: byte array, offset: int, count: int) = builder.WriteBytes(buffer, offset, count)
override this.WriteByte(value: byte) = builder.WriteByte(value)
member this.WriteInt32(value: int) = builder.WriteInt32(value)
member this.ToImmutableArray() = builder.ToImmutableArray()
member this.TryWriteBytes(stream:Stream, length:int) = builder.TryWriteBytes(stream, length)
member this.TryWriteBytes(stream: Stream, length: int) = builder.TryWriteBytes(stream, length)
override this.Flush() = ()
override this.Dispose(_disposing:bool) = ()
override this.Seek(_offset:int64, _origin:SeekOrigin) = raise (new NotSupportedException())
override this.Read(_buffer:byte array, _offset:int, _count:int) = raise (new NotSupportedException())
override this.SetLength(_value:int64) = raise (new NotSupportedException())
override this.Dispose(_disposing: bool) = ()
override this.Seek(_offset: int64, _origin: SeekOrigin) = raise (new NotSupportedException())
override this.Read(_buffer: byte array, _offset: int, _count: int) = raise (new NotSupportedException())
override this.SetLength(_value: int64) = raise (new NotSupportedException())
override val Position = 0L with get, set
// --------------------------------------------------------------------
......@@ -78,7 +78,7 @@ type PdbSequencePoint =
type PdbMethodData =
{ MethToken: int32
MethName:string
MethName: string
LocalSignatureToken: int32
Params: PdbLocalVar array
RootScope: PdbMethodScope option
......@@ -129,7 +129,7 @@ type idd =
// Portable PDB Writer
//---------------------------------------------------------------------
let cvMagicNumber = 0x53445352L
let pdbGetCvDebugInfo (mvid:byte[]) (timestamp:int32) (filepath:string) (cvChunk:BinaryChunk) =
let pdbGetCvDebugInfo (mvid: byte[]) (timestamp: int32) (filepath: string) (cvChunk: BinaryChunk) =
let iddCvBuffer =
// Debug directory entry
let path = (System.Text.Encoding.UTF8.GetBytes filepath)
......@@ -153,7 +153,7 @@ let pdbGetCvDebugInfo (mvid:byte[]) (timestamp:int32) (filepath:string) (cvChunk
}
let pdbMagicNumber= 0x4244504dL
let pdbGetPdbDebugInfo (embeddedPDBChunk:BinaryChunk) (uncompressedLength:int64) (stream:MemoryStream) =
let pdbGetPdbDebugInfo (embeddedPDBChunk: BinaryChunk) (uncompressedLength: int64) (stream: MemoryStream) =
let iddPdbBuffer =
let buffer = Array.zeroCreate (sizeof<int32> + sizeof<int32> + int(stream.Length))
let (offset, size) = (0, sizeof<int32>) // Magic Number dword: 0x4244504dL
......@@ -172,7 +172,7 @@ let pdbGetPdbDebugInfo (embeddedPDBChunk:BinaryChunk) (uncompressedLength:int64)
iddChunk = embeddedPDBChunk
}
let pdbGetDebugInfo (mvid:byte[]) (timestamp:int32) (filepath:string) (cvChunk:BinaryChunk) (embeddedPDBChunk:BinaryChunk option) (uncompressedLength:int64) (stream:MemoryStream option) =
let pdbGetDebugInfo (mvid: byte[]) (timestamp: int32) (filepath: string) (cvChunk: BinaryChunk) (embeddedPDBChunk: BinaryChunk option) (uncompressedLength: int64) (stream: MemoryStream option) =
match stream, embeddedPDBChunk with
| None, _ | _, None -> [| pdbGetCvDebugInfo mvid timestamp filepath cvChunk |]
| Some s, Some chunk -> [| pdbGetCvDebugInfo mvid timestamp filepath cvChunk; pdbGetPdbDebugInfo chunk uncompressedLength s |]
......@@ -184,7 +184,7 @@ let hashSizeOfMD5 = 16
// If the FIPS algorithm policy is enabled on the computer (e.g., for US government employees and contractors)
// then obtaining the MD5 implementation in BCL will throw.
// In this case, catch the failure, and not set a checksum.
let checkSum (url:string) =
let checkSum (url: string) =
try
use file = FileSystem.FileStreamReadShim(url)
use md5 = System.Security.Cryptography.MD5.Create()
......@@ -219,7 +219,7 @@ let getRowCounts tableRowCounts =
tableRowCounts |> Seq.iter(fun x -> builder.Add(x))
builder.MoveToImmutable()
let generatePortablePdb (embedAllSource:bool) (embedSourceList:string list) (sourceLink:string) showTimes (info:PdbData) isDeterministic =
let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (sourceLink: string) showTimes (info: PdbData) isDeterministic =
sortMethods showTimes info
let externalRowCounts = getRowCounts info.TableRowCounts
let docs =
......@@ -228,7 +228,7 @@ let generatePortablePdb (embedAllSource:bool) (embedSourceList:string list) (sou
| _ -> info.Documents
let metadata = MetadataBuilder()
let serializeDocumentName (name:string) =
let serializeDocumentName (name: string) =
let count s c = s |> Seq.filter(fun ch -> if c = ch then true else false) |> Seq.length
let s1, s2 = '/', '\\'
......@@ -407,7 +407,7 @@ let generatePortablePdb (embedAllSource:bool) (embedSourceList:string list) (sou
// Write the scopes
let nextHandle handle = MetadataTokens.LocalVariableHandle(MetadataTokens.GetRowNumber(LocalVariableHandle.op_Implicit(handle)) + 1)
let writeMethodScope scope =
let scopeSorter (scope1:PdbMethodScope) (scope2:PdbMethodScope) =
let scopeSorter (scope1: PdbMethodScope) (scope2: PdbMethodScope) =
if scope1.StartOffset > scope2.StartOffset then 1
elif scope1.StartOffset < scope2.StartOffset then -1
elif (scope1.EndOffset - scope1.StartOffset) > (scope2.EndOffset - scope2.StartOffset) then -1
......@@ -452,7 +452,7 @@ let generatePortablePdb (embedAllSource:bool) (embedSourceList:string list) (sou
match isDeterministic with
| false -> null
| true ->
let convert (content:IEnumerable<Blob>) =
let convert (content: IEnumerable<Blob>) =
use sha = System.Security.Cryptography.SHA1.Create() // IncrementalHash is core only
let hash = content
|> Seq.collect (fun c -> c.GetBytes().Array |> sha.ComputeHash)
......@@ -468,20 +468,20 @@ let generatePortablePdb (embedAllSource:bool) (embedSourceList:string list) (sou
reportTime showTimes "PDB: Created"
(portablePdbStream.Length, contentId, portablePdbStream)
let compressPortablePdbStream (uncompressedLength:int64) (contentId:BlobContentId) (stream:MemoryStream) =
let compressPortablePdbStream (uncompressedLength: int64) (contentId: BlobContentId) (stream: MemoryStream) =
let compressedStream = new MemoryStream()
use compressionStream = new DeflateStream(compressedStream, CompressionMode.Compress,true)
stream.WriteTo(compressionStream)
(uncompressedLength, contentId, compressedStream)
let writePortablePdbInfo (contentId:BlobContentId) (stream:MemoryStream) showTimes fpdb cvChunk =
let writePortablePdbInfo (contentId: BlobContentId) (stream: MemoryStream) showTimes fpdb cvChunk =
try FileSystem.FileDelete fpdb with _ -> ()
use pdbFile = new FileStream(fpdb, FileMode.Create, FileAccess.ReadWrite)
stream.WriteTo(pdbFile)
reportTime showTimes "PDB: Closed"
pdbGetDebugInfo (contentId.Guid.ToByteArray()) (int32 (contentId.Stamp)) fpdb cvChunk None 0L None
let embedPortablePdbInfo (uncompressedLength:int64) (contentId:BlobContentId) (stream:MemoryStream) showTimes fpdb cvChunk pdbChunk =
let embedPortablePdbInfo (uncompressedLength: int64) (contentId: BlobContentId) (stream: MemoryStream) showTimes fpdb cvChunk pdbChunk =
reportTime showTimes "PDB: Closed"
let fn = Path.GetFileName(fpdb)
pdbGetDebugInfo (contentId.Guid.ToByteArray()) (int32 (contentId.Stamp)) fn cvChunk (Some pdbChunk) uncompressedLength (Some stream)
......@@ -622,15 +622,15 @@ let (?) this memb (args:'Args) : 'R =
// Creating instances of needed classes from 'Mono.CompilerServices.SymbolWriter' assembly
let monoCompilerSvc = new AssemblyName("Mono.CompilerServices.SymbolWriter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756")
let ctor (asmName:AssemblyName) clsName (args:obj[]) =
let ctor (asmName: AssemblyName) clsName (args: obj[]) =
let asm = Assembly.Load(asmName)
let ty = asm.GetType(clsName)
System.Activator.CreateInstance(ty, args)
let createSourceMethodImpl (name:string) (token:int) (namespaceID:int) =
let createSourceMethodImpl (name: string) (token: int) (namespaceID: int) =
ctor monoCompilerSvc "Mono.CompilerServices.SymbolWriter.SourceMethodImpl" [| box name; box token; box namespaceID |]
let createWriter (f:string) =
let createWriter (f: string) =
ctor monoCompilerSvc "Mono.CompilerServices.SymbolWriter.MonoSymbolWriter" [| box f |]
//---------------------------------------------------------------------
......@@ -675,7 +675,7 @@ let writeMdbInfo fmdb f info =
wr?MarkSequencePoint(sp.Offset, cue?get_SourceFile(), sp.Line, sp.Column, false)
// Walk through the tree of scopes and write all variables
let rec writeScope (scope:PdbMethodScope) =
let rec writeScope (scope: PdbMethodScope) =
wr?OpenScope(scope.StartOffset) |> ignore
for local in scope.Locals do
wr?DefineLocalVariable(local.Index, local.Name)
......@@ -701,7 +701,7 @@ let writeMdbInfo fmdb f info =
//---------------------------------------------------------------------
open Printf
let logDebugInfo (outfile:string) (info:PdbData) =
let logDebugInfo (outfile: string) (info: PdbData) =
use sw = new StreamWriter(new FileStream(outfile + ".debuginfo", FileMode.Create))
fprintfn sw "ENTRYPOINT\r\n %b\r\n" info.EntryPoint.IsSome
......@@ -727,7 +727,7 @@ let logDebugInfo (outfile:string) (info:PdbData) =
// Walk through the tree of scopes and write all variables
fprintfn sw " Scopes:"
let rec writeScope offs (scope:PdbMethodScope) =
let rec writeScope offs (scope: PdbMethodScope) =
fprintfn sw " %s- [%d-%d]" offs scope.StartOffset scope.EndOffset
if scope.Locals.Length > 0 then
fprintfn sw " %s Locals: %A" offs [ for p in scope.Locals -> sprintf "%d: %s" p.Index p.Name ]
......
......@@ -13,35 +13,35 @@ module internal Zmap =
let empty (ord: IComparer<'T>) = Map<_,_,_>.Empty(ord)
let add k v (m:Zmap<_,_>) = m.Add(k,v)
let find k (m:Zmap<_,_>) = m.[k]
let tryFind k (m:Zmap<_,_>) = m.TryFind(k)
let remove k (m:Zmap<_,_>) = m.Remove(k)
let mem k (m:Zmap<_,_>) = m.ContainsKey(k)
let iter f (m:Zmap<_,_>) = m.Iterate(f)
let first f (m:Zmap<_,_>) = m.First(fun k v -> if f k v then Some (k,v) else None)
let exists f (m:Zmap<_,_>) = m.Exists(f)
let forall f (m:Zmap<_,_>) = m.ForAll(f)
let map f (m:Zmap<_,_>) = m.MapRange(f)
let mapi f (m:Zmap<_,_>) = m.Map(f)
let fold f (m:Zmap<_,_>) x = m.Fold f x
let toList (m:Zmap<_,_>) = m.ToList()
let foldSection lo hi f (m:Zmap<_,_>) x = m.FoldSection lo hi f x
let isEmpty (m:Zmap<_,_>) = m.IsEmpty
let foldMap f z (m:Zmap<_,_>) =
let add k v (m: Zmap<_,_>) = m.Add(k,v)
let find k (m: Zmap<_,_>) = m.[k]
let tryFind k (m: Zmap<_,_>) = m.TryFind(k)
let remove k (m: Zmap<_,_>) = m.Remove(k)
let mem k (m: Zmap<_,_>) = m.ContainsKey(k)
let iter f (m: Zmap<_,_>) = m.Iterate(f)
let first f (m: Zmap<_,_>) = m.First(fun k v -> if f k v then Some (k,v) else None)
let exists f (m: Zmap<_,_>) = m.Exists(f)
let forall f (m: Zmap<_,_>) = m.ForAll(f)
let map f (m: Zmap<_,_>) = m.MapRange(f)
let mapi f (m: Zmap<_,_>) = m.Map(f)
let fold f (m: Zmap<_,_>) x = m.Fold f x
let toList (m: Zmap<_,_>) = m.ToList()
let foldSection lo hi f (m: Zmap<_,_>) x = m.FoldSection lo hi f x
let isEmpty (m: Zmap<_,_>) = m.IsEmpty
let foldMap f z (m: Zmap<_,_>) =
let m,z = m.FoldAndMap (fun k v z -> let z,v' = f z k v in v',z) z in
z,m
let choose f (m:Zmap<_,_>) = m.First(f)
let choose f (m: Zmap<_,_>) = m.First(f)
let chooseL f (m:Zmap<_,_>) =
let chooseL f (m: Zmap<_,_>) =
m.Fold (fun k v s -> match f k v with None -> s | Some x -> x::s) []
let ofList ord xs = Internal.Utilities.Collections.Tagged.Map<_,_>.FromList(ord,xs)
let keys (m:Zmap<_,_>) = m.Fold (fun k _ s -> k::s) []
let values (m:Zmap<_,_>) = m.Fold (fun _ v s -> v::s) []
let keys (m: Zmap<_,_>) = m.Fold (fun k _ s -> k::s) []
let values (m: Zmap<_,_>) = m.Fold (fun _ v s -> v::s) []
let memberOf m k = mem k m
......@@ -17,27 +17,40 @@ module internal Zset =
let empty (ord : IComparer<'T>) = Internal.Utilities.Collections.Tagged.Set<_,_>.Empty(ord)
let isEmpty (s:Zset<_>) = s.IsEmpty
let isEmpty (s: Zset<_>) = s.IsEmpty
let contains x (s: Zset<_>) = s.Contains(x)
let add x (s: Zset<_>) = s.Add(x)
let contains x (s:Zset<_>) = s.Contains(x)
let add x (s:Zset<_>) = s.Add(x)
let addList xs a = List.fold (fun a x -> add x a) a xs
let singleton ord x = add x (empty ord)
let remove x (s:Zset<_>) = s.Remove(x)
let fold (f : 'T -> 'b -> 'b) (s:Zset<_>) b = s.Fold f b
let iter f (s:Zset<_>) = s.Iterate f
let forall p (s:Zset<_>) = s.ForAll p
let count (s:Zset<_>) = s.Count
let exists p (s:Zset<_>) = s.Exists p
let subset (s1:Zset<_>) (s2:Zset<_>) = s1.IsSubsetOf s2
let equal (s1:Zset<_>) (s2:Zset<_>) = Internal.Utilities.Collections.Tagged.Set<_,_>.Equality(s1,s2)
let elements (s:Zset<_>) = s.ToList()
let filter p (s:Zset<_>) = s.Filter p
let union (s1:Zset<_>) (s2:Zset<_>) = Internal.Utilities.Collections.Tagged.Set<_,_>.Union(s1,s2)
let inter (s1:Zset<_>) (s2:Zset<_>) = Internal.Utilities.Collections.Tagged.Set<_,_>.Intersection(s1,s2)
let diff (s1:Zset<_>) (s2:Zset<_>) = Internal.Utilities.Collections.Tagged.Set<_,_>.Difference(s1,s2)
let remove x (s: Zset<_>) = s.Remove(x)
let fold (f : 'T -> 'b -> 'b) (s: Zset<_>) b = s.Fold f b
let iter f (s: Zset<_>) = s.Iterate f
let forall p (s: Zset<_>) = s.ForAll p
let count (s: Zset<_>) = s.Count
let exists p (s: Zset<_>) = s.Exists p
let subset (s1: Zset<_>) (s2: Zset<_>) = s1.IsSubsetOf s2
let equal (s1: Zset<_>) (s2: Zset<_>) = Internal.Utilities.Collections.Tagged.Set<_,_>.Equality(s1,s2)
let elements (s: Zset<_>) = s.ToList()
let filter p (s: Zset<_>) = s.Filter p
let union (s1: Zset<_>) (s2: Zset<_>) = Internal.Utilities.Collections.Tagged.Set<_,_>.Union(s1,s2)
let inter (s1: Zset<_>) (s2: Zset<_>) = Internal.Utilities.Collections.Tagged.Set<_,_>.Intersection(s1,s2)
let diff (s1: Zset<_>) (s2: Zset<_>) = Internal.Utilities.Collections.Tagged.Set<_,_>.Difference(s1,s2)
let memberOf m k = contains k m
......@@ -172,7 +172,7 @@ let mkEqualsTestConjuncts g m exprs =
let a, b = List.frontAndBack l
List.foldBack (fun e acc -> mkCond NoSequencePointAtStickyBinding SuppressSequencePointAtTarget m g.bool_ty e acc (mkFalse g m)) a b
let mkMinimalTy (g: TcGlobals) (tcref:TyconRef) =
let mkMinimalTy (g: TcGlobals) (tcref: TyconRef) =
if tcref.Deref.IsExceptionDecl then [], g.exn_ty
else generalizeTyconRef tcref
......@@ -196,13 +196,13 @@ let mkBindNullHash g m thise expr =
expr
/// Build the comparison implementation for a record type
let mkRecdCompare g tcref (tycon:Tycon) =
let mkRecdCompare g tcref (tycon: Tycon) =
let m = tycon.Range
let fields = tycon.AllInstanceFieldsAsList
let tinst, ty = mkMinimalTy g tcref
let thisv, thataddrv, thise, thataddre = mkThisVarThatVar g m ty
let compe = mkILCallGetComparer g m
let mkTest (fspec:RecdField) =
let mkTest (fspec: RecdField) =
let fty = fspec.FormalType
let fref = tcref.MakeNestedRecdFieldRef fspec
let m = fref.Range
......@@ -219,14 +219,14 @@ let mkRecdCompare g tcref (tycon:Tycon) =
/// Build the comparison implementation for a record type when parameterized by a comparer
let mkRecdCompareWithComparer g tcref (tycon:Tycon) (_thisv, thise) (_, thate) compe =
let mkRecdCompareWithComparer g tcref (tycon: Tycon) (_thisv, thise) (_, thate) compe =
let m = tycon.Range
let fields = tycon.AllInstanceFieldsAsList
let tinst, ty = mkMinimalTy g tcref
let tcv, tce = mkCompGenLocal m "objTemp" ty // let tcv = thate
let thataddrv, thataddre = mkThatAddrLocal g m ty // let thataddrv = &tcv, if a struct
let mkTest (fspec:RecdField) =
let mkTest (fspec: RecdField) =
let fty = fspec.FormalType
let fref = tcref.MakeNestedRecdFieldRef fspec
let m = fref.Range
......@@ -245,12 +245,12 @@ let mkRecdCompareWithComparer g tcref (tycon:Tycon) (_thisv, thise) (_, thate) c
/// Build the .Equals(that) equality implementation wrapper for a record type
let mkRecdEquality g tcref (tycon:Tycon) =
let mkRecdEquality g tcref (tycon: Tycon) =
let m = tycon.Range
let fields = tycon.AllInstanceFieldsAsList
let tinst, ty = mkMinimalTy g tcref
let thisv, thataddrv, thise, thataddre = mkThisVarThatVar g m ty
let mkTest (fspec:RecdField) =
let mkTest (fspec: RecdField) =
let fty = fspec.FormalType
let fref = tcref.MakeNestedRecdFieldRef fspec
let m = fref.Range
......@@ -265,13 +265,13 @@ let mkRecdEquality g tcref (tycon:Tycon) =
thisv, thatv, expr
/// Build the equality implementation for a record type when parameterized by a comparer
let mkRecdEqualityWithComparer g tcref (tycon:Tycon) (_thisv, thise) thatobje (thatv, thate) compe =
let mkRecdEqualityWithComparer g tcref (tycon: Tycon) (_thisv, thise) thatobje (thatv, thate) compe =
let m = tycon.Range
let fields = tycon.AllInstanceFieldsAsList
let tinst, ty = mkMinimalTy g tcref
let thataddrv, thataddre = mkThatAddrLocal g m ty
let mkTest (fspec:RecdField) =
let mkTest (fspec: RecdField) =
let fty = fspec.FormalType
let fref = tcref.MakeNestedRecdFieldRef fspec
let m = fref.Range
......@@ -290,11 +290,11 @@ let mkRecdEqualityWithComparer g tcref (tycon:Tycon) (_thisv, thise) thatobje (t
expr
/// Build the equality implementation for an exception definition
let mkExnEquality (g: TcGlobals) exnref (exnc:Tycon) =
let mkExnEquality (g: TcGlobals) exnref (exnc: Tycon) =
let m = exnc.Range
let thatv, thate = mkCompGenLocal m "obj" g.exn_ty
let thisv, thise = mkThisVar g m g.exn_ty
let mkTest i (rfield:RecdField) =
let mkTest i (rfield: RecdField) =
let fty = rfield.FormalType
mkCallGenericEqualityEROuter g m fty
(mkExnCaseFieldGet(thise, exnref, i, m))
......@@ -314,10 +314,10 @@ let mkExnEquality (g: TcGlobals) exnref (exnc:Tycon) =
/// Build the equality implementation for an exception definition when parameterized by a comparer
let mkExnEqualityWithComparer g exnref (exnc:Tycon) (_thisv, thise) thatobje (thatv, thate) compe =
let mkExnEqualityWithComparer g exnref (exnc: Tycon) (_thisv, thise) thatobje (thatv, thate) compe =
let m = exnc.Range
let thataddrv, thataddre = mkThatAddrLocal g m g.exn_ty
let mkTest i (rfield:RecdField) =
let mkTest i (rfield: RecdField) =
let fty = rfield.FormalType
mkCallGenericEqualityWithComparerOuter g m fty
compe
......@@ -338,7 +338,7 @@ let mkExnEqualityWithComparer g exnref (exnc:Tycon) (_thisv, thise) thatobje (th
expr
/// Build the comparison implementation for a union type
let mkUnionCompare g tcref (tycon:Tycon) =
let mkUnionCompare g tcref (tycon: Tycon) =
let m = tycon.Range
let ucases = tycon.UnionCasesAsList
let tinst, ty = mkMinimalTy g tcref
......@@ -354,7 +354,7 @@ let mkUnionCompare g tcref (tycon:Tycon) =
let m = cref.Range
let rfields = ucase.RecdFields
if isNil rfields then None else
let mkTest thise thataddre j (argty:RecdField) =
let mkTest thise thataddre j (argty: RecdField) =
mkCallGenericComparisonWithComparerOuter g m argty.FormalType
compe
(mkUnionCaseFieldGetProvenViaExprAddr(thise, cref, tinst, j, m))
......@@ -396,7 +396,7 @@ let mkUnionCompare g tcref (tycon:Tycon) =
/// Build the comparison implementation for a union type when parameterized by a comparer
let mkUnionCompareWithComparer g tcref (tycon:Tycon) (_thisv, thise) (_thatobjv, thatcaste) compe =
let mkUnionCompareWithComparer g tcref (tycon: Tycon) (_thisv, thise) (_thatobjv, thatcaste) compe =
let m = tycon.Range
let ucases = tycon.UnionCasesAsList
let tinst, ty = mkMinimalTy g tcref
......@@ -413,7 +413,7 @@ let mkUnionCompareWithComparer g tcref (tycon:Tycon) (_thisv, thise) (_thatobjv,
let rfields = ucase.RecdFields
if isNil rfields then None else
let mkTest thise thataddre j (argty:RecdField) =
let mkTest thise thataddre j (argty: RecdField) =
mkCallGenericComparisonWithComparerOuter g m argty.FormalType
compe
(mkUnionCaseFieldGetProvenViaExprAddr(thise, cref, tinst, j, m))
......@@ -458,7 +458,7 @@ let mkUnionCompareWithComparer g tcref (tycon:Tycon) (_thisv, thise) (_thatobjv,
/// Build the equality implementation for a union type
let mkUnionEquality g tcref (tycon:Tycon) =
let mkUnionEquality g tcref (tycon: Tycon) =
let m = tycon.Range
let ucases = tycon.UnionCasesAsList
let tinst, ty = mkMinimalTy g tcref
......@@ -474,7 +474,7 @@ let mkUnionEquality g tcref (tycon:Tycon) =
let rfields = ucase.RecdFields
if isNil rfields then None else
let mkTest thise thataddre j (argty:RecdField) =
let mkTest thise thataddre j (argty: RecdField) =
mkCallGenericEqualityEROuter g m argty.FormalType
(mkUnionCaseFieldGetProvenViaExprAddr(thise, cref, tinst, j, m))
(mkUnionCaseFieldGetProvenViaExprAddr(thataddre, cref, tinst, j, m))
......@@ -517,7 +517,7 @@ let mkUnionEquality g tcref (tycon:Tycon) =
thisv, thatv, expr
/// Build the equality implementation for a union type when parameterized by a comparer
let mkUnionEqualityWithComparer g tcref (tycon:Tycon) (_thisv, thise) thatobje (thatv, thate) compe =
let mkUnionEqualityWithComparer g tcref (tycon: Tycon) (_thisv, thise) thatobje (thatv, thate) compe =
let m = tycon.Range
let ucases = tycon.UnionCasesAsList
let tinst, ty = mkMinimalTy g tcref
......@@ -534,7 +534,7 @@ let mkUnionEqualityWithComparer g tcref (tycon:Tycon) (_thisv, thise) thatobje (
let rfields = ucase.RecdFields
if isNil rfields then None else
let mkTest thise thataddre j (argty:RecdField) =
let mkTest thise thataddre j (argty: RecdField) =
mkCallGenericEqualityWithComparerOuter g m argty.FormalType
compe
(mkUnionCaseFieldGetProvenViaExprAddr(thise, cref, tinst, j, m))
......@@ -584,12 +584,12 @@ let mkUnionEqualityWithComparer g tcref (tycon:Tycon) (_thisv, thise) thatobje (
//-------------------------------------------------------------------------
/// Structural hash implementation for record types when parameterized by a comparer
let mkRecdHashWithComparer g tcref (tycon:Tycon) compe =
let mkRecdHashWithComparer g tcref (tycon: Tycon) compe =
let m = tycon.Range
let fields = tycon.AllInstanceFieldsAsList
let tinst, ty = mkMinimalTy g tcref
let thisv, thise = mkThisVar g m ty
let mkFieldHash (fspec:RecdField) =
let mkFieldHash (fspec: RecdField) =
let fty = fspec.FormalType
let fref = tcref.MakeNestedRecdFieldRef fspec
let m = fref.Range
......@@ -604,11 +604,11 @@ let mkRecdHashWithComparer g tcref (tycon:Tycon) compe =
thisv, expr
/// Structural hash implementation for exception types when parameterized by a comparer
let mkExnHashWithComparer g exnref (exnc:Tycon) compe =
let mkExnHashWithComparer g exnref (exnc: Tycon) compe =
let m = exnc.Range
let thisv, thise = mkThisVar g m g.exn_ty
let mkHash i (rfield:RecdField) =
let mkHash i (rfield: RecdField) =
let fty = rfield.FormalType
let e = mkExnCaseFieldGet(thise, exnref, i, m)
......@@ -621,7 +621,7 @@ let mkExnHashWithComparer g exnref (exnc:Tycon) compe =
thisv, expr
/// Structural hash implementation for union types when parameterized by a comparer
let mkUnionHashWithComparer g tcref (tycon:Tycon) compe =
let mkUnionHashWithComparer g tcref (tycon: Tycon) compe =
let m = tycon.Range
let ucases = tycon.UnionCasesAsList
let tinst, ty = mkMinimalTy g tcref
......@@ -633,7 +633,7 @@ let mkUnionHashWithComparer g tcref (tycon:Tycon) compe =
let m = c1ref.Range
if ucase1.IsNullary then None
else
let mkHash thise j (rfield:RecdField) =
let mkHash thise j (rfield: RecdField) =
let fty = rfield.FormalType
let e = mkUnionCaseFieldGetProvenViaExprAddr(thise, c1ref, tinst, j, m)
mkCallGenericHashWithComparerOuter g m fty compe e
......@@ -674,7 +674,7 @@ let mkUnionHashWithComparer g tcref (tycon:Tycon) compe =
// though the interfaces may be discoverable via type tests.
//-------------------------------------------------------------------------
let isNominalExnc (exnc:Tycon) =
let isNominalExnc (exnc: Tycon) =
match exnc.ExceptionInfo with
| TExnAbbrevRepr _ | TExnNone | TExnAsmRepr _ -> false
| TExnFresh _ -> true
......@@ -682,18 +682,18 @@ let isNominalExnc (exnc:Tycon) =
let isTrueFSharpStructTycon _g (tycon: Tycon) =
(tycon.IsFSharpStructOrEnumTycon && not tycon.IsFSharpEnumTycon)
let canBeAugmentedWithEquals g (tycon:Tycon) =
let canBeAugmentedWithEquals g (tycon: Tycon) =
tycon.IsUnionTycon ||
tycon.IsRecordTycon ||
(tycon.IsExceptionDecl && isNominalExnc tycon) ||
isTrueFSharpStructTycon g tycon
let canBeAugmentedWithCompare g (tycon:Tycon) =
let canBeAugmentedWithCompare g (tycon: Tycon) =
tycon.IsUnionTycon ||
tycon.IsRecordTycon ||
isTrueFSharpStructTycon g tycon
let getAugmentationAttribs g (tycon:Tycon) =
let getAugmentationAttribs g (tycon: Tycon) =
canBeAugmentedWithEquals g tycon,
canBeAugmentedWithCompare g tycon,
TryFindFSharpBoolAttribute g g.attrib_NoEqualityAttribute tycon.Attribs,
......@@ -704,7 +704,7 @@ let getAugmentationAttribs g (tycon:Tycon) =
TryFindFSharpBoolAttribute g g.attrib_CustomComparisonAttribute tycon.Attribs,
TryFindFSharpBoolAttribute g g.attrib_StructuralComparisonAttribute tycon.Attribs
let CheckAugmentationAttribs isImplementation g amap (tycon:Tycon) =
let CheckAugmentationAttribs isImplementation g amap (tycon: Tycon) =
let m = tycon.Range
let attribs = getAugmentationAttribs g tycon
match attribs with
......@@ -822,7 +822,7 @@ let CheckAugmentationAttribs isImplementation g amap (tycon:Tycon) =
| _ ->
()
let TyconIsCandidateForAugmentationWithCompare (g: TcGlobals) (tycon:Tycon) =
let TyconIsCandidateForAugmentationWithCompare (g: TcGlobals) (tycon: Tycon) =
// This type gets defined in prim-types, before we can add attributes to F# type definitions
let isUnit = g.compilingFslib && tycon.DisplayName = "Unit"
not isUnit &&
......@@ -837,7 +837,7 @@ let TyconIsCandidateForAugmentationWithCompare (g: TcGlobals) (tycon:Tycon) =
// other cases
| _ -> false
let TyconIsCandidateForAugmentationWithEquals (g: TcGlobals) (tycon:Tycon) =
let TyconIsCandidateForAugmentationWithEquals (g: TcGlobals) (tycon: Tycon) =
// This type gets defined in prim-types, before we can add attributes to F# type definitions
let isUnit = g.compilingFslib && tycon.DisplayName = "Unit"
not isUnit &&
......@@ -883,7 +883,7 @@ let nonVirtualMethod c : ValMemberInfo =
let unitArg = ValReprInfo.unitArgData
let unaryArg = [ ValReprInfo.unnamedTopArg ]
let tupArg = [ [ ValReprInfo.unnamedTopArg1; ValReprInfo.unnamedTopArg1 ] ]
let mkValSpec g (tcref:TyconRef) tmty vis slotsig methn ty argData =
let mkValSpec g (tcref: TyconRef) tmty vis slotsig methn ty argData =
let m = tcref.Range
let tps = tcref.Typars(m)
let final = isUnionTy g tmty || isRecdTy g tmty || isStructTy g tmty
......@@ -893,7 +893,7 @@ let mkValSpec g (tcref:TyconRef) tmty vis slotsig methn ty argData =
let topValInfo = Some (ValReprInfo (ValReprInfo.InferTyparInfo tps, args, ValReprInfo.unnamedRetVal))
NewVal (methn, m, None, ty, Immutable, true, topValInfo, vis, ValNotInRecScope, Some(membInfo), NormalVal, [], inl, XmlDoc.Empty, true, false, false, false, false, false, None, Parent(tcref))
let MakeValsForCompareAugmentation g (tcref:TyconRef) =
let MakeValsForCompareAugmentation g (tcref: TyconRef) =
let m = tcref.Range
let _, tmty = mkMinimalTy g tcref
let tps = tcref.Typars m
......@@ -902,14 +902,14 @@ let MakeValsForCompareAugmentation g (tcref:TyconRef) =
mkValSpec g tcref tmty vis (Some(mkIComparableCompareToSlotSig g)) "CompareTo" (tps +-> (mkCompareObjTy g tmty)) unaryArg,
mkValSpec g tcref tmty vis (Some(mkGenericIComparableCompareToSlotSig g tmty)) "CompareTo" (tps +-> (mkCompareTy g tmty)) unaryArg
let MakeValsForCompareWithComparerAugmentation g (tcref:TyconRef) =
let MakeValsForCompareWithComparerAugmentation g (tcref: TyconRef) =
let m = tcref.Range
let _, tmty = mkMinimalTy g tcref
let tps = tcref.Typars m
let vis = tcref.TypeReprAccessibility
mkValSpec g tcref tmty vis (Some(mkIStructuralComparableCompareToSlotSig g)) "CompareTo" (tps +-> (mkCompareWithComparerTy g tmty)) tupArg
let MakeValsForEqualsAugmentation g (tcref:TyconRef) =
let MakeValsForEqualsAugmentation g (tcref: TyconRef) =
let m = tcref.Range
let _, tmty = mkMinimalTy g tcref
let vis = tcref.TypeReprAccessibility
......@@ -919,7 +919,7 @@ let MakeValsForEqualsAugmentation g (tcref:TyconRef) =
let nocEqualsVal = mkValSpec g tcref tmty vis (if tcref.Deref.IsExceptionDecl then None else Some(mkGenericIEquatableEqualsSlotSig g tmty)) "Equals" (tps +-> (mkEqualsTy g tmty)) unaryArg
objEqualsVal, nocEqualsVal
let MakeValsForEqualityWithComparerAugmentation g (tcref:TyconRef) =
let MakeValsForEqualityWithComparerAugmentation g (tcref: TyconRef) =
let _, tmty = mkMinimalTy g tcref
let vis = tcref.TypeReprAccessibility
let tps = tcref.Typars(tcref.Range)
......@@ -928,7 +928,7 @@ let MakeValsForEqualityWithComparerAugmentation g (tcref:TyconRef) =
let withcEqualsVal = mkValSpec g tcref tmty vis (Some(mkIStructuralEquatableEqualsSlotSig g)) "Equals" (tps +-> (mkEqualsWithComparerTy g tmty)) tupArg
objGetHashCodeVal, withcGetHashCodeVal, withcEqualsVal
let MakeBindingsForCompareAugmentation g (tycon:Tycon) =
let MakeBindingsForCompareAugmentation g (tycon: Tycon) =
let tcref = mkLocalTyconRef tycon
let m = tycon.Range
let tps = tycon.Typars(tycon.Range)
......@@ -961,7 +961,7 @@ let MakeBindingsForCompareAugmentation g (tycon:Tycon) =
elif tycon.IsRecordTycon || tycon.IsStructOrEnumTycon then mkCompare mkRecdCompare
else []
let MakeBindingsForCompareWithComparerAugmentation g (tycon:Tycon) =
let MakeBindingsForCompareWithComparerAugmentation g (tycon: Tycon) =
let tcref = mkLocalTyconRef tycon
let m = tycon.Range
let tps = tycon.Typars(tycon.Range)
......@@ -987,7 +987,7 @@ let MakeBindingsForCompareWithComparerAugmentation g (tycon:Tycon) =
elif tycon.IsRecordTycon || tycon.IsStructOrEnumTycon then mkCompare mkRecdCompareWithComparer
else []
let MakeBindingsForEqualityWithComparerAugmentation (g: TcGlobals) (tycon:Tycon) =
let MakeBindingsForEqualityWithComparerAugmentation (g: TcGlobals) (tycon: Tycon) =
let tcref = mkLocalTyconRef tycon
let m = tycon.Range
let tps = tycon.Typars(tycon.Range)
......@@ -1034,7 +1034,7 @@ let MakeBindingsForEqualityWithComparerAugmentation (g: TcGlobals) (tycon:Tycon)
elif tycon.IsExceptionDecl then mkStructuralEquatable mkExnHashWithComparer mkExnEqualityWithComparer
else []
let MakeBindingsForEqualsAugmentation (g: TcGlobals) (tycon:Tycon) =
let MakeBindingsForEqualsAugmentation (g: TcGlobals) (tycon: Tycon) =
let tcref = mkLocalTyconRef tycon
let m = tycon.Range
let tps = tycon.Typars(m)
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -836,7 +836,7 @@ let CompilePatternBasic
// The main recursive loop of the pattern match compiler
let rec InvestigateFrontiers refuted frontiers =
match frontiers with
| [] -> failwith "CompilePattern:compile - empty clauses: at least the final clause should always succeed"
| [] -> failwith "CompilePattern: compile - empty clauses: at least the final clause should always succeed"
| (Frontier (i, active, valMap)) :: rest ->
// Check to see if we've got a succeeding clause. There may still be a 'when' condition for the clause
......@@ -1315,7 +1315,7 @@ let CompilePatternBasic
dtree, targets
let isPartialOrWhenClause (c:TypedMatchClause) = isPatternPartial c.Pattern || c.GuardExpr.IsSome
let isPartialOrWhenClause (c: TypedMatchClause) = isPatternPartial c.Pattern || c.GuardExpr.IsSome
let rec CompilePattern g denv amap exprm matchm warnOnUnused actionOnFailure (origInputVal, origInputValTypars, origInputExprOpt) (clausesL: TypedMatchClause list) inputTy resultTy =
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -67,3 +67,37 @@ let semis =
printfn "Top files that have semicolon at end of line: %A" (Array.truncate 10 semis)
printfn "------NO SPACE AFTER COLON----------"
open System.Text.RegularExpressions
let noSpaceAfterColons =
let re = Regex(":[a-zA-Z]")
lines
|> Array.groupBy fst
|> Array.map (fun (file, lines) ->
file,
lines
|> Array.filter (fun (_,(_,line)) -> re.IsMatch(line))
|> Array.length)
|> Array.sortByDescending snd
printfn "Top files that have no space after colon:\n%A" (Array.truncate 10 noSpaceAfterColons)
printfn "------ SPACE BEFORE COLON----------"
let spaceBeforeColon =
let re = Regex("[^\\)] : [a-zA-Z]")
lines
|> Array.groupBy fst
|> Array.map (fun (file, lines) ->
file,
lines
|> Array.filter (fun (_,(_,line)) -> re.IsMatch(line))
|> Array.length)
|> Array.sortByDescending snd
printfn "Top files that have extra space before colon:\n%A" (Array.truncate 10 spaceBeforeColon)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册