Skip to content

Commit ae910ee

Browse files
dsymelatkin
authored andcommitted
File renamings and code cleanup
This is a pass of cleanup that renames some files to get rid of most cryptic abbreviations like "csolve", and does some other code cleanup and documentation too. - commenting in "detuple.fs" - removing ExtensibleDumper.fs which is an old adhoc debug mechanism barely used in the codebase - removing some dead code in fsc.fs (some code was already duplicated in fscmain.fs too!) - renaming check.{fs,fsi} --> PostInferenceChecks.{fs,fsi} - renaming tc.{fs,fsi} --> TypeChecker.{fs,fsi} - renaming opt.{fs,fsi} --> Optimizer.{fs,fsi} - renaming est.{fs,fsi} --> ExtensionTyping.{fs,fsi} - renaming build.{fs,fsi} --> CompileOps.{fs,fsi} - renaming fscopts.{fs,fsi} --> CompileOptions.{fs,fsi} - moving the option parser to CompileOptions.fs (where it belongs!) - marking some record types as RequireQualifiedAccess (to give better errors when editing the compiler) - removed a whole bunch of semicolons - removed some old debugging output (verboseStamps etc.) closes dotnet/fsharp#357 commit 5e692365e8fb01f279aa7836dbd3e4d6e96fff0c Author: Don Syme <donsyme@fastmail.fm> Date: Mon Aug 3 14:09:33 2015 +0100 restore code that should not have been removed commit 7e8eda59c2929b2cfc55f24a7c96cec28994e892 Author: latkin <latkin@microsoft.com> Date: Fri Jul 31 18:15:49 2015 -0700 Fix expected text in Watson test commit 248a14c766e48e42e8c6c354ba28eaaaba650ac6 Merge: 4767d5b dd8252e Author: Don Syme <donsyme@fastmail.fm> Date: Thu Jul 9 16:42:28 2015 +0100 integrate & merge with latest HEAD commit 4767d5b506b3023de5e172b4dd636cbbd726873d Author: Don Syme <donsyme@fastmail.fm> Date: Fri Apr 10 17:25:23 2015 +0200 update to force appveyor commit 0600f3eff57b1a378bb888ae52156d7eee9f53ce Author: Don Syme <donsyme@fastmail.fm> Date: Fri Apr 10 16:52:21 2015 +0200 update to force appveyor commit 02c6c6cb2659b9b37e99066f9517ad00bb697702 Author: Don Syme <donsyme@fastmail.fm> Date: Fri Apr 10 16:38:12 2015 +0200 update to fix build commit 877a1d2083328bbc0f6e65626ebd22a7da05f568 Author: Don Syme <donsyme@fastmail.fm> Date: Fri Apr 10 16:30:50 2015 +0200 update to fix build commit dd886be184867f7ee404bd3aa7b2f45480702186 Author: Don Syme <donsyme@fastmail.fm> Date: Fri Apr 10 14:03:02 2015 +0200 update to fix build commit 4f73a2b1363a1dd1d9ba1e72d6eb856a50cf078b Author: Don Syme <donsyme@fastmail.fm> Date: Fri Apr 10 13:46:02 2015 +0200 update proto (4) commit 5430936c1deae5258f3ba5d393435b12619752cf Author: Don Syme <donsyme@fastmail.fm> Date: Fri Apr 10 13:44:10 2015 +0200 update to fix build commit 93d94c9918886a7a555e514287d84139f9acd915 Author: Don Syme <donsyme@fastmail.fm> Date: Fri Apr 10 13:35:15 2015 +0200 update proto () commit 77fa7acf7d4eacb8602a0e61ef130a3482ca85c6 Author: Don Syme <donsyme@fastmail.fm> Date: Fri Apr 10 13:31:35 2015 +0200 update proto and renamings commit 8797a81bfc8009412d6875b9091b9cb786e785ba Author: Don Syme <donsyme@fastmail.fm> Date: Fri Apr 10 13:05:09 2015 +0200 integrate cleanup with fsharp4 (2) commit 31777c7fbf0f8e59fd8ef8967b618ecf76aa2b7b Merge: c6ffdb6 bb09bb3 Author: Don Syme <donsyme@fastmail.fm> Date: Fri Apr 10 12:43:00 2015 +0200 integrate cleanup with fsharp4 commit bb09bb38641fc19a2e520930ab655a047341808b Author: Don Syme <dsyme@microsoft.com> Date: Mon Dec 1 09:53:04 2014 +0000 remove more semicolons in ilwrite.fs commit a3ca1554da44bbd3563aa727d1e75f7f5ad1596e Author: Don Syme <dsyme@microsoft.com> Date: Sun Nov 30 20:23:14 2014 +0000 code cleanup inn ilwrite.fs and il.fs commit f2e301e85ded692434319b09e69250eca7a37c26 Author: Don Syme <dsyme@microsoft.com> Date: Sun Nov 30 15:54:21 2014 +0000 cleanup and rename build.fs and fscopts.fs commit 20cb9b0bf32d01cce556e37edee1ab075051c4a5 Author: Don Syme <dsyme@microsoft.com> Date: Sun Nov 30 00:19:12 2014 +0000 make some more functions into members in tast.fs commit ddadb30cd4dea8649464a3ca461a516dd0e89b16 Author: Don Syme <dsyme@microsoft.com> Date: Sat Nov 29 23:31:17 2014 +0000 additional cleanup in tast.fs (2) commit 662d87c9ac87ac6e8aaf0e3694653585c722d3fc Author: Don Syme <dsyme@microsoft.com> Date: Sat Nov 29 23:25:14 2014 +0000 additional cleanup and comments in tast.fs commit a27f527bc5f13ac561dc9b6ac7c880b17f6df7c2 Merge: 79b8293 4f94347 Author: Don Syme <dsyme@microsoft.com> Date: Sat Nov 29 20:37:10 2014 +0000 Merge branch 'master' of https://git01.codeplex.com/visualfsharp into master-cleanup-1 commit 79b8293c6c0b48482de3d7b208489f2ce9c9ec9d Author: Don Syme <dsyme@microsoft.com> Date: Sat Nov 29 20:35:26 2014 +0000 code cleanup and file rename
1 parent 607d00a commit ae910ee

