Skip to content

Commit 1e8b300

Browse files
committed
Merge pull request #508 from dsyme/code-align-1
code alignment with visualfsharp
2 parents ae86c2a + 71f7f5e commit 1e8b300

30 files changed

+163
-597
lines changed

src/absil/il.fs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -914,9 +914,6 @@ type ILAttribElem =
914914
type ILAttributeNamedArg = (string * ILType * bool * ILAttribElem)
915915
type ILAttribute =
916916
{ Method: ILMethodSpec;
917-
#if FX_REFLECTION_EMITS_CUSTOM_ATTRIBUTES_USING_BUILDER
918-
Arguments: ILAttribElem list * ILAttributeNamedArg list
919-
#endif
920917
Data: byte[] }
921918

922919
[<NoEquality; NoComparison>]
@@ -4416,9 +4413,6 @@ let mkILCustomAttribMethRef (ilg: ILGlobals) (mspec:ILMethodSpec, fixedArgs: lis
44164413
yield! encodeCustomAttrNamedArg ilg namedArg |]
44174414

44184415
{ Method = mspec;
4419-
#if FX_REFLECTION_EMITS_CUSTOM_ATTRIBUTES_USING_BUILDER
4420-
Arguments = fixedArgs, namedArgs
4421-
#endif
44224416
Data = args }
44234417

44244418
let mkILCustomAttribute ilg (tref,argtys,argvs,propvs) =

src/absil/il.fsi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,9 +1028,6 @@ type ILAttributeNamedArg = string * ILType * bool * ILAttribElem
10281028
/// to ILAttribElem's as best as possible.
10291029
type ILAttribute =
10301030
{ Method: ILMethodSpec;
1031-
#if FX_REFLECTION_EMITS_CUSTOM_ATTRIBUTES_USING_BUILDER
1032-
Arguments: ILAttribElem list * ILAttributeNamedArg list
1033-
#endif
10341031
Data: byte[] }
10351032

10361033
[<NoEquality; NoComparison; Sealed>]

src/absil/illib.fs

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -628,27 +628,6 @@ module Eventually =
628628
let force e = Option.get (forceWhile (fun () -> true) e)
629629

630630
/// Keep running the computation bit by bit until a time limit is reached.
631-
#if FX_NO_SYSTEM_DIAGNOSTICS_STOPWATCH
632-
// There is no Stopwatch on Silverlight, so use DateTime.Now. I'm not sure of the pros and cons of this.
633-
// An alternative is just to always force the computation all the way to the end.
634-
//let repeatedlyProgressUntilDoneOrTimeShareOver _timeShareInMilliseconds runner e =
635-
// Done (runner (fun () -> force e))
636-
let repeatedlyProgressUntilDoneOrTimeShareOver (timeShareInMilliseconds:int64) runner e =
637-
let rec runTimeShare e =
638-
runner (fun () ->
639-
let sw = System.DateTime.Now
640-
let rec loop e =
641-
match e with
642-
| Done _ -> e
643-
| NotYetDone (work) ->
644-
let ts = System.DateTime.Now - sw
645-
if ts.TotalMilliseconds > float timeShareInMilliseconds then
646-
NotYetDone(fun () -> runTimeShare e)
647-
else
648-
loop(work())
649-
loop e)
650-
runTimeShare e
651-
#else
652631
/// The runner gets called each time the computation is restarted
653632
let repeatedlyProgressUntilDoneOrTimeShareOver timeShareInMilliseconds runner e =
654633
let sw = new System.Diagnostics.Stopwatch()
@@ -667,7 +646,6 @@ module Eventually =
667646
loop(work())
668647
loop(e))
669648
runTimeShare e
670-
#endif
671649

672650
let rec bind k e =
673651
match e with
@@ -990,81 +968,6 @@ module Shim =
990968
abstract AssemblyLoadFrom: fileName:string -> System.Reflection.Assembly
991969
abstract AssemblyLoad: assemblyName:System.Reflection.AssemblyName -> System.Reflection.Assembly
992970

