Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions src/Compiler/AbstractIL/il.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ open System.Text
open System.Threading

open FSharp.Compiler.AbstractIL.Diagnostics
open Internal.Utilities.Library
open Internal.Utilities

let logging = false
Expand Down Expand Up @@ -83,7 +82,7 @@ let splitNameAt (nm: string) idx =
if idx > last then
failwith "splitNameAt: idx > last"

(nm.Substring(0, idx)), (if idx < last then nm.Substring(idx + 1, last - idx) else "")
nm.Substring(0, idx), (if idx < last then nm.Substring(idx + 1, last - idx) else "")

let rec splitNamespaceAux (nm: string) =
match nm.IndexOf '.' with
Expand Down Expand Up @@ -771,13 +770,13 @@ type ILTypeRef =
let isPrimaryY = isPrimary y

let xApproxId =
if isPrimaryX && not (isPrimaryY) then
if isPrimaryX && not isPrimaryY then
ILTypeRef.ComputeHash(primaryScopeRef, x.Enclosing, x.Name)
else
x.ApproxId

let yApproxId =
if isPrimaryY && not (isPrimaryX) then
if isPrimaryY && not isPrimaryX then
ILTypeRef.ComputeHash(primaryScopeRef, y.Enclosing, y.Name)
else
y.ApproxId
Expand Down Expand Up @@ -2284,10 +2283,10 @@ type ILEventDef
| Some attrs -> attrs)
)

member x.IsSpecialName = (x.Attributes &&& EventAttributes.SpecialName) <> enum<_> (0)
member x.IsSpecialName = (x.Attributes &&& EventAttributes.SpecialName) <> enum<_> 0

member x.IsRTSpecialName =
(x.Attributes &&& EventAttributes.RTSpecialName) <> enum<_> (0)
(x.Attributes &&& EventAttributes.RTSpecialName) <> enum<_> 0

/// For debugging
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
Expand Down Expand Up @@ -2362,11 +2361,10 @@ type ILPropertyDef
| Some attrs -> attrs)
)

member x.IsSpecialName =
(x.Attributes &&& PropertyAttributes.SpecialName) <> enum<_> (0)
member x.IsSpecialName = (x.Attributes &&& PropertyAttributes.SpecialName) <> enum<_> 0

member x.IsRTSpecialName =
(x.Attributes &&& PropertyAttributes.RTSpecialName) <> enum<_> (0)
(x.Attributes &&& PropertyAttributes.RTSpecialName) <> enum<_> 0

/// For debugging
[<DebuggerBrowsable(DebuggerBrowsableState.Never)>]
Expand All @@ -2388,7 +2386,7 @@ type ILPropertyDefs =
let convertFieldAccess (ilMemberAccess: ILMemberAccess) =
match ilMemberAccess with
| ILMemberAccess.Assembly -> FieldAttributes.Assembly
| ILMemberAccess.CompilerControlled -> enum<FieldAttributes> (0)
| ILMemberAccess.CompilerControlled -> enum<FieldAttributes> 0
| ILMemberAccess.FamilyAndAssembly -> FieldAttributes.FamANDAssem
| ILMemberAccess.FamilyOrAssembly -> FieldAttributes.FamORAssem
| ILMemberAccess.Family -> FieldAttributes.Family
Expand Down Expand Up @@ -2828,7 +2826,7 @@ type ILTypeDef
events = defaultArg events x.Events,
properties = defaultArg properties x.Properties,
additionalFlags = defaultArg newAdditionalFlags additionalFlags,
customAttrs = defaultArg customAttrs (x.CustomAttrsStored)
customAttrs = defaultArg customAttrs x.CustomAttrsStored
)

member x.CustomAttrs: ILAttributes =
Expand Down Expand Up @@ -3017,7 +3015,7 @@ and [<NoComparison; NoEquality>] ILExportedTypeOrForwarder =

member x.Access = typeAccessOfFlags (int x.Attributes)

member x.IsForwarder = x.Attributes &&& enum<TypeAttributes> (0x00200000) <> enum 0
member x.IsForwarder = x.Attributes &&& enum<TypeAttributes> 0x00200000 <> enum 0

member x.CustomAttrs = x.CustomAttrsStored.GetCustomAttrs x.MetadataIndex