File tree

93 files changed

+4727
-5079
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+4727
-5079
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ Although the primary focus of this repo is F# for Windows and the Visual Studio
4343
###Get In Touch
4444

4545
Keep up with the Visual F# Team and the development of the Visual F# Tools by following us [@VisualFSharp](https://twitter.com/VisualFSharp) or subscribing to our [team blog](http://blogs.msdn.com/b/fsharpteam/).
46+

src/absil/il.fs

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -215,22 +215,18 @@ module SHA1 =
215215
else k60to79
216216

217217

218-
type chan = SHABytes of byte[]
219-
type sha_instream =
220-
{ stream: chan;
218+
type SHAStream =
219+
{ stream: byte[];
221220
mutable pos: int;
222221
mutable eof: bool; }
223222

224-
let rot_left32 x n = (x <<< n) ||| (x >>>& (32-n))
223+
let rotLeft32 x n = (x <<< n) ||| (x >>>& (32-n))
225224

226-
let inline sha_eof sha = sha.eof
227-
228-
(* padding and length (in bits!) recorded at end *)
229-
let sha_after_eof sha =
225+
226+
// padding and length (in bits!) recorded at end
227+
let shaAfterEof sha =
230228
let n = sha.pos
231-
let len =
232-
(match sha.stream with
233-
| SHABytes s -> s.Length)
229+
let len = sha.stream.Length
234230
if n = len then 0x80
235231
else
236232
let padded_len = (((len + 9 + 63) / 64) * 64) - 8
@@ -245,22 +241,21 @@ module SHA1 =
245241
elif (n &&& 63) = 63 then (sha.eof <- true; int32 (int64 len * int64 8) &&& 0xff)
246242
else 0x0
247243

248-
let sha_read8 sha =
249-
let b =
250-
match sha.stream with
251-
| SHABytes s -> if sha.pos >= s.Length then sha_after_eof sha else int32 s.[sha.pos]
252-
sha.pos <- sha.pos + 1;
244+
let shaRead8 sha =
245+
let s = sha.stream
246+
let b = if sha.pos >= s.Length then shaAfterEof sha else int32 s.[sha.pos]
247+
sha.pos <- sha.pos + 1
253248
b
254249

255-
let sha_read32 sha =
256-
let b0 = sha_read8 sha
257-
let b1 = sha_read8 sha
258-
let b2 = sha_read8 sha
259-
let b3 = sha_read8 sha
250+
let shaRead32 sha =
251+
let b0 = shaRead8 sha
252+
let b1 = shaRead8 sha
253+
let b2 = shaRead8 sha
254+
let b3 = shaRead8 sha
260255
let res = (b0 <<< 24) ||| (b1 <<< 16) ||| (b2 <<< 8) ||| b3
261256
res
262257

263-
let sha1_hash sha =
258+
let sha1Hash sha =
264259
let mutable h0 = 0x67452301
265260
let mutable h1 = 0xEFCDAB89
266261
let mutable h2 = 0x98BADCFE
@@ -272,21 +267,21 @@ module SHA1 =
272267
let mutable d = 0
273268
let mutable e = 0
274269
let w = Array.create 80 0x00
275-
while (not (sha_eof sha)) do
270+
while (not sha.eof) do
276271
for i = 0 to 15 do
277-
w.[i] <- sha_read32 sha
272+
w.[i] <- shaRead32 sha
278273
for t = 16 to 79 do
279-
w.[t] <- rot_left32 (w.[t-3] ^^^ w.[t-8] ^^^ w.[t-14] ^^^ w.[t-16]) 1
274+
w.[t] <- rotLeft32 (w.[t-3] ^^^ w.[t-8] ^^^ w.[t-14] ^^^ w.[t-16]) 1
280275
a <- h0
281276
b <- h1
282277
c <- h2
283278
d <- h3
284279
e <- h4
285280
for t = 0 to 79 do
286-
let temp = (rot_left32 a 5) + f(t,b,c,d) + e + w.[t] + k(t)
281+
let temp = (rotLeft32 a 5) + f(t,b,c,d) + e + w.[t] + k(t)
287282
e <- d
288283
d <- c
289-
c <- rot_left32 b 30
284+
c <- rotLeft32 b 30
290285
b <- a
291286
a <- temp
292287
h0 <- h0 + a
@@ -297,7 +292,7 @@ module SHA1 =
297292
h0,h1,h2,h3,h4
298293

299294
let sha1HashBytes s =
300-
let (_h0,_h1,_h2,h3,h4) = sha1_hash { stream = SHABytes s; pos = 0; eof = false } // the result of the SHA algorithm is stored in registers 3 and 4
295+
let (_h0,_h1,_h2,h3,h4) = sha1Hash { stream = s; pos = 0; eof = false } // the result of the SHA algorithm is stored in registers 3 and 4
301296
Array.map byte [| b0 h4; b1 h4; b2 h4; b3 h4; b0 h3; b1 h3; b2 h3; b3 h3; |]
302297

303298

src/absil/ilascii.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
1212
open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types
1313
open Microsoft.FSharp.Compiler.AbstractIL.IL
1414

15-
// set to the proper value at build.fs (BuildFrameworkTcImports)
15+
// set to the proper value at CompileOps.fs (BuildFrameworkTcImports)
1616
let parseILGlobals = ref EcmaILGlobals
1717

1818
// --------------------------------------------------------------------

src/absil/illib.fs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ module Dictionary =
465465

466466
// FUTURE CLEANUP: remove this adhoc collection
467467
type Hashset<'T> = Dictionary<'T,int>
468+
468469
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
469470
module Hashset =
470471
let create (n:int) = new Hashset<'T>(n, HashIdentity.Structural)
@@ -498,6 +499,28 @@ type ResultOrException<'TResult> =
498499
| Result of 'TResult
499500
| Exception of System.Exception
500501

502+
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
503+
module ResultOrException =
504+
505+
let success a = Result a
506+
let raze (b:exn) = Exception b
507+
508+
// map
509+
let (|?>) res f =
510+
match res with
511+
| Result x -> Result(f x )
512+
| Exception err -> Exception err
513+
514+
let ForceRaise res =
515+
match res with
516+
| Result x -> x
517+
| Exception err -> raise err
518+
519+
let otherwise f x =
520+
match x with
521+
| Result x -> success x
522+
| Exception _err -> f()
523+
501524

502525
//-------------------------------------------------------------------------
503526
// Library: extensions to flat list (immutable arrays)

0 commit comments

Comments
 (0)