993-
#if FX_FILE_SYSTEM_USES_ISOLATED_STORAGE
994-
open System.IO.IsolatedStorage
995-
open System.Windows
996-
open System
997-
998-
type DefaultFileSystem() =
999-
interface IFileSystem with
1000-
member this.ReadAllBytesShim (fileName:string) =
1001-
use stream = this.FileStreamReadShim fileName
1002-
let len = stream.Length
1003-
let buf = Array.zeroCreate<byte> (int len)
1004-
stream.Read(buf, 0, (int len)) |> ignore
1005-
buf
1006-
1007-
1008-
member this.AssemblyLoadFrom(fileName:string) =
1009-
let load() =
1010-
let assemblyPart = System.Windows.AssemblyPart()
1011-
let assemblyStream = this.FileStreamReadShim(fileName)
1012-
assemblyPart.Load(assemblyStream)
1013-
if System.Windows.Deployment.Current.Dispatcher.CheckAccess() then
1014-
load()
1015-
else
1016-
let resultTask = System.Threading.Tasks.TaskCompletionSource<System.Reflection.Assembly>()
1017-
System.Windows.Deployment.Current.Dispatcher.BeginInvoke(Action(fun () -> resultTask.SetResult (load()))) |> ignore
1018-
resultTask.Task.Result
1019-
1020-
member this.AssemblyLoad(assemblyName:System.Reflection.AssemblyName) =
1021-
try
1022-
System.Reflection.Assembly.Load(assemblyName.FullName)
1023-
with e ->
1024-
this.AssemblyLoadFrom(assemblyName.Name + ".dll")
1025-
1026-
member __.FileStreamReadShim (fileName:string) =
1027-
match Application.GetResourceStream(System.Uri(fileName,System.UriKind.Relative)) with
1028-
| null -> IsolatedStorageFile.GetUserStoreForApplication().OpenFile(fileName, System.IO.FileMode.Open) :> System.IO.Stream
1029-
| resStream -> resStream.Stream
1030-
1031-
member __.FileStreamCreateShim (fileName:string) =
1032-
System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication().CreateFile(fileName) :> Stream
1033-
1034-
member __.FileStreamWriteExistingShim (fileName:string) =
1035-
let isf = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication()
1036-
new System.IO.IsolatedStorage.IsolatedStorageFileStream(fileName,FileMode.Open,FileAccess.Write,isf) :> Stream
1037-
1038-
member __.GetFullPathShim (fileName:string) = fileName
1039-
member __.IsPathRootedShim (pathName:string) = true
1040-
1041-
member __.IsInvalidPathShim(path:string) =
1042-
let isInvalidPath(p:string) =
1043-
String.IsNullOrEmpty(p) || p.IndexOfAny(System.IO.Path.GetInvalidPathChars()) <> -1
1044-
1045-
let isInvalidDirectory(d:string) =
1046-
d=null || d.IndexOfAny(Path.GetInvalidPathChars()) <> -1
1047-
1048-
isInvalidPath (path) ||
1049-
let directory = Path.GetDirectoryName(path)
1050-
let filename = Path.GetFileName(path)
1051-
isInvalidDirectory(directory) || isInvalidPath(filename)
1052-
1053-
member __.GetTempPathShim() = "."
1054-
1055-
member __.GetLastWriteTimeShim (fileName:string) =
1056-
match Application.GetResourceStream(System.Uri(fileName,System.UriKind.Relative)) with
1057-
| null -> IsolatedStorageFile.GetUserStoreForApplication().GetLastAccessTime(fileName).LocalDateTime
1058-
| _resStream -> System.DateTime.Today.Date
1059-
member __.SafeExists (fileName:string) =
1060-
match Application.GetResourceStream(System.Uri(fileName,System.UriKind.Relative)) with
1061-
| null -> IsolatedStorageFile.GetUserStoreForApplication().FileExists fileName
1062-
| resStream -> resStream.Stream <> null
1063-
member __.FileDelete (fileName:string) =
1064-
match Application.GetResourceStream(System.Uri(fileName,System.UriKind.Relative)) with
1065-
| null -> IsolatedStorageFile.GetUserStoreForApplication().DeleteFile fileName
1066-
| _resStream -> ()
1067-
#else
1068971

