提交 ae910eec 编写于 作者: D Don Syme 提交者: latkin

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 https://github.com/Microsoft/visualfsharp/pull/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 dd8252eb
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: c6ffdb62 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 4f943472
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
上级 607d00a7
......@@ -43,3 +43,4 @@ Although the primary focus of this repo is F# for Windows and the Visual Studio
###Get In Touch
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/).
......@@ -215,22 +215,18 @@ module SHA1 =
else k60to79
type chan = SHABytes of byte[]
type sha_instream =
{ stream: chan;
type SHAStream =
{ stream: byte[];
mutable pos: int;
mutable eof: bool; }
let rot_left32 x n = (x <<< n) ||| (x >>>& (32-n))
let rotLeft32 x n = (x <<< n) ||| (x >>>& (32-n))
let inline sha_eof sha = sha.eof
(* padding and length (in bits!) recorded at end *)
let sha_after_eof sha =
// padding and length (in bits!) recorded at end
let shaAfterEof sha =
let n = sha.pos
let len =
(match sha.stream with
| SHABytes s -> s.Length)
let len = sha.stream.Length
if n = len then 0x80
else
let padded_len = (((len + 9 + 63) / 64) * 64) - 8
......@@ -245,22 +241,21 @@ module SHA1 =
elif (n &&& 63) = 63 then (sha.eof <- true; int32 (int64 len * int64 8) &&& 0xff)
else 0x0
let sha_read8 sha =
let b =
match sha.stream with
| SHABytes s -> if sha.pos >= s.Length then sha_after_eof sha else int32 s.[sha.pos]
sha.pos <- sha.pos + 1;
let shaRead8 sha =
let s = sha.stream
let b = if sha.pos >= s.Length then shaAfterEof sha else int32 s.[sha.pos]
sha.pos <- sha.pos + 1
b
let sha_read32 sha =
let b0 = sha_read8 sha
let b1 = sha_read8 sha
let b2 = sha_read8 sha
let b3 = sha_read8 sha
let shaRead32 sha =
let b0 = shaRead8 sha
let b1 = shaRead8 sha
let b2 = shaRead8 sha
let b3 = shaRead8 sha
let res = (b0 <<< 24) ||| (b1 <<< 16) ||| (b2 <<< 8) ||| b3
res
let sha1_hash sha =
let sha1Hash sha =
let mutable h0 = 0x67452301
let mutable h1 = 0xEFCDAB89
let mutable h2 = 0x98BADCFE
......@@ -272,21 +267,21 @@ module SHA1 =
let mutable d = 0
let mutable e = 0
let w = Array.create 80 0x00
while (not (sha_eof sha)) do
while (not sha.eof) do
for i = 0 to 15 do
w.[i] <- sha_read32 sha
w.[i] <- shaRead32 sha
for t = 16 to 79 do
w.[t] <- rot_left32 (w.[t-3] ^^^ w.[t-8] ^^^ w.[t-14] ^^^ w.[t-16]) 1
w.[t] <- rotLeft32 (w.[t-3] ^^^ w.[t-8] ^^^ w.[t-14] ^^^ w.[t-16]) 1
a <- h0
b <- h1
c <- h2
d <- h3
e <- h4
for t = 0 to 79 do
let temp = (rot_left32 a 5) + f(t,b,c,d) + e + w.[t] + k(t)
let temp = (rotLeft32 a 5) + f(t,b,c,d) + e + w.[t] + k(t)
e <- d
d <- c
c <- rot_left32 b 30
c <- rotLeft32 b 30
b <- a
a <- temp
h0 <- h0 + a
......@@ -297,7 +292,7 @@ module SHA1 =
h0,h1,h2,h3,h4
let sha1HashBytes s =
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
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
Array.map byte [| b0 h4; b1 h4; b2 h4; b3 h4; b0 h3; b1 h3; b2 h3; b3 h3; |]
......
......@@ -12,7 +12,7 @@ open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types
open Microsoft.FSharp.Compiler.AbstractIL.IL
// set to the proper value at build.fs (BuildFrameworkTcImports)
// set to the proper value at CompileOps.fs (BuildFrameworkTcImports)
let parseILGlobals = ref EcmaILGlobals
// --------------------------------------------------------------------
......
......@@ -465,6 +465,7 @@ module Dictionary =
// FUTURE CLEANUP: remove this adhoc collection
type Hashset<'T> = Dictionary<'T,int>
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Hashset =
let create (n:int) = new Hashset<'T>(n, HashIdentity.Structural)
......@@ -498,6 +499,28 @@ type ResultOrException<'TResult> =
| Result of 'TResult
| Exception of System.Exception
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module ResultOrException =
let success a = Result a
let raze (b:exn) = Exception b
// map
let (|?>) res f =
match res with
| Result x -> Result(f x )
| Exception err -> Exception err
let ForceRaise res =
match res with
| Result x -> x
| Exception err -> raise err
let otherwise f x =
match x with
| Result x -> success x
| Exception _err -> f()
//-------------------------------------------------------------------------
// Library: extensions to flat list (immutable arrays)
......
此差异已折叠。
......@@ -17,20 +17,15 @@ type ILStrongNameSigner =
type options =
{ ilg: ILGlobals
pdbfile: string option;
signer : ILStrongNameSigner option;
fixupOverlappingSequencePoints : bool;
emitTailcalls: bool;
showTimes : bool;
pdbfile: string option
signer : ILStrongNameSigner option
fixupOverlappingSequencePoints : bool
emitTailcalls: bool
showTimes : bool
dumpDebugInfo : bool }
/// Write a binary to the file system. Extra configuration parameters can also be specified.
val WriteILBinary:
filename: string ->
options: options ->
input: ILModuleDef ->
noDebugData: bool ->
unit
val WriteILBinary: filename: string * options: options * input: ILModuleDef * noDebugData: bool -> unit
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
/// Generate the hash/compare functions we add to user-defined types by default.
module internal Microsoft.FSharp.Compiler.Augment
module internal Microsoft.FSharp.Compiler.AugmentWithHashCompare
open Internal.Utilities
open Microsoft.FSharp.Compiler
open Microsoft.FSharp.Compiler.AbstractIL
......@@ -14,7 +15,7 @@ open Microsoft.FSharp.Compiler.Ast
open Microsoft.FSharp.Compiler.ErrorLogger
open Microsoft.FSharp.Compiler.PrettyNaming
open Microsoft.FSharp.Compiler.Lib
open Microsoft.FSharp.Compiler.Env
open Microsoft.FSharp.Compiler.TcGlobals
open Microsoft.FSharp.Compiler.Infos
let mkIComparableCompareToSlotSig g =
......@@ -189,7 +190,7 @@ let mkRecdCompare g tcref (tycon:Tycon) =
let compe = mkILCallGetComparer g m
let mkTest (fspec:RecdField) =
let fty = fspec.FormalType
let fref = mkNestedRecdFieldRef tcref fspec
let fref = tcref.MakeNestedRecdFieldRef fspec
let m = fref.Range
mkCallGenericComparisonWithComparerOuter g m fty
compe
......@@ -213,7 +214,7 @@ let mkRecdCompareWithComparer g tcref (tycon:Tycon) (_thisv,thise) (_,thate) com
let mkTest (fspec:RecdField) =
let fty = fspec.FormalType
let fref = mkNestedRecdFieldRef tcref fspec
let fref = tcref.MakeNestedRecdFieldRef fspec
let m = fref.Range
mkCallGenericComparisonWithComparerOuter g m fty
compe
......@@ -237,7 +238,7 @@ let mkRecdEquality g tcref (tycon:Tycon) =
let thisv,thatv,thise,thate = mkThisVarThatVar g m ty
let mkTest (fspec:RecdField) =
let fty = fspec.FormalType
let fref = mkNestedRecdFieldRef tcref fspec
let fref = tcref.MakeNestedRecdFieldRef fspec
let m = fref.Range
mkCallGenericEqualityEROuter g m fty
(mkRecdFieldGetViaExprAddr(thise, fref, tinst, m))
......@@ -258,7 +259,7 @@ let mkRecdEqualityWithComparer g tcref (tycon:Tycon) (_thisv,thise) thatobje (th
let mkTest (fspec:RecdField) =
let fty = fspec.FormalType
let fref = mkNestedRecdFieldRef tcref fspec
let fref = tcref.MakeNestedRecdFieldRef fspec
let m = fref.Range
mkCallGenericEqualityWithComparerOuter g m fty
......@@ -338,7 +339,7 @@ let mkUnionCompare g tcref (tycon:Tycon) =
let expr =
let mbuilder = new MatchBuilder(NoSequencePointAtInvisibleBinding,m )
let mkCase ucase =
let cref = mkNestedUnionCaseRef tcref ucase
let cref = tcref.MakeNestedUnionCaseRef ucase
let m = cref.Range
let thisucv,thisucve = mkCompGenLocal m "thisCast" (mkProvenUnionCaseTy cref tinst)
let thatucv,thatucve = mkCompGenLocal m "objCast" (mkProvenUnionCaseTy cref tinst)
......@@ -395,7 +396,7 @@ let mkUnionCompareWithComparer g tcref (tycon:Tycon) (_thisv,thise) (thatv,thate
let expr =
let mbuilder = new MatchBuilder(NoSequencePointAtInvisibleBinding,m )
let mkCase ucase =
let cref = mkNestedUnionCaseRef tcref ucase
let cref = tcref.MakeNestedUnionCaseRef ucase
let m = cref.Range
let thisucv,thisucve = mkCompGenLocal m "thisCastu" (mkProvenUnionCaseTy cref tinst)
let thatucv,thatucve = mkCompGenLocal m "thatCastu" (mkProvenUnionCaseTy cref tinst)
......@@ -454,7 +455,7 @@ let mkUnionEquality g tcref (tycon:Tycon) =
let expr =
let mbuilder = new MatchBuilder(NoSequencePointAtInvisibleBinding,m )
let mkCase ucase =
let cref = mkNestedUnionCaseRef tcref ucase
let cref = tcref.MakeNestedUnionCaseRef ucase
let m = cref.Range
let thisucv,thisucve = mkCompGenLocal m "thisCast" (mkProvenUnionCaseTy cref tinst)
let thatucv,thatucve = mkCompGenLocal m "objCast" (mkProvenUnionCaseTy cref tinst)
......@@ -509,7 +510,7 @@ let mkUnionEqualityWithComparer g tcref (tycon:Tycon) (_thisv,thise) thatobje (t
let expr =
let mbuilder = new MatchBuilder(NoSequencePointAtInvisibleBinding,m )
let mkCase ucase =
let cref = mkNestedUnionCaseRef tcref ucase
let cref = tcref.MakeNestedUnionCaseRef ucase
let m = cref.Range
let thisucv,thisucve = mkCompGenLocal m "thisCastu" (mkProvenUnionCaseTy cref tinst)
let thatucv,thatucve = mkCompGenLocal m "thatCastu" (mkProvenUnionCaseTy cref tinst)
......@@ -566,7 +567,7 @@ let mkRecdHashWithComparer g tcref (tycon:Tycon) compe =
let thisv,thise = mkThisVar g m ty
let mkFieldHash (fspec:RecdField) =
let fty = fspec.FormalType
let fref = mkNestedRecdFieldRef tcref fspec
let fref = tcref.MakeNestedRecdFieldRef fspec
let m = fref.Range
let e = mkRecdFieldGetViaExprAddr(thise, fref, tinst, m)
......@@ -604,7 +605,7 @@ let mkUnionHashWithComparer g tcref (tycon:Tycon) compe =
let mbuilder = new MatchBuilder(NoSequencePointAtInvisibleBinding,m )
let accv,acce = mkMutableCompGenLocal m "i" g.int_ty
let mkCase i ucase1 =
let c1ref = mkNestedUnionCaseRef tcref ucase1
let c1ref = tcref.MakeNestedUnionCaseRef ucase1
let ucv,ucve = mkCompGenLocal m "unionCase" (mkProvenUnionCaseTy c1ref tinst)
let m = c1ref.Range
let mkHash j (rfield:RecdField) =
......@@ -817,7 +818,7 @@ let TyconIsCandidateForAugmentationWithHash g tycon = TyconIsCandidateForAugment
// IComparable semantics associated with F# types.
//-------------------------------------------------------------------------
let slotImplMethod (final,c,slotsig) =
let slotImplMethod (final,c,slotsig) : ValMemberInfo =
{ ImplementedSlotSigs=[slotsig];
MemberFlags=
{ IsInstance=true;
......@@ -828,7 +829,7 @@ let slotImplMethod (final,c,slotsig) =
IsImplemented=false;
ApparentParent=c}
let nonVirtualMethod c =
let nonVirtualMethod c : ValMemberInfo =
{ ImplementedSlotSigs=[];
MemberFlags={ IsInstance=true;
IsDispatchSlot=false;
......
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
/// Generate the hash/compare functions we add to user-defined types by default.
module internal Microsoft.FSharp.Compiler.Augment
module internal Microsoft.FSharp.Compiler.AugmentWithHashCompare
open Internal.Utilities
open Microsoft.FSharp.Compiler.AbstractIL
......@@ -9,7 +9,7 @@ open Microsoft.FSharp.Compiler.AbstractIL.Internal
open Microsoft.FSharp.Compiler
open Microsoft.FSharp.Compiler.Tast
open Microsoft.FSharp.Compiler.Env
open Microsoft.FSharp.Compiler.TcGlobals
val CheckAugmentationAttribs : bool -> TcGlobals -> Import.ImportMap -> Tycon -> unit
val TyconIsCandidateForAugmentationWithCompare : TcGlobals -> Tycon -> bool
......
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
module internal Microsoft.FSharp.Compiler.Formats
module internal Microsoft.FSharp.Compiler.CheckFormatStrings
open Internal.Utilities
open Microsoft.FSharp.Compiler
......@@ -11,7 +11,7 @@ open Microsoft.FSharp.Compiler.Ast
open Microsoft.FSharp.Compiler.ErrorLogger
open Microsoft.FSharp.Compiler.Tast
open Microsoft.FSharp.Compiler.Tastops
open Microsoft.FSharp.Compiler.Env
open Microsoft.FSharp.Compiler.TcGlobals
open Microsoft.FSharp.Compiler.ConstraintSolver
type FormatItem = Simple of TType | FuncAndVal
......
......@@ -5,11 +5,12 @@
///
/// Must be updated if the Printf runtime component is updated.
module internal Microsoft.FSharp.Compiler.Formats
module internal Microsoft.FSharp.Compiler.CheckFormatStrings
open Internal.Utilities
open Microsoft.FSharp.Compiler
open Microsoft.FSharp.Compiler.Tast
open Microsoft.FSharp.Compiler.TcGlobals
open Microsoft.FSharp.Compiler.AbstractIL.Internal
val ParseFormatString : Range.range -> Env.TcGlobals -> string -> TType -> TType -> TType -> TType * TType
val ParseFormatString : Range.range -> TcGlobals -> string -> TType -> TType -> TType -> TType * TType
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
module internal Microsoft.FSharp.Compiler.Fscopts
module internal Microsoft.FSharp.Compiler.CompileOptions
open Internal.Utilities
open Microsoft.FSharp.Compiler
open Microsoft.FSharp.Compiler.AbstractIL
open Microsoft.FSharp.Compiler.AbstractIL.IL
open Microsoft.FSharp.Compiler.AbstractIL.Internal
open Microsoft.FSharp.Compiler
open Microsoft.FSharp.Compiler.Build
open Microsoft.FSharp.Compiler.CompileOps
open Microsoft.FSharp.Compiler.ErrorLogger
open Microsoft.FSharp.Compiler.Ast
open Microsoft.FSharp.Compiler.Tast
#if NO_COMPILER_BACKEND
#else
open Microsoft.FSharp.Compiler.Ilxgen
#endif
open Microsoft.FSharp.Compiler.Import
open Microsoft.FSharp.Compiler.Opt
open Microsoft.FSharp.Compiler.Env
open Microsoft.FSharp.Compiler.Optimizer
open Microsoft.FSharp.Compiler.TcGlobals
//----------------------------------------------------------------------------
// Compiler Option Parser
//--------------------------------------------------------------------------
// For command-line options that can be suffixed with +/-
[<RequireQualifiedAccess>]
type OptionSwitch =
| On
| Off
/// The spec value describes the action of the argument,
/// and whether it expects a following parameter.
type OptionSpec =
| OptionClear of bool ref
| OptionFloat of (float -> unit)
| OptionInt of (int -> unit)
| OptionSwitch of (OptionSwitch -> unit)
| OptionIntList of (int -> unit)
| OptionIntListSwitch of (int -> OptionSwitch -> unit)
| OptionRest of (string -> unit)
| OptionSet of bool ref
| OptionString of (string -> unit)
| OptionStringList of (string -> unit)
| OptionStringListSwitch of (string -> OptionSwitch -> unit)
| OptionUnit of (unit -> unit)
| OptionHelp of (CompilerOptionBlock list -> unit) // like OptionUnit, but given the "options"
| OptionGeneral of (string list -> bool) * (string list -> string list) // Applies? * (ApplyReturningResidualArgs)
and CompilerOption =
/// CompilerOption(name, argumentDescriptionString, actionSpec, exceptionOpt, helpTextOpt
| CompilerOption of string * string * OptionSpec * Option<exn> * string option
and CompilerOptionBlock =
| PublicOptions of string * CompilerOption list
| PrivateOptions of CompilerOption list
val PrintCompilerOptionBlocks : CompilerOptionBlock list -> unit // for printing usage
val DumpCompilerOptionBlocks : CompilerOptionBlock list -> unit // for QA
val FilterCompilerOptionBlock : (CompilerOption -> bool) -> CompilerOptionBlock -> CompilerOptionBlock
/// Parse and process a set of compiler options
val ParseCompilerOptions : (string -> unit) * CompilerOptionBlock list * string list -> unit
//----------------------------------------------------------------------------
// Compiler Options
//--------------------------------------------------------------------------
val DisplayBannerText : TcConfigBuilder -> unit
//val GetCompilerOptions : TcConfigBuilder -> CompilerOption list -> CompilerOption list
val GetCoreFscCompilerOptions : TcConfigBuilder -> CompilerOptionBlock list
val GetCoreFsiCompilerOptions : TcConfigBuilder -> CompilerOptionBlock list
val GetCoreServiceCompilerOptions : TcConfigBuilder -> CompilerOptionBlock list
......@@ -32,17 +75,17 @@ val SetTailcallSwitch : TcConfigBuilder -> OptionSwitch -> unit
val SetDebugSwitch : TcConfigBuilder -> string option -> OptionSwitch -> unit
val PrintOptionInfo : TcConfigBuilder -> unit
val fsharpModuleName : CompilerTarget -> string -> string
val GetGeneratedILModuleName : CompilerTarget -> string -> string
#if NO_COMPILER_BACKEND
#else
val InitialOptimizationEnv : TcImports -> TcGlobals -> IncrementalOptimizationEnv
val GetInitialOptimizationEnv : TcImports * TcGlobals -> IncrementalOptimizationEnv
val AddExternalCcuToOpimizationEnv : TcGlobals -> IncrementalOptimizationEnv -> ImportedAssembly -> IncrementalOptimizationEnv
val ApplyAllOptimizations : TcConfig * TcGlobals * ConstraintSolver.TcValF * string * ImportMap * bool * IncrementalOptimizationEnv * CcuThunk * TypedAssembly -> TypedAssembly * Opt.LazyModuleInfo * IncrementalOptimizationEnv
val ApplyAllOptimizations : TcConfig * TcGlobals * ConstraintSolver.TcValF * string * ImportMap * bool * IncrementalOptimizationEnv * CcuThunk * TypedAssembly -> TypedAssembly * Optimizer.LazyModuleInfo * IncrementalOptimizationEnv
val CreateIlxAssemblyGenerator : TcConfig * TcImports * TcGlobals * ConstraintSolver.TcValF * CcuThunk -> IlxAssemblyGenerator
val CreateIlxAssemblyGenerator : TcConfig * TcImports * TcGlobals * ConstraintSolver.TcValF * CcuThunk -> IlxGen.IlxAssemblyGenerator
val GenerateIlxCode : IlxGenBackend * bool * bool * TcConfig * TypeChecker.TopAttribs * TypedAssembly * string * bool * IlxAssemblyGenerator -> IlxGenResults
val GenerateIlxCode : IlxGen.IlxGenBackend * bool * bool * TcConfig * TypeChecker.TopAttribs * TypedAssembly * string * bool * IlxGen.IlxAssemblyGenerator -> IlxGen.IlxGenResults
#endif
// Used during static linking
......@@ -53,5 +96,5 @@ val ignoreFailureOnMono1_1_16 : (unit -> unit) -> unit
val mutable enableConsoleColoring : bool
val DoWithErrorColor : bool -> (unit -> 'a) -> 'a
val ReportTime : TcConfig -> string -> unit
val abbrevFlagSet : TcConfigBuilder -> bool -> Set<string>
val GetAbbrevFlagSet : TcConfigBuilder -> bool -> Set<string>
val PostProcessCompilerArgs : string Set -> string [] -> string list
......@@ -45,12 +45,12 @@ open Microsoft.FSharp.Compiler.ErrorLogger
open Microsoft.FSharp.Compiler.Tast
open Microsoft.FSharp.Compiler.Tastops
open Microsoft.FSharp.Compiler.Tastops.DebugPrint
open Microsoft.FSharp.Compiler.Env
open Microsoft.FSharp.Compiler.TcGlobals
open Microsoft.FSharp.Compiler.Lib
open Microsoft.FSharp.Compiler.Infos
open Microsoft.FSharp.Compiler.Infos.AccessibilityLogic
open Microsoft.FSharp.Compiler.Infos.AttributeChecking
open Microsoft.FSharp.Compiler.Typrelns
open Microsoft.FSharp.Compiler.TypeRelations
open Microsoft.FSharp.Compiler.PrettyNaming
//-------------------------------------------------------------------------
......@@ -121,9 +121,9 @@ exception ConstraintSolverMissingConstraint of DisplayEnv * Tast.Typar * Tast.Ty
exception ConstraintSolverError of string * range * range
exception ConstraintSolverRelatedInformation of string option * range * exn
exception ErrorFromApplyingDefault of Env.TcGlobals * DisplayEnv * Tast.Typar * TType * exn * range
exception ErrorFromAddingTypeEquation of Env.TcGlobals * DisplayEnv * TType * TType * exn * range
exception ErrorsFromAddingSubsumptionConstraint of Env.TcGlobals * DisplayEnv * TType * TType * exn * range
exception ErrorFromApplyingDefault of TcGlobals * DisplayEnv * Tast.Typar * TType * exn * range
exception ErrorFromAddingTypeEquation of TcGlobals * DisplayEnv * TType * TType * exn * range
exception ErrorsFromAddingSubsumptionConstraint of TcGlobals * DisplayEnv * TType * TType * exn * range
exception ErrorFromAddingConstraint of DisplayEnv * exn * range
exception PossibleOverload of DisplayEnv * string * exn * range
exception UnresolvedOverloading of DisplayEnv * exn list * string * range
......@@ -136,7 +136,7 @@ type TcValF = (ValRef -> ValUseFlag -> TType list -> range -> Expr * TType)
type ConstraintSolverState =
{
g: Env.TcGlobals;
g: TcGlobals;
amap: Import.ImportMap;
InfoReader : InfoReader;
TcVal : TcValF
......@@ -1290,7 +1290,7 @@ and MemberConstraintSolutionOfMethInfo css m minfo minst =
let minst = [] // GENERIC TYPE PROVIDERS: for generics, we would have an minst here
let allArgVars, allArgs = minfo.GetParamTypes(amap, m, minst) |> List.concat |> List.mapi (fun i ty -> mkLocal m ("arg"+string i) ty) |> List.unzip
let objArgVars, objArgs = (if minfo.IsInstance then [mkLocal m "this" minfo.EnclosingType] else []) |> List.unzip
let callMethInfoOpt, callExpr,callExprTy = Typrelns.ProvidedMethodCalls.BuildInvokerExpressionForProvidedMethodCall css.TcVal (g, amap, mi, objArgs, NeverMutates, false, ValUseFlag.NormalValUse, allArgs, m)
let callMethInfoOpt, callExpr,callExprTy = TypeRelations.ProvidedMethodCalls.BuildInvokerExpressionForProvidedMethodCall css.TcVal (g, amap, mi, objArgs, NeverMutates, false, ValUseFlag.NormalValUse, allArgs, m)
let closedExprSln = ClosedExprSln (mkLambdas m [] (objArgVars@allArgVars) (callExpr, callExprTy) )
// If the call is a simple call to an IL method with all the arguments in the natural order, then revert to use ILMethSln.
// This is important for calls to operators on generated provided types. There is an (unchecked) condition
......@@ -1644,7 +1644,7 @@ and SolveTypeSupportsComparison (csenv:ConstraintSolverEnv) ndeep m2 trace ty =
// Give a good error for structural types excluded from the comparison relation because of their fields
elif (isAppTy g ty &&
let tcref = tcrefOfAppTy g ty
Augment.TyconIsCandidateForAugmentationWithCompare g tcref.Deref &&
AugmentWithHashCompare.TyconIsCandidateForAugmentationWithCompare g tcref.Deref &&
isNone tcref.GeneratedCompareToWithComparerValues) then
ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotSupportComparison3(NicePrint.minimalStringOfType denv ty),m,m2))
......@@ -1672,7 +1672,7 @@ and SolveTypSupportsEquality (csenv:ConstraintSolverEnv) ndeep m2 trace ty =
let tcref,tinst = destAppTy g ty
// Give a good error for structural types excluded from the equality relation because of their fields
if (Augment.TyconIsCandidateForAugmentationWithEquals g tcref.Deref &&
if (AugmentWithHashCompare.TyconIsCandidateForAugmentationWithEquals g tcref.Deref &&
isNone tcref.GeneratedHashAndEqualsWithComparerValues) then
ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotSupportEquality3(NicePrint.minimalStringOfType denv ty),m,m2))
......
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
/// Solves constraints using a mutable constraint-solver state
module internal Microsoft.FSharp.Compiler.ConstraintSolver
open Internal.Utilities
......@@ -15,18 +16,32 @@ open Microsoft.FSharp.Compiler.Range
open Microsoft.FSharp.Compiler.Import
open Microsoft.FSharp.Compiler.Tastops
open Microsoft.FSharp.Compiler.Tast
open Microsoft.FSharp.Compiler.Env
open Microsoft.FSharp.Compiler.TcGlobals
open Microsoft.FSharp.Compiler.Infos
/// Create a type variable representing the use of a "_" in F# code
val NewAnonTypar : TyparKind * range * TyparRigidity * TyparStaticReq * TyparDynamicReq -> Typar
/// Create an inference type variable
val NewInferenceType : unit -> TType
/// Create an inference type variable representing an error condition when checking an expression
val NewErrorType : unit -> TType
/// Create an inference type variable representing an error condition when checking a measure
val NewErrorMeasure : unit -> MeasureExpr
/// Create a list of inference type variables, one for each element in the input list
val NewInferenceTypes : 'a list -> TType list
/// Given a set of formal type parameters and their constraints, make new inference type variables for
/// each and ensure that the constraints on the new type variables are adjusted to refer to these.
val FreshenAndFixupTypars : range -> TyparRigidity -> Typars -> TType list -> Typars -> Typars * TyparInst * TType list
val FreshenTypeInst : range -> Typars -> Typars * TyparInst * TType list
val FreshenTypars : range -> Typars -> TType list
val FreshenMethInfo : range -> MethInfo -> TType list
exception ConstraintSolverTupleDiffLengths of DisplayEnv * TType list * TType list * range * range
......@@ -42,16 +57,15 @@ exception ErrorsFromAddingSubsumptionConstraint of TcGlobals * DisplayEn
exception ErrorFromAddingConstraint of DisplayEnv * exn * range
exception UnresolvedConversionOperator of DisplayEnv * TType * TType * range
exception PossibleOverload of DisplayEnv * string * exn * range
exception UnresolvedOverloading of DisplayEnv * exn list (* PossibleOverload list *) * string * range
//exception PossibleBestOverload of DisplayEnv * string * range
exception UnresolvedOverloading of DisplayEnv * exn list * string * range
exception NonRigidTypar of DisplayEnv * string option * range * TType * TType * range
/// function type that denotes captured tcVal used in constraint solver
/// A function that denotes captured tcVal, Used in constraint solver and elsewhere to get appropriate expressions for a ValRef.
type TcValF = (ValRef -> ValUseFlag -> TType list -> range -> Expr * TType)
[<Sealed>]
type ConstraintSolverState =
static member New: TcGlobals * Import.ImportMap * InfoReader * TcValF-> ConstraintSolverState
static member New: TcGlobals * Import.ImportMap * InfoReader * TcValF -> ConstraintSolverState
type ConstraintSolverEnv
......@@ -69,10 +83,9 @@ val SimplifyMeasuresInTypeScheme : TcGlobals -> bool -> Typars -> TT
val SolveTyparEqualsTyp : ConstraintSolverEnv -> int -> range -> OptionalTrace -> TType -> TType -> OperationResult<unit>
val SolveTypEqualsTypKeepAbbrevs : ConstraintSolverEnv -> int -> range -> OptionalTrace -> TType -> TType -> OperationResult<unit>
val CanonicalizeRelevantMemberConstraints : ConstraintSolverEnv -> int -> OptionalTrace -> Typars -> OperationResult<unit>
val ResolveOverloading : ConstraintSolverEnv -> OptionalTrace -> string -> ndeep: int -> bool -> int * int -> AccessorDomain -> Typrelns.CalledMeth<Expr> list -> bool -> TType option -> Typrelns.CalledMeth<Expr> option * OperationResult<unit>
val UnifyUniqueOverloading : ConstraintSolverEnv -> int * int -> string -> AccessorDomain -> Typrelns.CalledMeth<SynExpr> list -> TType -> OperationResult<bool>
val ResolveOverloading : ConstraintSolverEnv -> OptionalTrace -> string -> ndeep: int -> bool -> int * int -> AccessorDomain -> TypeRelations.CalledMeth<Expr> list -> bool -> TType option -> TypeRelations.CalledMeth<Expr> option * OperationResult<unit>
val UnifyUniqueOverloading : ConstraintSolverEnv -> int * int -> string -> AccessorDomain -> TypeRelations.CalledMeth<SynExpr> list -> TType -> OperationResult<bool>
val EliminateConstraintsForGeneralizedTypars : ConstraintSolverEnv -> OptionalTrace -> Typars -> unit
//val AdjustCalledArgType : TcGlobals -> InfoReader -> bool -> Typrelns.CalledArg -> Typrelns.CallerArg<'T> -> TType
val CheckDeclaredTypars : DisplayEnv -> ConstraintSolverState -> range -> Typars -> Typars -> unit
......
......@@ -7,11 +7,12 @@ open Microsoft.FSharp.Compiler.AbstractIL
open Microsoft.FSharp.Compiler.AbstractIL.Internal
open Microsoft.FSharp.Compiler
open Microsoft.FSharp.Compiler.Tast
open Microsoft.FSharp.Compiler.TcGlobals
(* detuple pass: *)
val DetupleImplFile : CcuThunk -> Env.TcGlobals -> TypedImplFile -> TypedImplFile
val DetupleImplFile : CcuThunk -> TcGlobals -> TypedImplFile -> TypedImplFile
module GlobalUsageAnalysis =
val GetValsBoundInExpr : Expr -> Zset<Val>
......@@ -35,4 +36,4 @@ module GlobalUsageAnalysis =
/// top of expr toplevel? (true)
IterationIsAtTopLevel : bool;
}
val GetUsageInfoOfImplFile : Env.TcGlobals -> TypedImplFile -> Results
val GetUsageInfoOfImplFile : TcGlobals -> TypedImplFile -> Results
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Internal.Utilities.Diagnostic
open System
open System.Diagnostics
open System.Reflection
open System.Collections.Generic
#if EXTENSIBLE_DUMPER
#if DEBUG
type internal ExtensibleDumper(x:obj) =
static let mutable dumpers = new Dictionary<Type,(Type*MethodInfo) option>()
[<DebuggerBrowsable(DebuggerBrowsableState.Collapsed)>]
member self.Debug = ExtensibleDumper.Dump(x)
static member Dump(o:obj) : string =
if o = null then "null"
else
let dumpeeType = o.GetType()
let DeriveDumperName(dumpeeType:Type) =
"Internal.Utilities.Diagnostic." + dumpeeType.Name + "Dumper"
match dumpers.TryGetValue(dumpeeType) with
| true, Some(dumperType, methodInfo) ->
try
let dumper = Activator.CreateInstance(dumperType,[| o |])
let result = methodInfo.Invoke(dumper, [||])
downcast result
with e -> "Exception during dump: "+e.Message
| true, None ->
"There is no dumper named "+(DeriveDumperName dumpeeType)+" with single constructor that takes "+dumpeeType.Name+" and property named Dump."
| false, _ ->
let TryAdd(dumpeeType:Type) =
let dumperDerivedName = DeriveDumperName(dumpeeType)
let dumperAssembly = dumpeeType.Assembly // Dumper must live in the same assembly as dumpee
let dumperType = dumperAssembly.GetType(dumperDerivedName, (*throwOnError*)false)
if dumperType <> null then
let dumpMethod = dumperType.GetMethod("ToString")
if dumpMethod <> null then
let constructors = dumperType.GetConstructors()
if constructors.Length = 1 then
let constr = constructors.[0]
let parameters = constr.GetParameters()
if parameters.Length = 1 then
dumpers.[o.GetType()] <- Some(dumperType,dumpMethod)
dumpers.ContainsKey(o.GetType())
if (not(TryAdd(o.GetType()))) then
if (not(TryAdd(o.GetType().BaseType))) then
dumpers.[dumpeeType] <- None
ExtensibleDumper.Dump(o) // Show the message
#endif
#endif
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Internal.Utilities.Diagnostic
open System
open System.Diagnostics
open System.Reflection
open System.Collections.Generic
#if EXTENSIBLE_DUMPER
#if DEBUG
type internal ExtensibleDumper =
class
new : x:obj -> ExtensibleDumper
member Debug : string
static member Dump : o:obj -> string
end
#endif
#endif
......@@ -12,7 +12,7 @@ undefinedNameRecordLabel,"The record label '%s' is not defined"
undefinedNameTypeParameter,"The type parameter '%s' is not defined"
undefinedNamePatternDiscriminator,"The pattern discriminator '%s' is not defined"
# -----------------------------------------------------------------------------
# build.fs
# CompileOps.fs
# -----------------------------------------------------------------------------
buildUnexpectedTypeArgs,"The non-generic type '%s' does not expect any type arguments, but here is given %d type argument(s)"
203,buildInvalidWarningNumber,"Invalid warning number '%s'"
......
......@@ -19,11 +19,11 @@ open Microsoft.FSharp.Compiler.Ast
open Microsoft.FSharp.Compiler.ErrorLogger
open Microsoft.FSharp.Compiler.Tast
open Microsoft.FSharp.Compiler.Tastops
open Microsoft.FSharp.Compiler.Env
open Microsoft.FSharp.Compiler.TcGlobals
open Microsoft.FSharp.Compiler.Lib
open Microsoft.FSharp.Compiler.Layout
open Microsoft.FSharp.Compiler.AbstractIL.IL
open Microsoft.FSharp.Compiler.Typrelns
open Microsoft.FSharp.Compiler.TypeRelations
open Microsoft.FSharp.Compiler.Infos
type env = Nix
......
......@@ -4,7 +4,7 @@
// The ILX generator.
//--------------------------------------------------------------------------
module internal Microsoft.FSharp.Compiler.Ilxgen
module internal Microsoft.FSharp.Compiler.IlxGen
#nowarn "44" // This construct is deprecated. please use List.item
......@@ -29,10 +29,10 @@ open Microsoft.FSharp.Compiler.Range
open Microsoft.FSharp.Compiler.Ast
open Microsoft.FSharp.Compiler.ErrorLogger
open Microsoft.FSharp.Compiler.PrettyNaming
open Microsoft.FSharp.Compiler.Env
open Microsoft.FSharp.Compiler.TcGlobals
open Microsoft.FSharp.Compiler.Layout
open Microsoft.FSharp.Compiler.Lib
open Microsoft.FSharp.Compiler.Typrelns
open Microsoft.FSharp.Compiler.TypeRelations
open Microsoft.FSharp.Compiler.TypeChecker
open Microsoft.FSharp.Compiler.Infos
open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types
......@@ -194,7 +194,7 @@ type IlxGenOptions =
/// Compilation environment for compiling a fragment of an assembly
[<NoEquality; NoComparison>]
type cenv =
{ g: Env.TcGlobals
{ g: TcGlobals
TcVal : ConstraintSolver.TcValF
viewCcu: CcuThunk
opts: IlxGenOptions
......@@ -432,16 +432,16 @@ and GenTypeAux amap m g (tyenv: TypeReprEnv) voidOK ptrsOK ty =
match stripTyEqnsAndMeasureEqns g ty with
| TType_app (tcref, tinst) -> GenNamedTyAppAux amap m g tyenv ptrsOK tcref tinst
| TType_tuple args -> GenTypeAux amap m g tyenv VoidNotOK ptrsOK (mkCompiledTupleTy g args)
| TType_fun (dty, returnTy) -> EraseIlxFuncs.mkILFuncTy g.ilxPubCloEnv (GenTypeArgAux amap m g tyenv dty) (GenTypeArgAux amap m g tyenv returnTy)
| TType_fun (dty, returnTy) -> EraseClosures.mkILFuncTy g.ilxPubCloEnv (GenTypeArgAux amap m g tyenv dty) (GenTypeArgAux amap m g tyenv returnTy)
| TType_ucase (ucref, args) ->
let cuspec,idx = GenUnionCaseSpec amap m g tyenv ucref args
EraseIlxUnions.GetILTypeForAlternative cuspec idx
EraseUnions.GetILTypeForAlternative cuspec idx
| TType_forall (tps, tau) ->
let tps = DropErasedTypars tps
if tps.IsEmpty then GenTypeAux amap m g tyenv VoidNotOK ptrsOK tau
else EraseIlxFuncs.mkILTyFuncTy g.ilxPubCloEnv
else EraseClosures.mkILTyFuncTy g.ilxPubCloEnv
| TType_var tp -> mkILTyvarTy tyenv.[tp,m]
| TType_measure _ -> g.ilg.typ_int32
......@@ -771,7 +771,7 @@ let StorageForValRef m (v: ValRef) eenv = StorageForVal m v.Deref eenv
let IsValRefIsDllImport g (vref:ValRef) =
vref.Attribs |> HasFSharpAttributeOpt g g.attrib_DllImportAttribute
let GetMethodSpecForMemberVal amap g memberInfo (vref:ValRef) =
let GetMethodSpecForMemberVal amap g (memberInfo:ValMemberInfo) (vref:ValRef) =
let m = vref.Range
let tps,curriedArgInfos,returnTy,retInfo =
assert(vref.ValReprInfo.IsSome);
......@@ -924,7 +924,7 @@ let ComputeStorageForNonLocalTopVal amap g cloc modref (v:Val) =
let rec ComputeStorageForNonLocalModuleOrNamespaceRef amap g cloc acc (modref:ModuleOrNamespaceRef) (modul:ModuleOrNamespace) =
let acc =
(acc, modul.ModuleOrNamespaceType.ModuleAndNamespaceDefinitions) ||> List.fold (fun acc smodul ->
ComputeStorageForNonLocalModuleOrNamespaceRef amap g (CompLocForSubModuleOrNamespace cloc smodul) acc (modref.MkNestedTyconRef smodul) smodul)
ComputeStorageForNonLocalModuleOrNamespaceRef amap g (CompLocForSubModuleOrNamespace cloc smodul) acc (modref.NestedTyconRef smodul) smodul)
let acc =
(acc, modul.ModuleOrNamespaceType.AllValsAndMembers) ||> Seq.fold (fun acc v ->
......@@ -1679,7 +1679,7 @@ let rec GenExpr cenv (cgbuf:CodeGenBuffer) eenv sp expr sequel =
if not (WillGenerateSequencePoint sp expr) && not (AlwaysSuppressSequencePoint sp expr) then
CG.EmitSeqPoint cgbuf expr.Range;
match (if compileSequenceExpressions then Lowertop.LowerSeqExpr cenv.g cenv.amap expr else None) with
match (if compileSequenceExpressions then LowerCallsAndSeqs.LowerSeqExpr cenv.g cenv.amap expr else None) with
| Some info ->
GenSequenceExpr cenv cgbuf eenv info sequel
| None ->
......@@ -2042,7 +2042,7 @@ and GenAllocRecd cenv cgbuf eenv ctorInfo (tcref,argtys,args,m) sequel =
(args,relevantFields) ||> List.iter2 (fun e f ->
CG.EmitInstr cgbuf (pop 0) (Push (if tcref.IsStructOrEnumTycon then [ILType.Byref typ] else [typ])) mkLdarg0;
GenExpr cenv cgbuf eenv SPSuppress e Continue;
GenFieldStore false cenv cgbuf eenv (mkNestedRecdFieldRef tcref f,argtys,m) discard)
GenFieldStore false cenv cgbuf eenv (tcref.MakeNestedRecdFieldRef f,argtys,m) discard)
// Object construction doesn't generate a true value.
// Object constructions will always just get thrown away so this is safe
GenSequel cenv eenv.cloc cgbuf sequel
......@@ -2103,9 +2103,9 @@ and GenNewArray cenv cgbuf eenv (elems: Expr list,elemTy,m) sequel =
and GenCoerce cenv cgbuf eenv (e,tgty,m,srcty) sequel =
// Is this an upcast?
if Typrelns.TypeDefinitelySubsumesTypeNoCoercion 0 cenv.g cenv.amap m tgty srcty &&
if TypeRelations.TypeDefinitelySubsumesTypeNoCoercion 0 cenv.g cenv.amap m tgty srcty &&
// Do an extra check - should not be needed
Typrelns.TypeFeasiblySubsumesType 0 cenv.g cenv.amap m tgty Typrelns.NoCoerce srcty then
TypeRelations.TypeFeasiblySubsumesType 0 cenv.g cenv.amap m tgty TypeRelations.NoCoerce srcty then
begin
// The .NET IL doesn't always support implict subsumption for interface types, e.g. at stack merge points
// Hence be conservative here and always cast explicitly.
......@@ -2167,7 +2167,7 @@ and GenSetExnField cenv cgbuf eenv (e,ecref,fieldNum,e2,m) sequel =
and GenUnionCaseProof cenv cgbuf eenv (e,ucref,tyargs,m) sequel =
GenExpr cenv cgbuf eenv SPSuppress e Continue;
let cuspec,idx = GenUnionCaseSpec cenv.amap m cenv.g eenv.tyenv ucref tyargs
let fty = EraseIlxUnions.GetILTypeForAlternative cuspec idx
let fty = EraseUnions.GetILTypeForAlternative cuspec idx
CG.EmitInstrs cgbuf (pop 1) (Push [fty])
[ mkIlxInstr (EI_castdata(false,cuspec,idx)); ];
GenSequel cenv eenv.cloc cgbuf sequel
......@@ -2682,7 +2682,7 @@ and GenApp cenv cgbuf eenv (f,fty,tyargs,args,m) sequel =
let whereSaved,eenv =
(eenv,laterArgs) ||> List.mapFold (fun eenv laterArg ->
// Only save arguments that have effects
if Opt.ExprHasEffect cenv.g laterArg then
if Optimizer.ExprHasEffect cenv.g laterArg then
let ilTy = laterArg |> tyOfExpr cenv.g |> GenType cenv.amap m cenv.g eenv.tyenv
let loc,eenv = AllocLocal cenv cgbuf eenv true (ilxgenGlobalNng.FreshCompilerGeneratedName ("arg",m), ilTy) scopeMarks
GenExpr cenv cgbuf eenv SPSuppress laterArg Continue
......@@ -3656,7 +3656,7 @@ and GenObjectExpr cenv cgbuf eenvouter expr (baseType,baseValOpt,basecall,overri
cgbuf.mgbuf.AddTypeDef(ilCloTypeRef, cloTypeDef, false, false);
CountClosure();
GenGetLocalVals cenv cgbuf eenvouter m cloFreeVars;
CG.EmitInstr cgbuf (pop ilCloFreeVars.Length) (Push [ EraseIlxFuncs.mkTyOfLambdas cenv.g.ilxPubCloEnv ilCloLambdas]) (I_newobj (ilxCloSpec.Constructor,None));
CG.EmitInstr cgbuf (pop ilCloFreeVars.Length) (Push [ EraseClosures.mkTyOfLambdas cenv.g.ilxPubCloEnv ilCloLambdas]) (I_newobj (ilxCloSpec.Constructor,None));
GenSequel cenv eenvouter.cloc cgbuf sequel
and GenSequenceExpr cenv (cgbuf:CodeGenBuffer) eenvouter (nextEnumeratorValRef:ValRef,pcvref:ValRef,currvref:ValRef,stateVars,generateNextExpr,closeExpr,checkCloseExpr:Expr,seqElemTy, m) sequel =
......@@ -3851,7 +3851,7 @@ and GenLambdaVal cenv (cgbuf:CodeGenBuffer) eenv (cloinfo,m) =
GenGetLocalVals cenv cgbuf eenv m cloinfo.cloFreeVars;
CG.EmitInstr cgbuf
(pop cloinfo.cloILFreeVars.Length)
(Push [EraseIlxFuncs.mkTyOfLambdas cenv.g.ilxPubCloEnv cloinfo.ilCloLambdas])
(Push [EraseClosures.mkTyOfLambdas cenv.g.ilxPubCloEnv cloinfo.ilCloLambdas])
(I_newobj (cloinfo.cloSpec.Constructor,None))
and GenLambda cenv cgbuf eenv isLocalTypeFunc selfv expr sequel =
......@@ -4184,7 +4184,7 @@ and GenDelegateExpr cenv cgbuf eenvouter expr (TObjExprMethod((TSlotSig(_,delega
let ctxtGenericArgsForDelegee = GenGenericArgs m eenvouter.tyenv cloFreeTyvars
let ilxCloSpec = IlxClosureSpec.Create(IlxClosureRef(ilDelegeeTypeRef, ilCloLambdas, ilCloFreeVars), mkILGenericArgs ctxtGenericArgsForDelegee)
GenGetLocalVals cenv cgbuf eenvouter m cloFreeVars;
CG.EmitInstr cgbuf (pop ilCloFreeVars.Length) (Push [EraseIlxFuncs.mkTyOfLambdas cenv.g.ilxPubCloEnv ilCloLambdas]) (I_newobj (ilxCloSpec.Constructor,None));
CG.EmitInstr cgbuf (pop ilCloFreeVars.Length) (Push [EraseClosures.mkTyOfLambdas cenv.g.ilxPubCloEnv ilCloLambdas]) (I_newobj (ilxCloSpec.Constructor,None));
let ilDelegeeTyOuter = mkILBoxedTy ilDelegeeTypeRef ctxtGenericArgsForDelegee
let ilDelegeeInvokeMethOuter = mkILNonGenericInstanceMethSpecInTy (ilDelegeeTyOuter,"Invoke",typesOfILParamsList ilDelegeeParams, ilDelegeeRet.Type)
......@@ -6326,7 +6326,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon:Tycon) =
let isPropHidden =
((fspec.IsCompilerGenerated && not tycon.IsEnumTycon) ||
hiddenRepr ||
IsHiddenRecdField eenv.sigToImplRemapInfo (mkNestedRecdFieldRef tcref fspec))
IsHiddenRecdField eenv.sigToImplRemapInfo (tcref.MakeNestedRecdFieldRef fspec))
let ilType = GenType cenv.amap m cenv.g eenvinner.tyenv fspec.FormalType
let ilFieldName = ComputeFieldName tycon fspec
......@@ -6448,7 +6448,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon:Tycon) =
eenv.valsInScope.TryFind cenv.g.new_format_vref.Deref) with
| Some(Lazy(Method(_,_,sprintfMethSpec,_,_,_))), Some(Lazy(Method(_,_,newFormatMethSpec,_,_,_))) ->
// The type returned by the 'sprintf' call
let funcTy = EraseIlxFuncs.mkILFuncTy cenv.g.ilxPubCloEnv ilThisTy cenv.g.ilg.typ_String
let funcTy = EraseClosures.mkILFuncTy cenv.g.ilxPubCloEnv ilThisTy cenv.g.ilg.typ_String
// Give the instantiation of the printf format object, i.e. a Format`5 object compatible with StringFormat<ilThisTy>
let newFormatMethSpec = mkILMethSpec(newFormatMethSpec.MethodRef,AsObject,
[// 'T -> string'
......@@ -6959,8 +6959,8 @@ let defaultOf =
/// Top-level val bindings are stored (for example) in static fields.
/// In the FSI case, these fields are be created and initialised, so we can recover the object.
/// Ilxgen knows how v was stored, and then ilreflect knows how this storage was generated.
/// Ilxgen converts (v:Tast.Val) to AbsIL datatstructures.
/// IlxGen knows how v was stored, and then ilreflect knows how this storage was generated.
/// IlxGen converts (v:Tast.Val) to AbsIL datatstructures.
/// Ilreflect converts from AbsIL datatstructures to emitted Type, FieldInfo, MethodInfo etc.
let LookupGeneratedValue (amap:Import.ImportMap) (ctxt: ExecutionContext) g eenv (v:Val) =
try
......@@ -7056,7 +7056,7 @@ let LookupGeneratedInfo (ctxt: ExecutionContext) (g:TcGlobals) eenv (v:Val) =
/// The published API from the ILX code generator
type IlxAssemblyGenerator(amap: Import.ImportMap, tcGlobals: Env.TcGlobals, tcVal : ConstraintSolver.TcValF, ccu: Tast.CcuThunk) =
type IlxAssemblyGenerator(amap: Import.ImportMap, tcGlobals: TcGlobals, tcVal : ConstraintSolver.TcValF, ccu: Tast.CcuThunk) =
// The incremental state held by the ILX code generator
let mutable ilxGenEnv = GetEmptyIlxGenEnv tcGlobals.ilg ccu
......
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
module internal Microsoft.FSharp.Compiler.Ilxgen
module internal Microsoft.FSharp.Compiler.IlxGen
open System
open System.IO
open System.Reflection
open Microsoft.FSharp.Compiler
open Microsoft.FSharp.Compiler.AbstractIL
open Microsoft.FSharp.Compiler.AbstractIL.IL
open Microsoft.FSharp.Compiler.Tast
open System
open System.IO
open System.Reflection
open Microsoft.FSharp.Compiler.TcGlobals
/// Indicates how the generated IL code is ultimately emitted
type IlxGenBackend =
......@@ -60,7 +61,7 @@ type ExecutionContext =
/// An incremental ILX code generator for a single assembly
type public IlxAssemblyGenerator =
/// Create an incremental ILX code generator for a single assembly
new : Import.ImportMap * Env.TcGlobals * ConstraintSolver.TcValF * CcuThunk -> IlxAssemblyGenerator
new : Import.ImportMap * TcGlobals * ConstraintSolver.TcValF * CcuThunk -> IlxAssemblyGenerator
/// Register a set of referenced assemblies with the ILX code generator
member AddExternalCcus : CcuThunk list -> unit
......
......@@ -2,7 +2,7 @@
/// LexFilter - process the token stream prior to parsing.
/// Implements the offside rule and a copule of other lexical transformations.
module internal Microsoft.FSharp.Compiler.Lexfilter
module internal Microsoft.FSharp.Compiler.LexFilter
open Internal.Utilities
open Internal.Utilities.Text.Lexing
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册