未验证 提交 829834c1 编写于 作者: D dotnet-automerge-bot 提交者: GitHub

Merge pull request #6340 from Microsoft/merges/master-to-dev16.1

Merge master to dev16.1
......@@ -11,7 +11,6 @@
<PropertyGroup Condition="$(TargetFramework.StartsWith('netstandard')) OR $(TargetFramework.StartsWith('netcoreapp'))">
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
<DefineConstants>$(DefineConstants);NETSTANDARD1_6</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_APP_DOMAINS</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_ARRAY_LONG_LENGTH</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_BEGINEND_READWRITE</DefineConstants>
......@@ -21,9 +20,7 @@
<DefineConstants>$(DefineConstants);FX_NO_CORHOST_SIGNER</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_EVENTWAITHANDLE_IDISPOSABLE</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_EXIT_CONTEXT_FLAGS</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_HEAPTERMINATION</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_LINKEDRESOURCES</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_LOADER_OPTIMIZATION</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_PARAMETERIZED_THREAD_START</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_PDB_READER</DefineConstants>
<DefineConstants>$(DefineConstants);FX_NO_PDB_WRITER</DefineConstants>
......
......@@ -31,9 +31,9 @@ build: proto restore
$(DotNetExe) build-server shutdown
$(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Core/FSharp.Core.fsproj
$(DotNetExe) build -c $(Configuration) -f netstandard2.0 src/fsharp/FSharp.Build/FSharp.Build.fsproj
$(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
$(DotNetExe) build -c $(Configuration) -f netstandard2.0 src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
$(DotNetExe) build -c $(Configuration) -f netcoreapp2.1 src/fsharp/fsc/fsc.fsproj
$(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj
$(DotNetExe) build -c $(Configuration) -f netstandard2.0 src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj
$(DotNetExe) build -c $(Configuration) -f netcoreapp2.1 src/fsharp/fsi/fsi.fsproj
$(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj
$(DotNetExe) build -c $(Configuration) -f netcoreapp2.0 tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj
......
namespace FSharp.Compiler.SourceCodeServices
#if !NETSTANDARD1_6
#if !NETSTANDARD
open System.Runtime.Serialization.Json
open System.Runtime
open System.Diagnostics
......@@ -60,7 +60,7 @@ type ProjectCracker =
let enableLogging = defaultArg enableLogging true
#if NETSTANDARD1_6
#if NETSTANDARD
let arguments = [|
yield projectFileName
yield enableLogging.ToString()
......
......@@ -288,9 +288,7 @@ module Driver =
for error in errors do eprintfn "%s" (error.ToString())
exitCode
#if !FX_NO_DEFAULT_DEPENDENCY_TYPE
[<Dependency("FSharp.Compiler",LoadHint.Always)>]
#endif
do ()
[<EntryPoint>]
......
......@@ -62,14 +62,14 @@
<AdditionalProperties Condition="'$(BuildDesktop)' == 'true'">TargetFramework=net472</AdditionalProperties>
</Projects>
<Projects Include="$(MSBuildThisFileDirectory)src\fsharp\FSharp.Compiler.Private\FSharp.Compiler.Private.fsproj">
<AdditionalProperties Condition="'$(BuildNetcore)' == 'true'">TargetFramework=netstandard1.6</AdditionalProperties>
<AdditionalProperties Condition="'$(BuildNetcore)' == 'true'">TargetFramework=netstandard2.0</AdditionalProperties>
<AdditionalProperties Condition="'$(BuildDesktop)' == 'true'">TargetFramework=net472</AdditionalProperties>
</Projects>
<Projects Include="$(MSBuildThisFileDirectory)src\fsharp\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj">
<AdditionalProperties Condition="'$(BuildDesktop)' == 'true'">TargetFramework=net472</AdditionalProperties>
</Projects>
<Projects Include="$(MSBuildThisFileDirectory)src\fsharp\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj">
<AdditionalProperties Condition="'$(BuildNetcore)' == 'true'">TargetFramework=netstandard1.6</AdditionalProperties>
<AdditionalProperties Condition="'$(BuildNetcore)' == 'true'">TargetFramework=netstandard2.0</AdditionalProperties>
<AdditionalProperties Condition="'$(BuildDesktop)' == 'true'">TargetFramework=net472</AdditionalProperties>
</Projects>
<Projects Include="$(MSBuildThisFileDirectory)src\fsharp\fsc\fsc.fsproj">
......
......@@ -1908,7 +1908,7 @@ type ILTypeDefLayout =
| Explicit of ILTypeDefLayoutInfo (* REVIEW: add field info here *)
and ILTypeDefLayoutInfo =
{ Size: int32 option;
{ Size: int32 option
Pack: uint16 option }
[<RequireQualifiedAccess>]
......@@ -2752,7 +2752,7 @@ let rescopeILTypeRef scoref (tref1:ILTypeRef) =
else ILTypeRef.Create(scoref2, tref1.Enclosing, tref1.Name)
// ORIGINAL IMPLEMENTATION (too many allocations
// { tspecTypeRef=rescopeILTypeRef scoref tref;
// { tspecTypeRef=rescopeILTypeRef scoref tref
// tspecInst=rescopeILTypes scoref tinst }
let rec rescopeILTypeSpec scoref (tspec1:ILTypeSpec) =
let tref1 = tspec1.TypeRef
......@@ -3341,7 +3341,7 @@ let mkILDelegateMethods (access) (ilg: ILGlobals) (iltyp_AsyncCallback, iltyp_IA
let mkCtorMethSpecForDelegate (ilg: ILGlobals) (ty:ILType, useUIntPtr) =
let scoref = ty.TypeRef.Scope
mkILInstanceMethSpecInTy (ty, ".ctor", [rescopeILType scoref ilg.typ_Object;
mkILInstanceMethSpecInTy (ty, ".ctor", [rescopeILType scoref ilg.typ_Object
rescopeILType scoref (if useUIntPtr then ilg.typ_UIntPtr else ilg.typ_IntPtr)],
ILType.Void, emptyILGenericArgsList)
......
此差异已折叠。
......@@ -38,7 +38,9 @@ let inline isSingleton l =
| _ -> false
let inline isNonNull x = not (isNull x)
let inline nonNull msg x = if isNull x then failwith ("null: " + msg) else x
let inline (===) x y = LanguagePrimitives.PhysicalEquality x y
/// Per the docs the threshold for the Large Object Heap is 85000 bytes: https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/large-object-heap#how-an-object-ends-up-on-the-large-object-heap-and-how-gc-handles-them
......@@ -69,6 +71,7 @@ type InlineDelayInit<'T when 'T : not struct> =
new (f: unit -> 'T) = {store = Unchecked.defaultof<'T>; func = Func<_>(f) }
val mutable store : 'T
val mutable func : Func<'T>
member x.Value =
match x.func with
| null -> x.store
......@@ -109,7 +112,7 @@ module Array =
let mutable eq = true
let mutable i = 0
while eq && i < len do
if not (inp.[i] === res.[i]) then eq <- false;
if not (inp.[i] === res.[i]) then eq <- false
i <- i + 1
if eq then inp else res
......@@ -243,6 +246,7 @@ module Array =
isSubArray suffix whole (whole.Length-suffix.Length)
module Option =
let mapFold f s opt =
match opt with
| None -> None,s
......@@ -340,9 +344,6 @@ module List =
| [] -> None
| h :: t -> if f h then Some (h, List.rev acc @ t) else loop (h::acc) t
loop [] inp
//tryRemove (fun x -> x = 2) [ 1;2;3] = Some (2, [1;3])
//tryRemove (fun x -> x = 3) [ 1;2;3;4;5] = Some (3, [1;2;4;5])
//tryRemove (fun x -> x = 3) [] = None
let headAndTail l =
match l with
......@@ -427,13 +428,21 @@ module List =
let collect2 f xs ys = List.concat (List.map2 f xs ys)
let toArraySquared xss = xss |> List.map List.toArray |> List.toArray
let iterSquared f xss = xss |> List.iter (List.iter f)
let collectSquared f xss = xss |> List.collect (List.collect f)
let mapSquared f xss = xss |> List.map (List.map f)
let mapFoldSquared f z xss = List.mapFold (List.mapFold f) z xss
let forallSquared f xss = xss |> List.forall (List.forall f)
let mapiSquared f xss = xss |> List.mapi (fun i xs -> xs |> List.mapi (fun j x -> f i j x))
let existsSquared f xss = xss |> List.exists (fun xs -> xs |> List.exists (fun x -> f x))
let mapiFoldSquared f z xss = mapFoldSquared f z (xss |> mapiSquared (fun i j x -> (i,j,x)))
module ResizeArray =
......@@ -483,9 +492,13 @@ module ResizeArray =
/// we need to stick these functions in this module rather than using the module functions for ValueOption
/// that come after FSharp.Core 4.5.2.
module ValueOptionInternal =
let inline ofOption x = match x with Some x -> ValueSome x | None -> ValueNone
let inline bind f x = match x with ValueSome x -> f x | ValueNone -> ValueNone
let inline isSome x = match x with ValueSome _ -> true | ValueNone -> false
let inline isNone x = match x with ValueSome _ -> false | ValueNone -> true
type String with
......@@ -592,6 +605,7 @@ module Dictionary =
[<Extension>]
type DictionaryExtensions() =
[<Extension>]
static member inline BagAdd(dic: Dictionary<'key, 'value list>, key: 'key, value: 'value) =
match dic.TryGetValue key with
......@@ -775,7 +789,7 @@ module Cancellable =
/// Implement try/finally for a cancellable computation
let tryFinally e compensation =
catch e |> bind (fun res ->
compensation();
compensation()
match res with Choice1Of2 r -> ret r | Choice2Of2 err -> raise err)
/// Implement try/with for a cancellable computation
......@@ -800,14 +814,23 @@ module Cancellable =
// }
type CancellableBuilder() =
member x.Bind(e,k) = Cancellable.bind k e
member x.Return(v) = Cancellable.ret v
member x.ReturnFrom(v) = v
member x.Combine(e1,e2) = e1 |> Cancellable.bind (fun () -> e2)
member x.TryWith(e,handler) = Cancellable.tryWith e handler
member x.Using(resource,e) = Cancellable.tryFinally (e resource) (fun () -> (resource :> IDisposable).Dispose())
member x.TryFinally(e,compensation) = Cancellable.tryFinally e compensation
member x.Delay(f) = Cancellable.delay f
member x.Zero() = Cancellable.ret ()
let cancellable = CancellableBuilder()
......@@ -845,7 +868,6 @@ module Eventually =
else forceWhile ctok check (work ctok)
let force ctok e = Option.get (forceWhile ctok (fun () -> true) e)
/// Keep running the computation bit by bit until a time limit is reached.
/// The runner gets called each time the computation is restarted
......@@ -856,13 +878,13 @@ module Eventually =
let rec runTimeShare ctok e =
runner ctok (fun ctok ->
sw.Reset()
sw.Start();
sw.Start()
let rec loop ctok ev2 =
match ev2 with
| Done _ -> ev2
| NotYetDone work ->
if ct.IsCancellationRequested || sw.ElapsedMilliseconds > timeShareInMilliseconds then
sw.Stop();
sw.Stop()
NotYetDone(fun ctok -> runTimeShare ctok ev2)
else
loop ctok (work ctok)
......@@ -904,10 +926,11 @@ module Eventually =
let tryFinally e compensation =
catch (e)
|> bind (fun res -> compensation();
match res with
| Result v -> Eventually.Done v
| Exception e -> raise e)
|> bind (fun res ->
compensation()
match res with
| Result v -> Eventually.Done v
| Exception e -> raise e)
let tryWith e handler =
catch e
......@@ -918,15 +941,22 @@ module Eventually =
NotYetDone (fun ctok -> Done ctok)
type EventuallyBuilder() =
member x.Bind(e,k) = Eventually.bind k e
member x.Return(v) = Eventually.Done v
member x.ReturnFrom(v) = v
member x.Combine(e1,e2) = e1 |> Eventually.bind (fun () -> e2)
member x.TryWith(e,handler) = Eventually.tryWith e handler
member x.TryFinally(e,compensation) = Eventually.tryFinally e compensation
member x.Delay(f) = Eventually.delay f
member x.Zero() = Eventually.Done ()
member x.Zero() = Eventually.Done ()
let eventually = new EventuallyBuilder()
......@@ -938,10 +968,7 @@ let _ = eventually { try return (failwith "") with _ -> return 1 }
let _ = eventually { use x = null in return 1 }
*)
//---------------------------------------------------------------------------
// generate unique stamps
//---------------------------------------------------------------------------
/// Generates unique stamps
type UniqueStampGenerator<'T when 'T : equality>() =
let encodeTab = new Dictionary<'T,int>(HashIdentity.Structural)
let mutable nItems = 0
......@@ -953,16 +980,16 @@ type UniqueStampGenerator<'T when 'T : equality>() =
encodeTab.[str] <- idx
nItems <- nItems + 1
idx
member this.Encode(str) = encode str
member this.Table = encodeTab.Keys
//---------------------------------------------------------------------------
// memoize tables (all entries cached, never collected)
//---------------------------------------------------------------------------
/// memoize tables (all entries cached, never collected)
type MemoizationTable<'T,'U>(compute: 'T -> 'U, keyComparer: IEqualityComparer<'T>, ?canMemoize) =
let table = new Dictionary<'T,'U>(keyComparer)
member t.Apply(x) =
if (match canMemoize with None -> true | Some f -> f x) then
let mutable res = Unchecked.defaultof<'U>
......@@ -975,7 +1002,7 @@ type MemoizationTable<'T,'U>(compute: 'T -> 'U, keyComparer: IEqualityComparer<'
if ok then res
else
let res = compute x
table.[x] <- res;
table.[x] <- res
res)
else compute x
......@@ -983,8 +1010,11 @@ type MemoizationTable<'T,'U>(compute: 'T -> 'U, keyComparer: IEqualityComparer<'
exception UndefinedException
type LazyWithContextFailure(exn:exn) =
static let undefined = new LazyWithContextFailure(UndefinedException)
member x.Exception = exn
static member Undefined = undefined
/// Just like "Lazy" but EVERY forcer must provide an instance of "ctxt", e.g. to help track errors
......@@ -994,21 +1024,28 @@ type LazyWithContextFailure(exn:exn) =
type LazyWithContext<'T,'ctxt> =
{ /// This field holds the result of a successful computation. It's initial value is Unchecked.defaultof
mutable value : 'T
/// This field holds either the function to run or a LazyWithContextFailure object recording the exception raised
/// from running the function. It is null if the thunk has been evaluated successfully.
mutable funcOrException: obj;
mutable funcOrException: obj
/// A helper to ensure we rethrow the "original" exception
findOriginalException : exn -> exn }
static member Create(f: ('ctxt->'T), findOriginalException) : LazyWithContext<'T,'ctxt> =
{ value = Unchecked.defaultof<'T>;
funcOrException = box f;
{ value = Unchecked.defaultof<'T>
funcOrException = box f
findOriginalException = findOriginalException }
static member NotLazy(x:'T) : LazyWithContext<'T,'ctxt> =
{ value = x
funcOrException = null
findOriginalException = id }
member x.IsDelayed = (match x.funcOrException with null -> false | :? LazyWithContextFailure -> false | _ -> true)
member x.IsForced = (match x.funcOrException with null -> true | _ -> false)
member x.Force(ctxt:'ctxt) =
match x.funcOrException with
| null -> x.value
......@@ -1030,21 +1067,16 @@ type LazyWithContext<'T,'ctxt> =
x.funcOrException <- box(LazyWithContextFailure.Undefined)
try
let res = f ctxt
x.value <- res;
x.funcOrException <- null;
x.value <- res
x.funcOrException <- null
res
with e ->
x.funcOrException <- box(new LazyWithContextFailure(e));
x.funcOrException <- box(new LazyWithContextFailure(e))
reraise()
| _ ->
failwith "unreachable"
// --------------------------------------------------------------------
// Intern tables to save space.
// --------------------------------------------------------------------
/// Intern tables to save space.
module Tables =
let memoize f =
let t = new Dictionary<_,_>(1000, HashIdentity.Structural)
......@@ -1055,7 +1087,6 @@ module Tables =
else
res <- f x; t.[x] <- res; res
/// Interface that defines methods for comparing objects using partial equality relation
type IPartialEqualityComparer<'T> =
inherit IEqualityComparer<'T>
......@@ -1063,14 +1094,13 @@ type IPartialEqualityComparer<'T> =
abstract InEqualityRelation : 'T -> bool
module IPartialEqualityComparer =
let On f (c: IPartialEqualityComparer<_>) =
{ new IPartialEqualityComparer<_> with
member __.InEqualityRelation x = c.InEqualityRelation (f x)
member __.Equals(x, y) = c.Equals(f x, f y)
member __.GetHashCode x = c.GetHashCode(f x) }
// Wrapper type for use by the 'partialDistinctBy' function
[<StructuralEquality; NoComparison>]
type private WrapType<'T> = Wrap of 'T
......@@ -1090,27 +1120,37 @@ module IPartialEqualityComparer =
if dict.ContainsKey(key) then false else (dict.[key] <- null; true)
else true)
//-------------------------------------------------------------------------
// Library: Name maps
//------------------------------------------------------------------------
type NameMap<'T> = Map<string,'T>
type NameMultiMap<'T> = NameMap<'T list>
type MultiMap<'T,'U when 'T : comparison> = Map<'T,'U list>
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module NameMap =
let empty = Map.empty
let range m = List.rev (Map.foldBack (fun _ x sofar -> x :: sofar) m [])
let foldBack f (m:NameMap<'T>) z = Map.foldBack f m z
let forall f m = Map.foldBack (fun x y sofar -> sofar && f x y) m true
let exists f m = Map.foldBack (fun x y sofar -> sofar || f x y) m false
let ofKeyedList f l = List.foldBack (fun x acc -> Map.add (f x) x acc) l Map.empty
let ofList l : NameMap<'T> = Map.ofList l
let ofSeq l : NameMap<'T> = Map.ofSeq l
let toList (l: NameMap<'T>) = Map.toList l
let layer (m1 : NameMap<'T>) m2 = Map.foldBack Map.add m1 m2
/// Not a very useful function - only called in one place - should be changed
......@@ -1165,49 +1205,76 @@ module NameMap =
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module NameMultiMap =
let existsInRange f (m: NameMultiMap<'T>) = NameMap.exists (fun _ l -> List.exists f l) m
let find v (m: NameMultiMap<'T>) = match m.TryGetValue v with true, r -> r | _ -> []
let add v x (m: NameMultiMap<'T>) = NameMap.add v (x :: find v m) m
let range (m: NameMultiMap<'T>) = Map.foldBack (fun _ x sofar -> x @ sofar) m []
let rangeReversingEachBucket (m: NameMultiMap<'T>) = Map.foldBack (fun _ x sofar -> List.rev x @ sofar) m []
let chooseRange f (m: NameMultiMap<'T>) = Map.foldBack (fun _ x sofar -> List.choose f x @ sofar) m []
let map f (m: NameMultiMap<'T>) = NameMap.map (List.map f) m
let empty : NameMultiMap<'T> = Map.empty
let initBy f xs : NameMultiMap<'T> = xs |> Seq.groupBy f |> Seq.map (fun (k,v) -> (k,List.ofSeq v)) |> Map.ofSeq
let ofList (xs: (string * 'T) list) : NameMultiMap<'T> = xs |> Seq.groupBy fst |> Seq.map (fun (k,v) -> (k,List.ofSeq (Seq.map snd v))) |> Map.ofSeq
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module MultiMap =
let existsInRange f (m: MultiMap<_,_>) = Map.exists (fun _ l -> List.exists f l) m
let find v (m: MultiMap<_,_>) = match m.TryGetValue v with true, r -> r | _ -> []
let add v x (m: MultiMap<_,_>) = Map.add v (x :: find v m) m
let range (m: MultiMap<_,_>) = Map.foldBack (fun _ x sofar -> x @ sofar) m []
let empty : MultiMap<_,_> = Map.empty
let initBy f xs : MultiMap<_,_> = xs |> Seq.groupBy f |> Seq.map (fun (k,v) -> (k,List.ofSeq v)) |> Map.ofSeq
type LayeredMap<'Key,'Value when 'Key : comparison> = Map<'Key,'Value>
type Map<'Key,'Value when 'Key : comparison> with
static member Empty : Map<'Key,'Value> = Map.empty
member x.Values = [ for (KeyValue(_,v)) in x -> v ]
member x.AddAndMarkAsCollapsible (kvs: _[]) = (x,kvs) ||> Array.fold (fun x (KeyValue(k,v)) -> x.Add(k,v))
member x.LinearTryModifyThenLaterFlatten (key, f: 'Value option -> 'Value) = x.Add (key, f (x.TryFind key))
member x.MarkAsCollapsible () = x
/// Immutable map collection, with explicit flattening to a backing dictionary
[<Sealed>]
type LayeredMultiMap<'Key,'Value when 'Key : equality and 'Key : comparison>(contents : LayeredMap<'Key,'Value list>) =
member x.Add (k,v) = LayeredMultiMap(contents.Add(k,v :: x.[k]))
member x.Item with get k = match contents.TryGetValue k with true, l -> l | _ -> []
member x.AddAndMarkAsCollapsible (kvs: _[]) =
let x = (x,kvs) ||> Array.fold (fun x (KeyValue(k,v)) -> x.Add(k,v))
x.MarkAsCollapsible()
member x.MarkAsCollapsible() = LayeredMultiMap(contents.MarkAsCollapsible())
member x.TryFind k = contents.TryFind k
member x.TryGetValue k = contents.TryGetValue k
member x.Values = contents.Values |> List.concat
static member Empty : LayeredMultiMap<'Key,'Value> = LayeredMultiMap LayeredMap.Empty
[<AutoOpen>]
......@@ -1320,6 +1387,7 @@ module Shim =
let mutable FileSystem = DefaultFileSystem() :> IFileSystem
type File with
static member ReadBinaryChunk (fileName, start, len) =
use stream = FileSystem.FileStreamReadShim fileName
stream.Seek(int64 start, SeekOrigin.Begin) |> ignore
......
......@@ -59,7 +59,7 @@ let rec ty_tref2tref f x =
| ILType.FunctionPointer x ->
ILType.FunctionPointer
{ x with
ArgTypes=List.map (ty_tref2tref f) x.ArgTypes;
ArgTypes=List.map (ty_tref2tref f) x.ArgTypes
ReturnType=ty_tref2tref f x.ReturnType}
| ILType.Byref t -> ILType.Byref (ty_tref2tref f t)
| ILType.Boxed cr -> mkILBoxedType (tspec_tref2tref f cr)
......@@ -85,7 +85,7 @@ and tspec_scoref2scoref_tyvar2ty fs (x:ILTypeSpec) =
ILTypeSpec.Create(morphILScopeRefsInILTypeRef (fst fs) x.TypeRef,tys_scoref2scoref_tyvar2ty fs x.GenericArgs)
and callsig_scoref2scoref_tyvar2ty f x =
{ x with
ArgTypes=List.map (ty_scoref2scoref_tyvar2ty f) x.ArgTypes;
ArgTypes=List.map (ty_scoref2scoref_tyvar2ty f) x.ArgTypes
ReturnType=ty_scoref2scoref_tyvar2ty f x.ReturnType}
and tys_scoref2scoref_tyvar2ty f i = List.map (ty_scoref2scoref_tyvar2ty f) i
and gparams_scoref2scoref_tyvar2ty f i = List.map (gparam_scoref2scoref_tyvar2ty f) i
......@@ -95,8 +95,8 @@ and morphILScopeRefsInILTypeRef fscope (x:ILTypeRef) =
let callsig_ty2ty f (x: ILCallingSignature) =
{ CallingConv=x.CallingConv;
ArgTypes=List.map f x.ArgTypes;
{ CallingConv=x.CallingConv
ArgTypes=List.map f x.ArgTypes
ReturnType=f x.ReturnType}
let gparam_ty2ty f gf = {gf with Constraints = List.map f gf.Constraints}
......@@ -119,11 +119,11 @@ let mspec_ty2ty (((factualty : ILType -> ILType) , (fformalty: formal_scopeCtxt
tys_ty2ty factualty x.GenericArgs)
let fref_ty2ty (f: ILType -> ILType) x =
{ x with DeclaringTypeRef = (f (mkILBoxedType (mkILNonGenericTySpec x.DeclaringTypeRef))).TypeRef;
{ x with DeclaringTypeRef = (f (mkILBoxedType (mkILNonGenericTySpec x.DeclaringTypeRef))).TypeRef
Type= f x.Type }
let fspec_ty2ty ((factualty,(fformalty : formal_scopeCtxt -> ILType -> ILType))) x =
{ FieldRef=fref_ty2ty (fformalty (Choice2Of2 x)) x.FieldRef;
{ FieldRef=fref_ty2ty (fformalty (Choice2Of2 x)) x.FieldRef
DeclaringType= factualty x.DeclaringType }
let rec celem_ty2ty f celem =
......@@ -213,7 +213,7 @@ let locals_ty2ty f ls = List.map (local_ty2ty f) ls
let ilmbody_instr2instr_ty2ty fs (il: ILMethodBody) =
let (finstr,ftye) = fs
{il with Code=code_instr2instr_ty2ty (finstr,ftye) il.Code;
{il with Code=code_instr2instr_ty2ty (finstr,ftye) il.Code
Locals = locals_ty2ty ftye il.Locals }
let morphILMethodBody (filmbody) (x: ILLazyMethodBody) =
......@@ -240,7 +240,7 @@ let fdefs_ty2ty ilg f x = fdefs_fdef2fdef (fdef_ty2ty ilg f) x
let mdefs_ty2ty_ilmbody2ilmbody ilg fs x = morphILMethodDefs (mdef_ty2ty_ilmbody2ilmbody ilg fs) x
let mimpl_ty2ty f e =
{ Overrides = ospec_ty2ty f e.Overrides;
{ Overrides = ospec_ty2ty f e.Overrides
OverrideBy = mspec_ty2ty (f,(fun _ -> f)) e.OverrideBy; }
let edef_ty2ty ilg f (e: ILEventDef) =
......@@ -293,8 +293,8 @@ let morphILTypeInILModule_ilmbody2ilmbody_mdefs2mdefs ilg ((ftye: ILModuleDef ->
let ftdefs = tdefs_ty2ty_ilmbody2ilmbody_mdefs2mdefs ilg [] (ftye m,fmdefs m)
{ m with TypeDefs=ftdefs m.TypeDefs;
CustomAttrsStored= storeILCustomAttrs (cattrs_ty2ty ilg (ftye m None None) m.CustomAttrs);
{ m with TypeDefs=ftdefs m.TypeDefs
CustomAttrsStored= storeILCustomAttrs (cattrs_ty2ty ilg (ftye m None None) m.CustomAttrs)
Manifest=Option.map (manifest_ty2ty ilg (ftye m None None)) m.Manifest }
let module_instr2instr_ty2ty ilg fs x =
......
此差异已折叠。
......@@ -1588,7 +1588,7 @@ let getDataEndPointsDelayed (pectxt: PEReader) ctxtH =
let nm = readStringHeap ctxt nameIdx
res := (nm, rva) :: !res
!res
([ pectxt.textSegmentPhysicalLoc + pectxt.textSegmentPhysicalSize ;
([ pectxt.textSegmentPhysicalLoc + pectxt.textSegmentPhysicalSize
pectxt.dataSegmentPhysicalLoc + pectxt.dataSegmentPhysicalSize ]
@
(List.map pectxt.anyV2P
......@@ -3762,8 +3762,8 @@ let openPEFileReader (fileName, pefile: BinaryFile, pdbDirPath, noFileOnDisk) =
let subsysMajor = seekReadUInt16AsInt32 pev (peOptionalHeaderPhysLoc + 48) // SubSys Major Always 4 (see Section 23.1).
let subsysMinor = seekReadUInt16AsInt32 pev (peOptionalHeaderPhysLoc + 50) // SubSys Minor Always 0 (see Section 23.1).
(* x86: 000000d0 *)
let _imageEndAddr = seekReadInt32 pev (peOptionalHeaderPhysLoc + 56) // Image Size: Size, in bytes, of image, including all headers and padding;
let _headerPhysSize = seekReadInt32 pev (peOptionalHeaderPhysLoc + 60) // Header Size Combined size of MS-DOS Header, PE Header, PE Optional Header and padding;
let _imageEndAddr = seekReadInt32 pev (peOptionalHeaderPhysLoc + 56) // Image Size: Size, in bytes, of image, including all headers and padding
let _headerPhysSize = seekReadInt32 pev (peOptionalHeaderPhysLoc + 60) // Header Size Combined size of MS-DOS Header, PE Header, PE Optional Header and padding
let subsys = seekReadUInt16 pev (peOptionalHeaderPhysLoc + 68) // SubSystem Subsystem required to run this image.
let useHighEnthropyVA =
let n = seekReadUInt16 pev (peOptionalHeaderPhysLoc + 70)
......
此差异已折叠。
......@@ -44,7 +44,7 @@ open System.Runtime.InteropServices
val UnderlyingArray: byte[]
[<FieldOffset(0)>]val ImmutableArray: ImmutableArray<byte>
new (immutableArray:ImmutableArray<byte>) = { UnderlyingArray = Array.empty<byte> ; ImmutableArray = immutableArray}
new (immutableArray:ImmutableArray<byte>) = { UnderlyingArray = Array.empty<byte>; ImmutableArray = immutableArray}
end
let getUnderlyingArray (array:ImmutableArray<byte>) =ByteArrayUnion(array).UnderlyingArray
......@@ -53,8 +53,8 @@ open System.Runtime.InteropServices
// remain static (skip checksum, Authenticode signatures and strong name signature blob)
let hashAssembly (peReader:PEReader) (hashAlgorithm:IncrementalHash ) =
// Hash content of all headers
let peHeaders = peReader.PEHeaders;
let peHeaderOffset = peHeaders.PEHeaderStartOffset;
let peHeaders = peReader.PEHeaders
let peHeaderOffset = peHeaders.PEHeaderStartOffset
// Even though some data in OptionalHeader is different for 32 and 64, this field is the same
let checkSumOffset = peHeaderOffset + 0x40; // offsetof(IMAGE_OPTIONAL_HEADER, CheckSum)
......@@ -67,7 +67,7 @@ open System.Runtime.InteropServices
let allHeadersSize = peHeaderOffset + peHeaderSize + int(peHeaders.CoffHeader.NumberOfSections) * 0x28; // sizeof(IMAGE_SECTION_HEADER)
let allHeaders =
let array:byte[] = Array.zeroCreate<byte> allHeadersSize
peReader.GetEntireImage().GetContent().CopyTo(0, array, 0, allHeadersSize);
peReader.GetEntireImage().GetContent().CopyTo(0, array, 0, allHeadersSize)
array
// Clear checksum and security data directory
......@@ -117,7 +117,7 @@ open System.Runtime.InteropServices
member x.ReadBigInteger (length:int):byte[] =
let arr:byte[] = Array.zeroCreate<byte> length
Array.Copy(x._blob, x._offset, arr, 0, length) |> ignore
x._offset <- x._offset + length;
x._offset <- x._offset + length
arr |> Array.rev
let RSAParamatersFromBlob (blob:byte[]) keyType =
......
......@@ -488,25 +488,25 @@ type ResFormatNode(tid:int32, nid:int32, lid:int32, dataOffset:int32, pbLinkedRe
do
if (tid &&& 0x80000000) <> 0 then // REVIEW: Are names and types mutually exclusive? The C++ code didn't seem to think so, but I can't find any documentation
resHdr.TypeID <- 0 ;
resHdr.TypeID <- 0
let mtid = tid &&& 0x7fffffff
cType <- bytesToDWord(pbLinkedResource.[mtid], pbLinkedResource.[mtid+1], pbLinkedResource.[mtid+2], pbLinkedResource.[mtid+3]) ;
wzType <- Bytes.zeroCreate ((cType + 1) * 2) ;
cType <- bytesToDWord(pbLinkedResource.[mtid], pbLinkedResource.[mtid+1], pbLinkedResource.[mtid+2], pbLinkedResource.[mtid+3])
wzType <- Bytes.zeroCreate ((cType + 1) * 2)
Bytes.blit pbLinkedResource 4 wzType 0 (cType * 2)
else
resHdr.TypeID <- (0xffff ||| ((tid &&& 0xffff) <<< 16)) ;
resHdr.TypeID <- (0xffff ||| ((tid &&& 0xffff) <<< 16))
if (nid &&& 0x80000000) <> 0 then
resHdr.NameID <- 0 ;
resHdr.NameID <- 0
let mnid = nid &&& 0x7fffffff
cName <- bytesToDWord(pbLinkedResource.[mnid], pbLinkedResource.[mnid+1], pbLinkedResource.[mnid+2], pbLinkedResource.[mnid+3]) ;
wzName <- Bytes.zeroCreate ((cName + 1) * 2) ;
cName <- bytesToDWord(pbLinkedResource.[mnid], pbLinkedResource.[mnid+1], pbLinkedResource.[mnid+2], pbLinkedResource.[mnid+3])
wzName <- Bytes.zeroCreate ((cName + 1) * 2)
Bytes.blit pbLinkedResource 4 wzName 0 (cName * 2)
else
resHdr.NameID <- (0xffff ||| ((nid &&& 0xffff) <<< 16))
resHdr.LangID <- (int16)lid ;
dataEntry <- bytesToIRDataE pbLinkedResource dataOffset ;
resHdr.LangID <- (int16)lid
dataEntry <- bytesToIRDataE pbLinkedResource dataOffset
resHdr.DataSize <- dataEntry.Size
member x.ResHdr
......@@ -572,7 +572,7 @@ type ResFormatNode(tid:int32, nid:int32, lid:int32, dataOffset:int32, pbLinkedRe
let pbData = pbLinkedResource.[(dataEntry.OffsetToData - ulLinkedResourceBaseRVA) ..]
SaveChunk(pbData, dataEntry.Size)
dwFiller <- dataEntry.Size &&& 0x3 ;
dwFiller <- dataEntry.Size &&& 0x3
if dwFiller <> 0 then
SaveChunk(bNil, 4 - dwFiller)
......@@ -623,7 +623,7 @@ let linkNativeResources (unlinkedResources:byte[] list) (ulLinkedResourceBaseRV
for _ulr in unlinkedResources do
let tempResFileName = GetUniqueRandomFileName(path)
resFiles <- tempResFileName :: resFiles ;
resFiles <- tempResFileName :: resFiles
cmdLineArgs <- cmdLineArgs + " \"" + tempResFileName + "\""
let trf = resFiles
let cmd = cmdLineArgs
......@@ -649,7 +649,7 @@ let linkNativeResources (unlinkedResources:byte[] list) (ulLinkedResourceBaseRV
for ulr in unlinkedResources do
// REVIEW: What can go wrong here? What happens when the various file calls fail
// dump the unlinked resource bytes into the temp file
System.IO.File.WriteAllBytes(tempResFileNames.[iFiles], ulr) ;
System.IO.File.WriteAllBytes(tempResFileNames.[iFiles], ulr)
iFiles <- iFiles + 1
// call cvtres.exe using the full cmd line string we've generated
......@@ -660,9 +660,9 @@ let linkNativeResources (unlinkedResources:byte[] list) (ulLinkedResourceBaseRV
// REVIEW: We really shouldn't be calling out to cvtres
let mutable psi = System.Diagnostics.ProcessStartInfo(cvtres)
psi.Arguments <- cmdLineArgs ;
psi.Arguments <- cmdLineArgs
psi.CreateNoWindow <- true ; // REVIEW: For some reason, this still creates a window unless WindowStyle is set to hidden
psi.WindowStyle <- System.Diagnostics.ProcessWindowStyle.Hidden ;
psi.WindowStyle <- System.Diagnostics.ProcessWindowStyle.Hidden
let p = System.Diagnostics.Process.Start(psi)
// Wait for the process to finish
......@@ -671,7 +671,7 @@ let linkNativeResources (unlinkedResources:byte[] list) (ulLinkedResourceBaseRV
check "Process.Start" p.ExitCode // TODO: really need to check against 0
// Conversion was successful, so read the object file
objBytes <- FileSystem.ReadAllBytesShim(tempObjFileName) ;
objBytes <- FileSystem.ReadAllBytesShim(tempObjFileName)
//Array.Copy(objBytes, pbUnlinkedResource, pbUnlinkedResource.Length)
FileSystem.FileDelete(tempObjFileName)
finally
......@@ -756,7 +756,7 @@ let unlinkResource (ulLinkedResourceBaseRVA:int32) (pbLinkedResource:byte[]) =
// determine entry buffer size
// TODO: coalesce these two loops
for iEntry = 0 to ((int)nEntries - 1) do
pirdeType <- bytesToIRDE pbLinkedResource (IMAGE_RESOURCE_DIRECTORY.Width + (iEntry * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width)) ;
pirdeType <- bytesToIRDE pbLinkedResource (IMAGE_RESOURCE_DIRECTORY.Width + (iEntry * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width))
if pirdeType.DataIsDirectory then
let nameBase = pirdeType.OffsetToDirectory
......@@ -765,25 +765,25 @@ let unlinkResource (ulLinkedResourceBaseRVA:int32) (pbLinkedResource:byte[]) =
let nEntries2 = pirdName.NumberOfNamedEntries + pirdName.NumberOfIdEntries
for iEntry2 = 0 to ((int)nEntries2 - 1) do
pirdeName <- bytesToIRDE pbLinkedResource (nameBase + (iEntry2 * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width)) ;
pirdeName <- bytesToIRDE pbLinkedResource (nameBase + (iEntry2 * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width))
if pirdeName.DataIsDirectory then
let langBase = pirdeName.OffsetToDirectory
let pirdLang = bytesToIRD pbLinkedResource langBase
let nEntries3 = pirdLang.NumberOfNamedEntries + pirdLang.NumberOfIdEntries
nResNodes <- nResNodes + ((int)nEntries3) ;
nResNodes <- nResNodes + ((int)nEntries3)
else
nResNodes <- nResNodes + 1 ;
nResNodes <- nResNodes + 1
else
nResNodes <- nResNodes + 1 ;
nResNodes <- nResNodes + 1
let pResNodes : ResFormatNode [] = Array.zeroCreate nResNodes
nResNodes <- 0 ;
nResNodes <- 0
// fill out the entry buffer
for iEntry = 0 to ((int)nEntries - 1) do
pirdeType <- bytesToIRDE pbLinkedResource (IMAGE_RESOURCE_DIRECTORY.Width + (iEntry * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width)) ;
pirdeType <- bytesToIRDE pbLinkedResource (IMAGE_RESOURCE_DIRECTORY.Width + (iEntry * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width))
let dwTypeID = pirdeType.Name
// Need to skip VERSION and RT_MANIFEST resources
// REVIEW: ideally we shouldn't allocate space for these, or rename properly so we don't get the naming conflict
......@@ -795,7 +795,7 @@ let unlinkResource (ulLinkedResourceBaseRVA:int32) (pbLinkedResource:byte[]) =
let nEntries2 = pirdName.NumberOfNamedEntries + pirdName.NumberOfIdEntries
for iEntry2 = 0 to ((int)nEntries2 - 1) do
pirdeName <- bytesToIRDE pbLinkedResource (nameBase + (iEntry2 * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width)) ;
pirdeName <- bytesToIRDE pbLinkedResource (nameBase + (iEntry2 * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width))
let dwNameID = pirdeName.Name
if pirdeName.DataIsDirectory then
......@@ -805,7 +805,7 @@ let unlinkResource (ulLinkedResourceBaseRVA:int32) (pbLinkedResource:byte[]) =
let nEntries3 = pirdLang.NumberOfNamedEntries + pirdLang.NumberOfIdEntries
for iEntry3 = 0 to ((int)nEntries3 - 1) do
pirdeLang <- bytesToIRDE pbLinkedResource (langBase + (iEntry3 * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width)) ;
pirdeLang <- bytesToIRDE pbLinkedResource (langBase + (iEntry3 * IMAGE_RESOURCE_DIRECTORY_ENTRY.Width))
let dwLangID = pirdeLang.Name
if pirdeLang.DataIsDirectory then
......@@ -814,25 +814,25 @@ let unlinkResource (ulLinkedResourceBaseRVA:int32) (pbLinkedResource:byte[]) =
else
if (not skipResource) then
let rfn = ResFormatNode(dwTypeID, dwNameID, dwLangID, pirdeLang.OffsetToData, pbLinkedResource)
pResNodes.[nResNodes] <- rfn ;
nResNodes <- nResNodes + 1 ;
pResNodes.[nResNodes] <- rfn
nResNodes <- nResNodes + 1
else
if (not skipResource) then
let rfn = ResFormatNode(dwTypeID, dwNameID, 0, pirdeName.OffsetToData, pbLinkedResource)
pResNodes.[nResNodes] <- rfn ;
nResNodes <- nResNodes + 1 ;
pResNodes.[nResNodes] <- rfn
nResNodes <- nResNodes + 1
else
if (not skipResource) then
let rfn = ResFormatNode(dwTypeID, 0, 0, pirdeType.OffsetToData, pbLinkedResource) // REVIEW: I believe these 0s are what's causing the duplicate res naming problems
pResNodes.[nResNodes] <- rfn ;
nResNodes <- nResNodes + 1 ;
pResNodes.[nResNodes] <- rfn
nResNodes <- nResNodes + 1
// Ok, all tree leaves are in ResFormatNode structs, and nResNodes ptrs are in pResNodes
let mutable size = 0
if nResNodes <> 0 then
size <- size + ResFormatHeader.Width ; // sizeof(ResFormatHeader)
for i = 0 to (nResNodes - 1) do
size <- size + pResNodes.[i].Save(ulLinkedResourceBaseRVA, pbLinkedResource, Unchecked.defaultof<byte[]>, 0) ;
size <- size + pResNodes.[i].Save(ulLinkedResourceBaseRVA, pbLinkedResource, Unchecked.defaultof<byte[]>, 0)
let pResBuffer = Bytes.zeroCreate size
......@@ -1005,11 +1005,11 @@ type ISymUnmanagedWriter2 =
type PdbWriter = { symWriter : ISymUnmanagedWriter2 }
type PdbDocumentWriter = { symDocWriter : ISymUnmanagedDocumentWriter } (* pointer to pDocumentWriter COM object *)
type idd =
{ iddCharacteristics: int32;
{ iddCharacteristics: int32
iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
iddMinorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
iddType: int32;
iddData: byte[];}
iddType: int32
iddData: byte[] }
#endif
#if !FX_NO_PDB_WRITER
......@@ -1019,7 +1019,7 @@ let pdbInitialize (binaryName:string) (pdbName:string) =
// get the importer pointer
let mdd = System.Activator.CreateInstance(CorMetaDataDispenser) :?> IMetaDataDispenser
let mutable IID_IMetaDataEmit = new Guid("BA3FEE4C-ECB9-4E41-83B7-183FA41CD859");
let mutable IID_IMetaDataEmit = new Guid("BA3FEE4C-ECB9-4E41-83B7-183FA41CD859")
let mutable o = Object()
mdd.OpenScope(binaryName, 0x1, &IID_IMetaDataEmit, &o) // 0x1 = ofWrite
let emitterPtr = Marshal.GetComInterfaceForObject(o, typeof<IMetadataEmit>)
......@@ -1139,10 +1139,10 @@ let pdbWriteDebugInfo (writer: PdbWriter) =
let mutable data : byte [] = Array.zeroCreate length
writer.symWriter.GetDebugInfo(&iDD, length, &length, data)
{ iddCharacteristics = iDD.Characteristics;
iddMajorVersion = (int32)iDD.MajorVersion;
iddMinorVersion = (int32)iDD.MinorVersion;
iddType = iDD.Type;
{ iddCharacteristics = iDD.Characteristics
iddMajorVersion = (int32)iDD.MajorVersion
iddMinorVersion = (int32)iDD.MinorVersion
iddType = iDD.Type
iddData = data}
#endif
......@@ -1156,19 +1156,19 @@ type PdbVariable = { symVariable: ISymbolVariable }
type PdbMethodScope = { symScope: ISymbolScope }
type PdbSequencePoint =
{ pdbSeqPointOffset: int;
pdbSeqPointDocument: PdbDocument;
pdbSeqPointLine: int;
pdbSeqPointColumn: int;
pdbSeqPointEndLine: int;
pdbSeqPointEndColumn: int; }
{ pdbSeqPointOffset: int
pdbSeqPointDocument: PdbDocument
pdbSeqPointLine: int
pdbSeqPointColumn: int
pdbSeqPointEndLine: int
pdbSeqPointEndColumn: int }
let pdbReadOpen (moduleName:string) (path:string) : PdbReader =
let CorMetaDataDispenser = System.Type.GetTypeFromProgID("CLRMetaData.CorMetaDataDispenser")
let mutable IID_IMetaDataImport = new Guid("7DAC8207-D3AE-4c75-9B67-92801A497D44");
let mutable IID_IMetaDataImport = new Guid("7DAC8207-D3AE-4c75-9B67-92801A497D44")
let mdd = System.Activator.CreateInstance(CorMetaDataDispenser) :?> IMetaDataDispenser
let mutable o : Object = new Object()
mdd.OpenScope(moduleName, 0, &IID_IMetaDataImport, &o) ;
mdd.OpenScope(moduleName, 0, &IID_IMetaDataImport, &o)
let importerPtr = Marshal.GetComInterfaceForObject(o, typeof<IMetadataImport>)
try
#if ENABLE_MONO_SUPPORT
......@@ -1242,12 +1242,12 @@ let pdbMethodGetSequencePoints (meth:PdbMethod) : PdbSequencePoint array =
meth.symMethod.GetSequencePoints(offsets, docs, lines, cols, endLines, endColumns)
Array.init pSize (fun i ->
{ pdbSeqPointOffset = offsets.[i];
pdbSeqPointDocument = { symDocument = docs.[i] };
pdbSeqPointLine = lines.[i];
pdbSeqPointColumn = cols.[i];
pdbSeqPointEndLine = endLines.[i];
pdbSeqPointEndColumn = endColumns.[i]; })
{ pdbSeqPointOffset = offsets.[i]
pdbSeqPointDocument = { symDocument = docs.[i] }
pdbSeqPointLine = lines.[i]
pdbSeqPointColumn = cols.[i]
pdbSeqPointEndLine = endLines.[i]
pdbSeqPointEndColumn = endColumns.[i] })
let pdbScopeGetChildren (scope:PdbMethodScope) : PdbMethodScope array =
let arr = scope.symScope.GetChildren()
......
此差异已折叠。
......@@ -117,12 +117,12 @@ type BinaryChunk =
addr: int32 }
type idd =
{ iddCharacteristics: int32;
{ iddCharacteristics: int32
iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
iddMinorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *)
iddType: int32;
iddTimestamp: int32;
iddData: byte[];
iddType: int32
iddTimestamp: int32
iddData: byte[]
iddChunk: BinaryChunk }
//---------------------------------------------------------------------
......@@ -143,13 +143,13 @@ let pdbGetCvDebugInfo (mvid:byte[]) (timestamp:int32) (filepath:string) (cvChunk
let (offset, size) = (offset + size, path.Length) // Path to pdb string
Buffer.BlockCopy(path, 0, buffer, offset, size)
buffer
{ iddCharacteristics = 0; // Reserved
iddMajorVersion = 0x0100; // VersionMajor should be 0x0100
iddMinorVersion = 0x504d; // VersionMinor should be 0x504d
iddType = 2; // IMAGE_DEBUG_TYPE_CODEVIEW
iddTimestamp = timestamp;
iddData = iddCvBuffer; // Path name to the pdb file when built
iddChunk = cvChunk;
{ iddCharacteristics = 0 // Reserved
iddMajorVersion = 0x0100 // VersionMajor should be 0x0100
iddMinorVersion = 0x504d // VersionMinor should be 0x504d
iddType = 2 // IMAGE_DEBUG_TYPE_CODEVIEW
iddTimestamp = timestamp
iddData = iddCvBuffer // Path name to the pdb file when built
iddChunk = cvChunk
}
let pdbMagicNumber= 0x4244504dL
......@@ -163,19 +163,19 @@ let pdbGetPdbDebugInfo (embeddedPDBChunk:BinaryChunk) (uncompressedLength:int64)
let (offset, size) = (offset + size, int(stream.Length)) // Uncompressed size
Buffer.BlockCopy(stream.ToArray(), 0, buffer, offset, size)
buffer
{ iddCharacteristics = 0; // Reserved
iddMajorVersion = 0; // VersionMajor should be 0
iddMinorVersion = 0x0100; // VersionMinor should be 0x0100
iddType = 17; // IMAGE_DEBUG_TYPE_EMBEDDEDPDB
iddTimestamp = 0;
iddData = iddPdbBuffer; // Path name to the pdb file when built
iddChunk = embeddedPDBChunk;
{ iddCharacteristics = 0 // Reserved
iddMajorVersion = 0 // VersionMajor should be 0
iddMinorVersion = 0x0100 // VersionMinor should be 0x0100
iddType = 17 // IMAGE_DEBUG_TYPE_EMBEDDEDPDB
iddTimestamp = 0
iddData = iddPdbBuffer // Path name to the pdb file when built
iddChunk = embeddedPDBChunk
}
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; |]
| Some s, Some chunk -> [| pdbGetCvDebugInfo mvid timestamp filepath cvChunk; pdbGetPdbDebugInfo chunk uncompressedLength s |]
// Document checksum algorithms
let guidSourceHashMD5 = System.Guid(0x406ea660u, 0x64cfus, 0x4c82us, 0xb6uy, 0xf0uy, 0x42uy, 0xd4uy, 0x81uy, 0x72uy, 0xa7uy, 0x99uy) //406ea660-64cf-4c82-b6f0-42d48172a799
......@@ -579,14 +579,14 @@ let writePdbInfo showTimes f fpdb info cvChunk =
let res = pdbWriteDebugInfo !pdbw
for pdbDoc in docs do pdbCloseDocument pdbDoc
pdbClose !pdbw f fpdb;
pdbClose !pdbw f fpdb
reportTime showTimes "PDB: Closed"
[| { iddCharacteristics = res.iddCharacteristics;
iddMajorVersion = res.iddMajorVersion;
iddMinorVersion = res.iddMinorVersion;
iddType = res.iddType;
iddTimestamp = info.Timestamp;
[| { iddCharacteristics = res.iddCharacteristics
iddMajorVersion = res.iddMajorVersion
iddMinorVersion = res.iddMinorVersion
iddType = res.iddType
iddTimestamp = info.Timestamp
iddData = res.iddData
iddChunk = cvChunk } |]
#endif
......
......@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netstandard1.6</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>FSharp.Compiler.Interactive.Settings</AssemblyName>
<NoWarn>$(NoWarn);45;55;62;75;1182;1204</NoWarn>
<AllowCrossTargeting>true</AllowCrossTargeting>
......
......@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netstandard1.6</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>FSharp.Compiler.Private</AssemblyName>
<NoWarn>$(NoWarn);45;55;62;75;1204</NoWarn>
<AllowCrossTargeting>true</AllowCrossTargeting>
......
......@@ -52,10 +52,6 @@ open FSharp.Compiler.ExtensionTyping
open Microsoft.FSharp.Core.CompilerServices
#endif
#if FX_RESHAPED_REFLECTION
open Microsoft.FSharp.Core.ReflectionAdapters
#endif
#if DEBUG
[<AutoOpen>]
module internal CompilerService =
......@@ -2650,7 +2646,7 @@ let OpenILBinary(filename, reduceMemoryUsage, ilGlobals, pdbDirPath, shadowCopyR
tryGetMetadataSnapshot = tryGetMetadataSnapshot }
let location =
#if !FX_RESHAPED_REFLECTION // shadow copy not supported
#if FX_NO_APP_DOMAINS
// In order to use memory mapped files on the shadow copied version of the Assembly, we `preload the assembly
// We swallow all exceptions so that we do not change the exception contract of this API
if shadowCopyReferences then
......@@ -2827,7 +2823,7 @@ type TcConfig private (data : TcConfigBuilder, validate:bool) =
// FUTURE: remove this, we only read the binary for the exception it raises
let fsharpBinariesDirValue =
// NOTE: It's not clear why this behaviour has been changed for the NETSTANDARD compilations of the F# compiler
#if NETSTANDARD1_6 || NETSTANDARD2_0
#if NETSTANDARD
ignore ilGlobals
data.defaultFSharpBinariesDir
#else
......@@ -2991,7 +2987,7 @@ type TcConfig private (data : TcConfigBuilder, validate:bool) =
| None ->
// "there is no really good notion of runtime directory on .NETCore"
#if NETSTANDARD1_6 || NETSTANDARD2_0
#if NETSTANDARD
let runtimeRoot = Path.GetDirectoryName(typeof<System.Object>.Assembly.Location)
#else
let runtimeRoot = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
......
......@@ -21,17 +21,11 @@ open FSharp.Compiler.Lib
open FSharp.Compiler.Range
open FSharp.Compiler.IlxGen
#if FX_RESHAPED_REFLECTION
open Microsoft.FSharp.Core.ReflectionAdapters
#endif
module Attributes =
open System.Runtime.CompilerServices
//[<assembly: System.Security.SecurityTransparent>]
#if !FX_NO_DEFAULT_DEPENDENCY_TYPE
[<Dependency("FSharp.Core",LoadHint.Always)>]
#endif
do()
//----------------------------------------------------------------------------
......@@ -332,7 +326,7 @@ let ParseCompilerOptions (collectOtherArgument : string -> unit, blocks: Compile
reportDeprecatedOption d
let al = getOptionArgList compilerOption argString
if al <> [] then
List.iter (fun i -> f (try int32 i with _ -> errorR(Error(FSComp.SR.buildArgInvalidInt(i),rangeCmdArgs)); 0)) al ;
List.iter (fun i -> f (try int32 i with _ -> errorR(Error(FSComp.SR.buildArgInvalidInt(i),rangeCmdArgs)); 0)) al
t
| (CompilerOption(s, _, OptionIntListSwitch f, d, _) as compilerOption :: _) when getSwitchOpt(optToken) = s ->
reportDeprecatedOption d
......@@ -391,18 +385,18 @@ let SetOptimizeOff(tcConfigB : TcConfigBuilder) =
tcConfigB.optSettings <- { tcConfigB.optSettings with localOptUser = Some false }
tcConfigB.optSettings <- { tcConfigB.optSettings with crossModuleOptUser = Some false }
tcConfigB.optSettings <- { tcConfigB.optSettings with lambdaInlineThreshold = 0 }
tcConfigB.doDetuple <- false;
tcConfigB.doTLR <- false;
tcConfigB.doFinalSimplify <- false;
tcConfigB.doDetuple <- false
tcConfigB.doTLR <- false
tcConfigB.doFinalSimplify <- false
let SetOptimizeOn(tcConfigB : TcConfigBuilder) =
tcConfigB.optSettings <- { tcConfigB.optSettings with jitOptUser = Some true }
tcConfigB.optSettings <- { tcConfigB.optSettings with localOptUser = Some true }
tcConfigB.optSettings <- { tcConfigB.optSettings with crossModuleOptUser = Some true }
tcConfigB.optSettings <- { tcConfigB.optSettings with lambdaInlineThreshold = 6 }
tcConfigB.doDetuple <- true;
tcConfigB.doTLR <- true;
tcConfigB.doFinalSimplify <- true;
tcConfigB.doDetuple <- true
tcConfigB.doTLR <- true
tcConfigB.doFinalSimplify <- true
let SetOptimizeSwitch (tcConfigB : TcConfigBuilder) switch =
if (switch = OptionSwitch.On) then SetOptimizeOn(tcConfigB) else SetOptimizeOff(tcConfigB)
......@@ -490,7 +484,7 @@ let SetDebugSwitch (tcConfigB : TcConfigBuilder) (dtype : string option) (s : Op
#endif
| _ -> error(Error(FSComp.SR.optsUnrecognizedDebugType(s), rangeCmdArgs))
| None -> tcConfigB.portablePDB <- false; tcConfigB.embeddedPDB <- false; tcConfigB.jitTracking <- s = OptionSwitch.On;
| None -> tcConfigB.portablePDB <- false; tcConfigB.embeddedPDB <- false; tcConfigB.jitTracking <- s = OptionSwitch.On
tcConfigB.debuginfo <- s = OptionSwitch.On
let SetEmbedAllSourceSwitch (tcConfigB : TcConfigBuilder) switch =
......@@ -552,7 +546,7 @@ let PrintOptionInfo (tcConfigB:TcConfigBuilder) =
let inputFileFlagsBoth (tcConfigB : TcConfigBuilder) =
[ CompilerOption("reference", tagFile, OptionString (fun s -> tcConfigB.AddReferencedAssemblyByPath (rangeStartup,s)), None,
Some (FSComp.SR.optsReference()) );
Some (FSComp.SR.optsReference()) )
]
let referenceFlagAbbrev (tcConfigB : TcConfigBuilder) =
......@@ -622,7 +616,7 @@ let outputFileFlagsFsc (tcConfigB : TcConfigBuilder) =
CompilerOption
("out", tagFile,
OptionString (setOutFileName tcConfigB), None,
Some (FSComp.SR.optsNameOfOutputFile()) );
Some (FSComp.SR.optsNameOfOutputFile()) )
CompilerOption
("target", tagExe,
......@@ -981,7 +975,6 @@ let testFlag tcConfigB =
match s with
| "StackSpan" -> tcConfigB.internalTestSpanStackReferring <- true
| "ErrorRanges" -> tcConfigB.errorStyle <- ErrorStyle.TestErrors
| "MemberBodyRanges" -> PostTypeCheckSemanticChecks.testFlagMemberBody := true
| "Tracking" -> Lib.tracking := true (* general purpose on/off diagnostics flag *)
| "NoNeedToTailcall" -> tcConfigB.optSettings <- { tcConfigB.optSettings with reportNoNeedToTailcall = true }
| "FunctionSizes" -> tcConfigB.optSettings <- { tcConfigB.optSettings with reportFunctionSizes = true }
......
......@@ -311,14 +311,14 @@ type TraitConstraintSolution =
let BakedInTraitConstraintNames =
[ "op_Division" ; "op_Multiply"; "op_Addition"
"op_Equality" ; "op_Inequality"; "op_GreaterThan" ; "op_LessThan"; "op_LessThanOrEqual"; "op_GreaterThanOrEqual"
"op_Subtraction"; "op_Modulus";
"get_Zero"; "get_One";
"DivideByInt";"get_Item"; "set_Item";
"op_BitwiseAnd"; "op_BitwiseOr"; "op_ExclusiveOr"; "op_LeftShift";
"op_Subtraction"; "op_Modulus"
"get_Zero"; "get_One"
"DivideByInt";"get_Item"; "set_Item"
"op_BitwiseAnd"; "op_BitwiseOr"; "op_ExclusiveOr"; "op_LeftShift"
"op_RightShift"; "op_UnaryPlus"; "op_UnaryNegation"; "get_Sign"; "op_LogicalNot"
"op_OnesComplement"; "Abs"; "Sqrt"; "Sin"; "Cos"; "Tan";
"Sinh"; "Cosh"; "Tanh"; "Atan"; "Acos"; "Asin"; "Exp"; "Ceiling"; "Floor"; "Round"; "Log10"; "Log"; "Sqrt";
"Truncate"; "op_Explicit";
"op_OnesComplement"; "Abs"; "Sqrt"; "Sin"; "Cos"; "Tan"
"Sinh"; "Cosh"; "Tanh"; "Atan"; "Acos"; "Asin"; "Exp"; "Ceiling"; "Floor"; "Round"; "Log10"; "Log"; "Sqrt"
"Truncate"; "op_Explicit"
"Pow"; "Atan2" ]
|> set
......@@ -448,12 +448,12 @@ let FindPreferredTypar vs =
find vs
let SubstMeasure (r:Typar) ms =
if r.Rigidity = TyparRigidity.Rigid then error(InternalError("SubstMeasure: rigid", r.Range));
if r.Kind = TyparKind.Type then error(InternalError("SubstMeasure: kind=type", r.Range));
if r.Rigidity = TyparRigidity.Rigid then error(InternalError("SubstMeasure: rigid", r.Range))
if r.Kind = TyparKind.Type then error(InternalError("SubstMeasure: kind=type", r.Range))
match r.typar_solution with
| None -> r.typar_solution <- Some (TType_measure ms)
| Some _ -> error(InternalError("already solved", r.Range));
| Some _ -> error(InternalError("already solved", r.Range))
let rec TransactStaticReq (csenv:ConstraintSolverEnv) (trace:OptionalTrace) (tpr:Typar) req =
let m = csenv.m
......@@ -573,7 +573,7 @@ let SimplifyMeasure g vars ms =
let remainingvars = ListSet.remove typarEq v vars
let newvarExpr = if SignRational e < 0 then Measure.Inv (Measure.Var newvar) else Measure.Var newvar
let newms = (ProdMeasures (List.map (fun (c, e') -> Measure.RationalPower (Measure.Con c, NegRational (DivRational e' e))) (ListMeasureConOccsWithNonZeroExponents g false ms)
@ List.map (fun (v', e') -> if typarEq v v' then newvarExpr else Measure.RationalPower (Measure.Var v', NegRational (DivRational e' e))) (ListMeasureVarOccsWithNonZeroExponents ms)));
@ List.map (fun (v', e') -> if typarEq v v' then newvarExpr else Measure.RationalPower (Measure.Var v', NegRational (DivRational e' e))) (ListMeasureVarOccsWithNonZeroExponents ms)))
SubstMeasure v newms
match vs with
| [] -> (remainingvars, Some newvar)
......@@ -1435,21 +1435,21 @@ and RecordMemberConstraintSolution css m trace traitInfo res =
| TTraitSolved (minfo, minst) ->
let sln = MemberConstraintSolutionOfMethInfo css m minfo minst
TransactMemberConstraintSolution traitInfo trace sln;
TransactMemberConstraintSolution traitInfo trace sln
ResultD true
| TTraitBuiltIn ->
TransactMemberConstraintSolution traitInfo trace BuiltInSln;
TransactMemberConstraintSolution traitInfo trace BuiltInSln
ResultD true
| TTraitSolvedRecdProp (rfinfo, isSet) ->
let sln = FSRecdFieldSln(rfinfo.TypeInst,rfinfo.RecdFieldRef,isSet)
TransactMemberConstraintSolution traitInfo trace sln;
TransactMemberConstraintSolution traitInfo trace sln
ResultD true
| TTraitSolvedAnonRecdProp (anonInfo, tinst, i) ->
let sln = FSAnonRecdFieldSln(anonInfo, tinst, i)
TransactMemberConstraintSolution traitInfo trace sln;
TransactMemberConstraintSolution traitInfo trace sln
ResultD true
/// Convert a MethInfo into the data we save in the TAST
......@@ -1758,29 +1758,33 @@ and AddConstraint (csenv:ConstraintSolverEnv) ndeep m2 trace tp newConstraint =
elif tp.Rigidity = TyparRigidity.Rigid then
return! ErrorD (ConstraintSolverMissingConstraint(denv, tp, newConstraint, m, m2))
else
// It is important that we give a warning if a constraint is missing from a
// will-be-made-rigid type variable. This is because the existence of these warnings
// is relevant to the overload resolution rules (see 'candidateWarnCount' in the overload resolution
// implementation). See also FSharp 1.0 bug 5461
if tp.Rigidity.WarnIfMissingConstraint then
do! WarnD (ConstraintSolverMissingConstraint(denv, tp, newConstraint, m, m2))
let newConstraints =
// Eliminate any constraints where one constraint implies another
// Keep constraints in the left-to-right form according to the order they are asserted.
// NOTE: QUADRATIC
let rec eliminateRedundant cxs acc =
match cxs with
| [] -> acc
| cx :: rest ->
eliminateRedundant rest (if List.exists (fun cx2 -> implies cx2 cx) acc then acc else (cx::acc))
// It is important that we give a warning if a constraint is missing from a
// will-be-made-rigid type variable. This is because the existence of these warnings
// is relevant to the overload resolution rules (see 'candidateWarnCount' in the overload resolution
// implementation).
if tp.Rigidity.WarnIfMissingConstraint then
do! WarnD (ConstraintSolverMissingConstraint(denv, tp, newConstraint, m, m2))
let newConstraints =
// Eliminate any constraints where one constraint implies another
// Keep constraints in the left-to-right form according to the order they are asserted.
// NOTE: QUADRATIC
let rec eliminateRedundant cxs acc =
match cxs with
| [] -> acc
| cx :: rest ->
let acc =
if List.exists (fun cx2 -> implies cx2 cx) acc then acc
else (cx::acc)
eliminateRedundant rest acc
eliminateRedundant allCxs []
eliminateRedundant allCxs []
// Write the constraint into the type variable
// Record a entry in the undo trace if one is provided
let orig = tp.Constraints
trace.Exec (fun () -> tp.SetConstraints newConstraints) (fun () -> tp.SetConstraints orig)
()
// Write the constraint into the type variable
// Record a entry in the undo trace if one is provided
let orig = tp.Constraints
trace.Exec (fun () -> tp.SetConstraints newConstraints) (fun () -> tp.SetConstraints orig)
()
}
......
......@@ -256,14 +256,16 @@ module GlobalUsageAnalysis =
let foldLocalVal f z (vref: ValRef) =
if valRefInThisAssembly g.compilingFslib vref then f z vref.Deref
else z
let exprUsageIntercept exprF z expr =
let exprUsageIntercept exprF noInterceptF z origExpr =
let rec recognise context expr =
match expr with
| Expr.Val (v, _, _) ->
match expr with
| Expr.Val (v, _, _) ->
// YES: count free occurrence
let z = foldLocalVal (fun z v -> logUse v (context, [], []) z) z v
Some z
| TyappAndApp(f, _, tys, args, _) ->
foldLocalVal (fun z v -> logUse v (context, [], []) z) z v
| TyappAndApp(f, _, tys, args, _) ->
match f with
| Expr.Val (fOrig, _, _) ->
// app where function is val
......@@ -271,27 +273,27 @@ module GlobalUsageAnalysis =
// collect from args (have intercepted this node)
let collect z f = logUse f (context, tys, args) z
let z = foldLocalVal collect z fOrig
let z = List.fold exprF z args
Some z
List.fold exprF z args
| _ ->
// NO: app but function is not val
None
noInterceptF z origExpr
| Expr.Op(TOp.TupleFieldGet (tupInfo, n), ts, [x], _) when not (evalTupInfoIsStruct tupInfo) ->
let context = TupleGet (n, ts) :: context
recognise context x
// lambdas end top-level status
| Expr.Lambda(_id, _ctorThisValOpt, _baseValOpt, _vs, body, _, _) ->
let z = foldUnderLambda exprF z body
Some z
foldUnderLambda exprF z body
| Expr.TyLambda(_id, _tps, body, _, _) ->
let z = foldUnderLambda exprF z body
Some z
foldUnderLambda exprF z body
| _ ->
None // NO: no intercept
noInterceptF z origExpr
let context = []
recognise context expr
recognise context origExpr
let targetIntercept exprF z = function TTarget(_argvs, body, _) -> Some (foldUnderLambda exprF z body)
let tmethodIntercept exprF z = function TObjExprMethod(_, _, _, _, e, _m) -> Some (foldUnderLambda exprF z e)
......
......@@ -18,10 +18,6 @@ module internal ExtensionTyping =
open FSharp.Compiler.AbstractIL.Diagnostics // dprintfn
open FSharp.Compiler.AbstractIL.Internal.Library // frontAndBack
#if FX_RESHAPED_REFLECTION
open Microsoft.FSharp.Core.ReflectionAdapters
#endif
type TypeProviderDesignation = TypeProviderDesignation of string
exception ProvidedTypeResolution of range * System.Exception
......@@ -359,33 +355,14 @@ module internal ExtensionTyping =
for KeyValue (st, tcref) in d2.Force() do dict.Add(st, f tcref)
dict))
#if FX_NO_CUSTOMATTRIBUTEDATA
type CustomAttributeData = Microsoft.FSharp.Core.CompilerServices.IProvidedCustomAttributeData
type CustomAttributeNamedArgument = Microsoft.FSharp.Core.CompilerServices.IProvidedCustomAttributeNamedArgument
type CustomAttributeTypedArgument = Microsoft.FSharp.Core.CompilerServices.IProvidedCustomAttributeTypedArgument
#else
type CustomAttributeData = System.Reflection.CustomAttributeData
type CustomAttributeNamedArgument = System.Reflection.CustomAttributeNamedArgument
type CustomAttributeTypedArgument = System.Reflection.CustomAttributeTypedArgument
#endif
[<AllowNullLiteral; Sealed>]
type ProvidedType (x:System.Type, ctxt: ProvidedTypeContext) =
#if FX_RESHAPED_REFLECTION
inherit ProvidedMemberInfo(x.GetTypeInfo(), ctxt)
#if FX_NO_CUSTOMATTRIBUTEDATA
let provide () = ProvidedCustomAttributeProvider.Create (fun provider -> provider.GetMemberCustomAttributesData(x.GetTypeInfo()) :> _)
#else
let provide () = ProvidedCustomAttributeProvider.Create (fun _provider -> x.GetTypeInfo().CustomAttributes)
#endif
#else
inherit ProvidedMemberInfo(x, ctxt)
#if FX_NO_CUSTOMATTRIBUTEDATA
let provide () = ProvidedCustomAttributeProvider.Create (fun provider -> provider.GetMemberCustomAttributesData(x) :> _)
#else
let provide () = ProvidedCustomAttributeProvider.Create (fun _provider -> x.CustomAttributes)
#endif
#endif
interface IProvidedCustomAttributeProvider with
member __.GetHasTypeProviderEditorHideMethodsAttribute(provider) = provide().GetHasTypeProviderEditorHideMethodsAttribute(provider)
member __.GetDefinitionLocationAttribute(provider) = provide().GetDefinitionLocationAttribute(provider)
......@@ -514,12 +491,7 @@ module internal ExtensionTyping =
and [<AllowNullLiteral; AbstractClass>]
ProvidedMemberInfo (x: System.Reflection.MemberInfo, ctxt) =
#if FX_NO_CUSTOMATTRIBUTEDATA
let provide () = ProvidedCustomAttributeProvider.Create (fun provider -> provider.GetMemberCustomAttributesData(x) :> _)
#else
let provide () = ProvidedCustomAttributeProvider.Create (fun _provider -> x.CustomAttributes)
#endif
member __.Name = x.Name
/// DeclaringType can be null if MemberInfo belongs to Module, not to Type
member __.DeclaringType = ProvidedType.Create ctxt x.DeclaringType
......@@ -531,18 +503,10 @@ module internal ExtensionTyping =
and [<AllowNullLiteral; Sealed>]
ProvidedParameterInfo (x: System.Reflection.ParameterInfo, ctxt) =
#if FX_NO_CUSTOMATTRIBUTEDATA
let provide () = ProvidedCustomAttributeProvider.Create (fun provider -> provider.GetParameterCustomAttributesData(x) :> _)
#else
let provide () = ProvidedCustomAttributeProvider.Create (fun _provider -> x.CustomAttributes)
#endif
member __.Name = x.Name
member __.IsOut = x.IsOut
#if FX_NO_ISIN_ON_PARAMETER_INFO
member __.IsIn = not x.IsOut
#else
member __.IsIn = x.IsIn
#endif
member __.IsOptional = x.IsOptional
member __.RawDefaultValue = x.RawDefaultValue
member __.HasDefaultValue = x.Attributes.HasFlag(System.Reflection.ParameterAttributes.HasDefault)
......
......@@ -85,12 +85,6 @@ module internal ExtensionTyping =
/// Map the TyconRef objects, if any
member RemapTyconRefs : (obj -> obj) -> ProvidedTypeContext
#if FX_NO_CUSTOMATTRIBUTEDATA
type CustomAttributeData = Microsoft.FSharp.Core.CompilerServices.IProvidedCustomAttributeData
type CustomAttributeNamedArgument = Microsoft.FSharp.Core.CompilerServices.IProvidedCustomAttributeNamedArgument
type CustomAttributeTypedArgument = Microsoft.FSharp.Core.CompilerServices.IProvidedCustomAttributeTypedArgument
#endif
type [<AllowNullLiteral; Sealed; Class>]
ProvidedType =
......
......@@ -238,19 +238,9 @@ open Printf
let StringBoilerPlate filename = @"
// BEGIN BOILERPLATE
static let getCurrentAssembly () =
#if FX_RESHAPED_REFLECTION
typeof<SR>.GetTypeInfo().Assembly
#else
System.Reflection.Assembly.GetExecutingAssembly()
#endif
static let getCurrentAssembly () = System.Reflection.Assembly.GetExecutingAssembly()
static let getTypeInfo (t: System.Type) =
#if FX_RESHAPED_REFLECTION
t.GetTypeInfo()
#else
t
#endif
static let getTypeInfo (t: System.Type) = t
static let resources = lazy (new System.Resources.ResourceManager(""" + filename + @""", getCurrentAssembly()))
......
......@@ -11,10 +11,6 @@ open Microsoft.Build.Framework
open Microsoft.Build.Utilities
open Internal.Utilities
#if FX_RESHAPED_REFLECTION
open Microsoft.FSharp.Core.ReflectionAdapters
#endif
//There are a lot of flags on fsc.exe.
//For now, not all of them are represented in the "Fsc class" object model.
//The goal is to have the most common/important flags available via the Fsc class, and the
......
......@@ -11,10 +11,6 @@ open Microsoft.Build.Framework
open Microsoft.Build.Utilities
open Internal.Utilities
#if FX_RESHAPED_REFLECTION
open Microsoft.FSharp.Core.ReflectionAdapters
#endif
//There are a lot of flags on fsi.exe.
//For now, not all of them are represented in the "Fsi class" object model.
//The goal is to have the most common/important flags available via the Fsi class, and the
......
......@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net472;netstandard1.6</TargetFrameworks>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<AssemblyName>FSharp.Compiler.Interactive.Settings</AssemblyName>
<NoWarn>$(NoWarn);45;55;62;75;1182;1204</NoWarn>
<AllowCrossTargeting>true</AllowCrossTargeting>
......
......@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net472;netstandard1.6</TargetFrameworks>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<AssemblyName>FSharp.Compiler.Private</AssemblyName>
<NoWarn>$(NoWarn);45;55;62;75;1204</NoWarn>
<AllowCrossTargeting>true</AllowCrossTargeting>
......@@ -235,7 +235,7 @@
<Compile Include="..\..\absil\ilmorph.fs">
<Link>AbsIL\ilmorph.fs</Link>
</Compile>
<Compile Include="..\..\absil\ilsign.fs" Condition="'$(TargetFramework)' == 'netstandard1.6'">
<Compile Include="..\..\absil\ilsign.fs" Condition="$(TargetFramework.StartsWith(netstandard))">
<Link>AbsIL\ilsign.fs</Link>
</Compile>
<Compile Include="..\..\absil\ilsupp.fsi">
......@@ -692,7 +692,7 @@
<PackageReference Include="System.IO.Compression" Version="$(SystemIoCompressionPackageVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.6'">
<ItemGroup Condition="$(TargetFramework.Startswith('netstandard'))">
<PackageReference Include="System.Runtime.Loader" Version="$(SystemRuntimeLoaderPackageVersion)" />
</ItemGroup>
......
......@@ -36,6 +36,6 @@
</dependencies>
</metadata>
<files>
<file src="FSharp.Compiler.Private.dll" target="lib\netstandard1.6" />
<file src="FSharp.Compiler.Private.dll" target="lib\netstandard2.0" />
</files>
</package>
......@@ -54,19 +54,21 @@
this approach gives a very small deployment. Which is kind of necessary.
-->
<!-- assemblies -->
<file src="$artifactsbindir$\fsc\$configuration$\netcoreapp2.1\fsc.exe" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\fsi\$configuration$\netcoreapp2.1\fsi.exe" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Core\$configuration$\netstandard1.6\FSharp.Core.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Private\$configuration$\netstandard1.6\FSharp.Compiler.Private.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Build\$configuration$\netstandard2.0\FSharp.Build.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Interactive.Settings\$configuration$\netstandard1.6\FSharp.Compiler.Interactive.Settings.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\fsc\$configuration$\netcoreapp2.1\fsc.exe" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\fsi\$configuration$\netcoreapp2.1\fsi.exe" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Core\$configuration$\netstandard1.6\FSharp.Core.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Private\$configuration$\netstandard2.0\FSharp.Compiler.Private.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Build\$configuration$\netstandard2.0\FSharp.Build.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Interactive.Settings\$configuration$\netstandard2.0\FSharp.Compiler.Interactive.Settings.dll"
target="lib\netcoreapp2.1" />
<!-- symbols -->
<file src="$artifactsbindir$\fsc\$configuration$\netcoreapp2.1\fsc.pdb" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\fsi\$configuration$\netcoreapp2.1\fsi.pdb" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Core\$configuration$\netstandard1.6\FSharp.Core.pdb" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Private\$configuration$\netstandard1.6\FSharp.Compiler.Private.pdb" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Build\$configuration$\netstandard2.0\FSharp.Build.pdb" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Interactive.Settings\$configuration$\netstandard1.6\FSharp.Compiler.Interactive.Settings.pdb" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\fsc\$configuration$\netcoreapp2.1\fsc.pdb" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\fsi\$configuration$\netcoreapp2.1\fsi.pdb" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Core\$configuration$\netstandard1.6\FSharp.Core.pdb" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Private\$configuration$\netstandard2.0\FSharp.Compiler.Private.pdb" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Build\$configuration$\netstandard2.0\FSharp.Build.pdb" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Interactive.Settings\$configuration$\netstandard2.0\FSharp.Compiler.Interactive.Settings.pdb"
target="lib\netcoreapp2.1" />
<!-- additional files -->
<file src="$artifactsbindir$\fsc\$configuration$\netcoreapp2.1\default.win32manifest" target="contentFiles\any\any" />
<file src="$artifactsbindir$\FSharp.Build\$configuration$\netstandard2.0\Microsoft.FSharp.Targets" target="contentFiles\any\any" />
......@@ -74,10 +76,13 @@
<file src="$artifactsbindir$\FSharp.Build\$configuration$\netstandard2.0\Microsoft.FSharp.NetSdk.props" target="contentFiles\any\any" />
<file src="$artifactsbindir$\FSharp.Build\$configuration$\netstandard2.0\Microsoft.FSharp.NetSdk.targets" target="contentFiles\any\any" />
<file src="$artifactsbindir$\FSharp.Build\$configuration$\netstandard2.0\Microsoft.FSharp.Overrides.NetSdk.targets" target="contentFiles\any\any" />
<!-- resources -->
<file src="$artifactsbindir$\FSharp.Core\$configuration$\netstandard1.6\**\FSharp.Core.resources.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Private\$configuration$\netstandard1.6\**\FSharp.Compiler.Private.resources.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Interactive.Settings\$configuration$\netstandard1.6\**\FSharp.Compiler.Interactive.Settings.resources.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Build\$configuration$\netstandard2.0\**\FSharp.Build.resources.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Core\$configuration$\netstandard1.6\**\FSharp.Core.resources.dll" target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Private\$configuration$\netstandard2.0\**\FSharp.Compiler.Private.resources.dll"
target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Compiler.Interactive.Settings\$configuration$\netstandard2.0\**\FSharp.Compiler.Interactive.Settings.resources.dll"
target="lib\netcoreapp2.1" />
<file src="$artifactsbindir$\FSharp.Build\$configuration$\netstandard2.0\**\FSharp.Build.resources.dll" target="lib\netcoreapp2.1" />
</files>
</package>
......@@ -53,7 +53,7 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("ZeroCreateBased")>]
let zeroCreateBased (base1:int) (base2:int) (length1:int) (length2:int) =
if (base1 = 0 && base2 = 0) then
#if NETSTANDARD1_6
#if NETSTANDARD
zeroCreate length1 length2
#else
// Note: this overload is available on Compact Framework and Silverlight, but not Portable
......
......@@ -19,7 +19,7 @@ namespace System.Numerics
// NOTE: 0 has two repns (+1,0) or (-1,0).
[<Struct>]
[<CustomEquality; CustomComparison>]
#if !NETSTANDARD1_6
#if !NETSTANDARD
[<StructuredFormatDisplay("{StructuredDisplayString}I")>]
#endif
type BigInteger(signInt:int, v : BigNat) =
......
......@@ -447,11 +447,11 @@ module internal Impl =
// Item1, Item2, ..., Item<maxTuple-1>
// Item1, Item2, ..., Item<maxTuple-1>, Rest
// The PropertyInfo may not come back in order, so ensure ordering here.
#if !NETSTANDARD1_6
#if !NETSTANDARD
assert(maxTuple < 10) // Alphasort will only works for upto 9 items: Item1, Item10, Item2, Item3, ..., Item9, Rest
#endif
let props = props |> Array.sortBy (fun p -> p.Name) // they are not always in alphabetic order
#if !NETSTANDARD1_6
#if !NETSTANDARD
assert(props.Length <= maxTuple)
assert(let haveNames = props |> Array.map (fun p -> p.Name)
let expectNames = Array.init props.Length (fun i -> let j = i+1 // index j = 1,2,..,props.Length <= maxTuple
......@@ -469,11 +469,11 @@ module internal Impl =
// Item1, Item2, ..., Item<maxTuple-1>
// Item1, Item2, ..., Item<maxTuple-1>, Rest
// The PropertyInfo may not come back in order, so ensure ordering here.
#if !NETSTANDARD1_6
#if !NETSTANDARD
assert(maxTuple < 10) // Alphasort will only works for upto 9 items: Item1, Item10, Item2, Item3, ..., Item9, Rest
#endif
let fields = fields |> Array.sortBy (fun fi -> fi.Name) // they are not always in alphabetic order
#if !NETSTANDARD1_6
#if !NETSTANDARD
assert(fields.Length <= maxTuple)
assert(let haveNames = fields |> Array.map (fun fi -> fi.Name)
let expectNames = Array.init fields.Length (fun i -> let j = i+1 // index j = 1,2,..,fields.Length <= maxTuple
......@@ -707,12 +707,11 @@ type UnionCaseInfo(typ: System.Type, tag:int) =
props
member __.GetCustomAttributes() = getMethInfo().GetCustomAttributes(false)
member __.GetCustomAttributes(attributeType) = getMethInfo().GetCustomAttributes(attributeType,false)
#if !FX_NO_CUSTOMATTRIBUTEDATA
member __.GetCustomAttributesData() = getMethInfo().CustomAttributes |> Seq.toArray :> System.Collections.Generic.IList<_>
#endif
member __.Tag = tag
override x.ToString() = typ.Name + "." + x.Name
override x.GetHashCode() = typ.GetHashCode() + tag
......
......@@ -29,13 +29,10 @@ type UnionCaseInfo =
/// <returns>An array of custom attributes.</returns>
member GetCustomAttributes: attributeType:System.Type -> obj[]
#if !FX_NO_CUSTOMATTRIBUTEDATA
/// <summary>Returns the custom attributes data associated with the case.</summary>
/// <returns>An list of custom attribute data items.</returns>
member GetCustomAttributesData: unit -> System.Collections.Generic.IList<CustomAttributeData>
#endif
/// <summary>The fields associated with the case, represented by a PropertyInfo.</summary>
/// <returns>The fields associated with the case.</returns>
member GetFields: unit -> PropertyInfo []
......
此差异已折叠。
此差异已折叠。
......@@ -100,4 +100,6 @@ type public IlxAssemblyGenerator =
val ReportStatistics : TextWriter -> unit
val IsValCompiledAsMethod : TcGlobals -> Val -> bool
/// Determine if an F#-declared value, method or function is compiled as a method.
val IsFSharpValCompiledAsMethod : TcGlobals -> Val -> bool
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -6,9 +6,6 @@ module internal FSharp.Compiler.MSBuildReferenceResolver
open System.IO
open System.Reflection
#if FX_RESHAPED_REFLECTION
open Microsoft.FSharp.Core.ReflectionAdapters
#endif
#if FX_RESHAPED_MSBUILD
open FSharp.Compiler.MsBuildAdapters
open FSharp.Compiler.ToolLocationHelper
......@@ -20,6 +17,11 @@ module internal FSharp.Compiler.MSBuildReferenceResolver
open Microsoft.Build.Utilities
open Microsoft.Build.Framework
// Reflection wrapper for properties
type System.Object with
member this.GetPropertyValue(propName) =
this.GetType().GetProperty(propName, BindingFlags.Public).GetValue(this, null)
/// Get the Reference Assemblies directory for the .NET Framework on Window.
let DotNetFrameworkReferenceAssembliesRootDirectory =
// ProgramFilesX86 is correct for both x86 and x64 architectures
......@@ -97,7 +99,7 @@ module internal FSharp.Compiler.MSBuildReferenceResolver
| _ -> []
let GetPathToDotNetFrameworkReferenceAssemblies(version) =
#if NETSTANDARD1_6 || NETSTANDARD2_0
#if NETSTANDARD
ignore version
let r : string list = []
r
......@@ -129,7 +131,7 @@ module internal FSharp.Compiler.MSBuildReferenceResolver
else Net45 // version is 4.5 assumed since this code is running.
with _ -> Net45
#if !FX_RESHAPED_REFLECTION
#if !FX_RESHAPED_MSBUILD
// 1. First look to see if we can find the highest installed set of dotnet reference assemblies, if yes then select that framework
// 2. Otherwise ask msbuild for the highestinstalled framework
let checkFrameworkForReferenceAssemblies (dotNetVersion:string) =
......@@ -336,9 +338,6 @@ module internal FSharp.Compiler.MSBuildReferenceResolver
FindSerializationAssemblies=false, Assemblies=assemblies,
SearchPaths=searchPaths,
AllowedAssemblyExtensions= [| ".dll" ; ".exe" |])
#if FX_RESHAPED_REFLECTION
ignore targetProcessorArchitecture // Not implemented in reshapedmsbuild.fs
#else
rar.TargetProcessorArchitecture <- targetProcessorArchitecture
let targetedRuntimeVersionValue = typeof<obj>.Assembly.ImageRuntimeVersion
#if ENABLE_MONO_SUPPORT
......@@ -351,7 +350,6 @@ module internal FSharp.Compiler.MSBuildReferenceResolver
rar.TargetedRuntimeVersion <- targetedRuntimeVersionValue
rar.CopyLocalDependenciesWhenParentReferenceInGac <- true
#endif
#endif
let succeeded = rar.Execute()
......
......@@ -659,12 +659,14 @@ let BuildFSharpMethodApp g m (vref: ValRef) vexp vexprty (args: Exprs) =
match arity, args with
| (0|1), [] when typeEquiv g (domainOfFunTy g fty) g.unit_ty -> mkUnit g m, (args, rangeOfFunTy g fty)
| 0, (arg::argst) ->
warning(InternalError(sprintf "Unexpected zero arity, args = %s" (Layout.showL (Layout.sepListL (Layout.rightL (Layout.TaggedTextOps.tagText ";")) (List.map exprL args))), m));
let msg = Layout.showL (Layout.sepListL (Layout.rightL (Layout.TaggedTextOps.tagText ";")) (List.map exprL args))
warning(InternalError(sprintf "Unexpected zero arity, args = %s" msg, m))
arg, (argst, rangeOfFunTy g fty)
| 1, (arg :: argst) -> arg, (argst, rangeOfFunTy g fty)
| 1, [] -> error(InternalError("expected additional arguments here", m))
| _ ->
if args.Length < arity then error(InternalError("internal error in getting arguments, n = "+string arity+", #args = "+string args.Length, m));
if args.Length < arity then
error(InternalError("internal error in getting arguments, n = "+string arity+", #args = "+string args.Length, m))
let tupargs, argst = List.splitAt arity args
let tuptys = tupargs |> List.map (tyOfExpr g)
(mkRefTupled g m tupargs tuptys),
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -10,7 +10,5 @@ open FSharp.Compiler.Tast
open FSharp.Compiler.Tastops
open FSharp.Compiler.TcGlobals
val testFlagMemberBody : bool ref
/// Perform the checks on the TAST for a file after type inference is complete.
val CheckTopImpl : TcGlobals * ImportMap * bool * InfoReader * CompilationPath list * CcuThunk * DisplayEnv * ModuleOrNamespaceExprWithSig * Attribs * (bool * bool) * isInternalTestSpanStackReferring: bool -> bool * StampMap<AnonRecdTypeInfo>
......@@ -19,10 +19,6 @@ module public FSharp.Compiler.PrettyNaming
open Internal.Utilities.StructuredFormat
open Internal.Utilities.StructuredFormat.LayoutOps
#if FX_RESHAPED_REFLECTION
open Microsoft.FSharp.Core.ReflectionAdapters
#endif
//------------------------------------------------------------------------
// Operator name compilation
//-----------------------------------------------------------------------
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -1357,7 +1357,7 @@ module DebugPrint =
/// A set of function parameters (visitor) for folding over expressions
type ExprFolder<'State> =
{ exprIntercept : ('State -> Expr -> 'State) -> 'State -> Expr -> 'State option
{ exprIntercept : (* recurseF *) ('State -> Expr -> 'State) -> (* noInterceptF *) ('State -> Expr -> 'State) -> 'State -> Expr -> 'State
valBindingSiteIntercept : 'State -> bool * Val -> 'State
nonRecBindingsIntercept : 'State -> Binding -> 'State
recBindingsIntercept : 'State -> Bindings -> 'State
......@@ -2261,6 +2261,10 @@ val (|LinearMatchExpr|_|) : Expr -> (SequencePointInfoForBinding * range * Decis
val rebuildLinearMatchExpr : (SequencePointInfoForBinding * range * DecisionTree * DecisionTreeTarget * Expr * SequencePointInfoForTarget * range * TType) -> Expr
val (|LinearOpExpr|_|) : Expr -> (TOp * TypeInst * Expr list * Expr * range) option
val rebuildLinearOpExpr : (TOp * TypeInst * Expr list * Expr * range) -> Expr
val mkCoerceIfNeeded : TcGlobals -> tgtTy: TType -> srcTy: TType -> Expr -> Expr
val (|InnerExprPat|) : Expr -> Expr
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -15,7 +15,7 @@
<NGenBinary>true</NGenBinary>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net472'">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册