1069972
type DefaultFileSystem() =
1070973
interface IFileSystem with
@@ -1104,14 +1007,9 @@ module Shim =
11041007
member __.GetLastWriteTimeShim (fileName:string) = File.GetLastWriteTime fileName
11051008
member __.SafeExists (fileName:string) = System.IO.File.Exists fileName
11061009
member __.FileDelete (fileName:string) = System.IO.File.Delete fileName
1107-
#endif
11081010

11091011
type System.Text.Encoding with
11101012
static member GetEncodingShim(n:int) =
1111-
#if FX_NO_GET_ENCODING_BY_INTEGER
1112-
System.Text.Encoding.GetEncoding(n.ToString())
1113-
#else
11141013
System.Text.Encoding.GetEncoding(n)
1115-
#endif
11161014

11171015
let mutable FileSystem = DefaultFileSystem() :> IFileSystem

src/absil/ilread.fs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ open System.Collections.Generic
1717
open Internal.Utilities
1818
open Microsoft.FSharp.Compiler.AbstractIL
1919
open Microsoft.FSharp.Compiler.AbstractIL.Internal
20-
#if NO_PDB_READER
21-
#else
2220
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Support
23-
#endif
2421
open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
2522
open Microsoft.FSharp.Compiler.AbstractIL.Internal.BinaryConstants
2623
open Microsoft.FSharp.Compiler.AbstractIL.IL
@@ -105,10 +102,6 @@ type BinaryFile() =
105102
abstract CountUtf8String : addr:int -> int
106103
abstract ReadUTF8String : addr: int -> string
107104

108-
#if FX_NO_NATIVE_MEMORY_MAPPED_FILES
109-
110-
#else
111-
112105
/// Read file from memory mapped files
113106
module MemoryMapping =
114107

@@ -216,7 +209,6 @@ type MemoryMappedFile(hMap: MemoryMapping.HANDLE, start:nativeint) =
216209
new System.String(NativePtr.ofNativeInt (m.Addr i), 0, n, System.Text.Encoding.UTF8)
217210

218211