Expand Down Expand Up @@ -4256,7 +4254,7 @@ let mkTypeForwarder scopeRef name nested customAttrs access =
{
ScopeRef = scopeRef
Name = name
Attributes = enum<TypeAttributes> (0x00200000) ||| convertTypeAccessFlags access
Attributes = enum<TypeAttributes> 0x00200000 ||| convertTypeAccessFlags access
Nested = nested
CustomAttrsStored = storeILCustomAttrs customAttrs
MetadataIndex = NoMetadataIdx
Expand Down Expand Up @@ -4293,7 +4291,7 @@ let mkILStorageCtorWithParamNames (preblock: ILInstr list, ty, extraParams, flds
| Some x -> I_seqpoint x
| None -> ()
yield! preblock
for (n, (_pnm, nm, fieldTy, _attrs)) in List.indexed flds do
for n, (_pnm, nm, fieldTy, _attrs) in List.indexed flds do
mkLdarg0
mkLdarg (uint16 (n + 1))
mkNormalStfld (mkILFieldSpecInTy (ty, nm, fieldTy))
Expand All @@ -4303,7 +4301,7 @@ let mkILStorageCtorWithParamNames (preblock: ILInstr list, ty, extraParams, flds

let fieldParams =
[
for (pnm, _, ty, attrs) in flds do
for pnm, _, ty, attrs in flds do
let ilParam = mkILParamNamed (pnm, ty)

let ilParam =
Expand Down Expand Up @@ -5130,17 +5128,17 @@ type ILTypeSigParser(tstring: string) =
drop () // step to the number
// fetch the arity
let arity =
while (int (here ()) >= (int ('0')))
&& (int (here ()) <= (int ('9')))
&& (int (peek ()) >= (int ('0')))
&& (int (peek ()) <= (int ('9'))) do
while (int (here ()) >= (int '0'))
&& (int (here ()) <= (int '9'))
&& (int (peek ()) >= (int '0'))
&& (int (peek ()) <= (int '9')) do
step ()

Int32.Parse(take ())
// skip the '['
drop ()
// get the specializations
typeName + "`" + (arity.ToString()),
typeName + "`" + arity.ToString(),
Some
[
for _i in 0 .. arity - 1 do
Expand Down
14 changes: 7 additions & 7 deletions src/Compiler/AbstractIL/il.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type ILAssemblyRef =

member EqualsIgnoringVersion: ILAssemblyRef -> bool

interface System.IComparable
interface IComparable

[<Sealed>]
type ILModuleRef =
Expand All @@ -123,7 +123,7 @@ type ILModuleRef =

member Hash: byte[] option

interface System.IComparable
interface IComparable

// Scope references
[<StructuralEquality; StructuralComparison; RequireQualifiedAccess>]
Expand Down Expand Up @@ -239,7 +239,7 @@ type ILTypeRef =

override ToString: unit -> string

interface System.IComparable
interface IComparable

/// Type specs and types.
[<Sealed>]
Expand Down Expand Up @@ -267,7 +267,7 @@ type ILTypeSpec =

member internal EqualsWithPrimaryScopeRef: ILScopeRef * obj -> bool

interface System.IComparable
interface IComparable

[<RequireQualifiedAccess; StructuralEquality; StructuralComparison>]
type ILType =
Expand Down Expand Up @@ -371,7 +371,7 @@ type ILMethodRef =

member GetCallingSignature: unit -> ILCallingSignature

interface System.IComparable
interface IComparable

/// Formal identities of fields.
[<StructuralEquality; StructuralComparison>]
Expand Down Expand Up @@ -403,7 +403,7 @@ type ILMethodSpec =

member FormalReturnType: ILType

interface System.IComparable
interface IComparable

/// Field specs. The data given for a ldfld, stfld etc. instruction.
[<StructuralEquality; StructuralComparison>]
Expand Down Expand Up @@ -2490,7 +2490,7 @@ type internal ILPropertyRef =
static member Create: ILTypeRef * string -> ILPropertyRef
member DeclaringTypeRef: ILTypeRef
member Name: string
interface System.IComparable
interface IComparable

type ILReferences =
{ AssemblyReferences: ILAssemblyRef[]
Expand Down
12 changes: 6 additions & 6 deletions src/Compiler/AbstractIL/ilascii.fs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ let Int32Int32Instrs: Lazy<InstrTable<Int32Int32Instr>> =
let DoubleInstrs: Lazy<InstrTable<DoubleInstr>> =
lazy
[
[ "ldc"; "r4" ], (fun x -> (AI_ldc(DT_R4, x)))
[ "ldc"; "r8" ], (fun x -> (AI_ldc(DT_R8, x)))
[ "ldc"; "r4" ], (fun x -> AI_ldc(DT_R4, x))
[ "ldc"; "r8" ], (fun x -> AI_ldc(DT_R8, x))
]

/// Table of parsing and pretty printing data for instructions.
Expand Down Expand Up @@ -245,10 +245,10 @@ let TypeInstrs: Lazy<InstrTable<TypeInstr>> =
let IntTypeInstrs: Lazy<InstrTable<IntTypeInstr>> =
lazy
[
[ "ldelem"; "multi" ], (fun (x, y) -> (I_ldelem_any(ILArrayShape.FromRank x, y)))
[ "stelem"; "multi" ], (fun (x, y) -> (I_stelem_any(ILArrayShape.FromRank x, y)))
[ "newarr"; "multi" ], (fun (x, y) -> (I_newarr(ILArrayShape.FromRank x, y)))
[ "ldelema"; "multi" ], (fun (x, y) -> (I_ldelema(NormalAddress, false, ILArrayShape.FromRank x, y)))
[ "ldelem"; "multi" ], (fun (x, y) -> I_ldelem_any(ILArrayShape.FromRank x, y))
[ "stelem"; "multi" ], (fun (x, y) -> I_stelem_any(ILArrayShape.FromRank x, y))
[ "newarr"; "multi" ], (fun (x, y) -> I_newarr(ILArrayShape.FromRank x, y))
[ "ldelema"; "multi" ], (fun (x, y) -> I_ldelema(NormalAddress, false, ILArrayShape.FromRank x, y))
]

/// Table of parsing and pretty printing data for instructions.
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/AbstractIL/ilmorph.fs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ let rec morphILTypeRefsInILType f x =
and tspec_tref2tref f (tspec: ILTypeSpec) =
mkILTySpec (f tspec.TypeRef, List.map (morphILTypeRefsInILType f) tspec.GenericArgs)

let rec ty_scoref2scoref_tyvar2ty ((_fscope, fTyvar) as fs) ty =
let rec ty_scoref2scoref_tyvar2ty (_fscope, fTyvar as fs) ty =
match ty with
| ILType.Ptr elemTy -> ILType.Ptr(ty_scoref2scoref_tyvar2ty fs elemTy)
| ILType.FunctionPointer callsig -> ILType.FunctionPointer(callsig_scoref2scoref_tyvar2ty fs callsig)
Expand Down Expand Up @@ -259,7 +259,7 @@ let morphILFieldDefs f (fdefs: ILFieldDefs) =
let morphILTypeDefs isInKnownSet f (tdefs: ILTypeDefs) =
let filtered (tdefs: ILTypeDef array) =
// The key ensures that items in the Known Set are not duplicated everything else may be.
let mkKey (i, (td: ILTypeDef)) =
let mkKey (i, td: ILTypeDef) =
if isInKnownSet td.Name then
struct (0, td.Name)
else
Expand Down
8 changes: 4 additions & 4 deletions src/Compiler/AbstractIL/ilnativeres.fs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ type CvtResFile() =

static member private ReadStringOrID(fhIn: BinaryReader) =
let mutable (pstring: RESOURCE_STRING) = RESOURCE_STRING()
let mutable (firstWord: WCHAR) = (fhIn.ReadChar())
let mutable (firstWord: WCHAR) = fhIn.ReadChar()

if int firstWord = 0xFFFF then
pstring.Ordinal <- fhIn.ReadUInt16()
Expand Down Expand Up @@ -173,7 +173,7 @@ type SectionCharacteristics =

type ResourceSection() =
new(sectionBytes: byte[], relocations: uint32[]) as this =
(ResourceSection())
ResourceSection()

then
Debug.Assert(sectionBytes :> obj <> Unchecked.defaultof<_>)
Expand Down Expand Up @@ -433,7 +433,7 @@ type VersionHelper() =
if not (Char.IsDigit elements[i].[idx]) then
invalidFormat <- true

VersionHelper.TryGetValue((elements[i].Substring(0, idx)), ref values[i])
VersionHelper.TryGetValue(elements[i].Substring(0, idx), ref values[i])
|> ignore<bool>

breakLoop <- true
Expand Down Expand Up @@ -1139,7 +1139,7 @@ type NativeResourceWriter() =
else Unchecked.defaultof<_>

dataWriter.WriteUInt32(uint32 virtualAddressBase + sizeOfDirectoryTree + 16u + uint32 dataWriter.Count)
let mutable (data: byte[]) = (List<byte>(r.Data)).ToArray()
let mutable (data: byte[]) = List<byte>(r.Data).ToArray()
dataWriter.WriteUInt32(uint32 data.Length)
dataWriter.WriteUInt32 r.CodePage
dataWriter.WriteUInt32 0u
Expand Down
1 change: 0 additions & 1 deletion src/Compiler/AbstractIL/ilprint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ open System.Reflection
open FSharp.Compiler.IO
open Internal.Utilities.Library

open FSharp.Compiler.AbstractIL.AsciiConstants
open FSharp.Compiler.AbstractIL.ILX.Types
open FSharp.Compiler.AbstractIL.IL

Expand Down
Loading
Loading