219-
#endif
220212
//---------------------------------------------------------------------
221213
// Read file from memory blocks
222214
//---------------------------------------------------------------------
@@ -919,11 +911,7 @@ type ILReaderContext =
919911
{ ilg: ILGlobals;
920912
dataEndPoints: Lazy<int32 list>;
921913
sorted: int64;
922-
#if NO_PDB_READER
923-
pdb: obj option;
924-
#else
925914
pdb: (PdbReader * (string -> ILSourceDocument)) option;
926-
#endif
927915
entryPointToken: TableName * int;
928916
getNumRows: TableName -> int;
929917
textSegmentPhysicalLoc : int32;
@@ -1461,9 +1449,6 @@ let readBlobHeapAsDouble ctxt vidx = fst (sigptrGetDouble (readBlobHeap ctxt vid
14611449
// (e) the start of the native resources attached to the binary if any
14621450
// ----------------------------------------------------------------------*)
14631451

1464-
#if NO_PDB_READER
1465-
let readNativeResources _ctxt = []
1466-
#else
14671452
let readNativeResources ctxt =
14681453
let nativeResources =
14691454
if ctxt.nativeResourcesSize = 0x0 || ctxt.nativeResourcesAddr = 0x0 then
@@ -1472,7 +1457,6 @@ let readNativeResources ctxt =
14721457
[ (lazy (let linkedResource = seekReadBytes ctxt.is (ctxt.anyV2P (ctxt.infile + ": native resources",ctxt.nativeResourcesAddr)) ctxt.nativeResourcesSize
14731458
unlinkResource ctxt.nativeResourcesAddr linkedResource)) ]
14741459
nativeResources
1475-
#endif
14761460

14771461
let dataEndPoints ctxtH =
14781462
lazy
@@ -2528,9 +2512,6 @@ and seekReadCustomAttr ctxt (TaggedIndex(cat,idx),b) =
25282512
and seekReadCustomAttrUncached ctxtH (CustomAttrIdx (cat,idx,valIdx)) =
25292513
let ctxt = getHole ctxtH
25302514
{ Method=seekReadCustomAttrType ctxt (TaggedIndex(cat,idx));
2531-
#if FX_REFLECTION_EMITS_CUSTOM_ATTRIBUTES_USING_BUILDER
2532-
Arguments = [], []
2533-
#endif
25342515
Data=
25352516
match readBlobHeapOption ctxt valIdx with
25362517
| Some bytes -> bytes
@@ -2886,11 +2867,7 @@ and seekReadTopCode ctxt numtypars (sz:int) start seqpoints =
28862867
let instrs = ibuf.ToArray()
28872868
instrs,rawToLabel, lab2pc, raw2nextLab
28882869

2889-
#if NO_PDB_READER
2890-
and seekReadMethodRVA ctxt (_idx,nm,_internalcall,noinline,numtypars) rva =
2891-
#else
28922870
and seekReadMethodRVA ctxt (idx,nm,_internalcall,noinline,numtypars) rva =
2893-
#endif
28942871
mkMethBodyLazyAux
28952872
(lazy
28962873
begin
@@ -2900,9 +2877,6 @@ and seekReadMethodRVA ctxt (idx,nm,_internalcall,noinline,numtypars) rva =
29002877
// -- an overall range for the method
29012878
// -- the sequence points for the method
29022879
let localPdbInfos, methRangePdbInfo, seqpoints =
2903-
#if NO_PDB_READER
2904-
[], None, []
2905-
#else
29062880
match ctxt.pdb with
29072881
| None ->
29082882
[], None, []
@@ -2959,7 +2933,6 @@ and seekReadMethodRVA ctxt (idx,nm,_internalcall,noinline,numtypars) rva =
29592933
with e ->
29602934
// "* Warning: PDB info for method "+nm+" could not be read and will be ignored: "+e.Message
29612935
[],None,[]
2962-
#endif // NO_PDB_READER
29632936

29642937
let baseRVA = ctxt.anyV2P("method rva",rva)
29652938
// ": reading body of method "+nm+" at rva "+string rva+", phys "+string baseRVA
@@ -3258,8 +3231,6 @@ and seekReadTopExportedTypes ctxt () =
32583231
done;
32593232
List.rev !res)
32603233

3261-
#if NO_PDB_READER
3262-
#else
32633234
let getPdbReader opts infile =
32643235
match opts.pdbPath with
32653236
| None -> None
@@ -3280,7 +3251,6 @@ let getPdbReader opts infile =
32803251
let docfun url = if tab.ContainsKey url then tab.[url] else failwith ("Document with URL "+url+" not found in list of documents in the PDB file")
32813252
Some (pdbr, docfun)
32823253
with e -> dprintn ("* Warning: PDB file could not be read and will be ignored: "+e.Message); None
3283-
#endif
32843254

32853255
//-----------------------------------------------------------------------
32863256
// Crack the binary headers, build a reader context and return the lazy
@@ -3831,11 +3801,7 @@ let rec genOpenBinaryReader infile is opts =
38313801
//-----------------------------------------------------------------------
38323802
// Set up the PDB reader so we can read debug info for methods.
38333803
// ----------------------------------------------------------------------
3834-
#if NO_PDB_READER
3835-
let pdb = None
3836-
#else
38373804
let pdb = if runningOnMono then None else getPdbReader opts infile
3838-
#endif
38393805

38403806
let rowAddr (tab:TableName) idx = tablePhysLocations.[tab.Index] + (idx - 1) * tableRowSizes.[tab.Index]
38413807

0 commit comments

Comments
 (0)