提交 50e57dc8 编写于 作者: W WilliamBerryiii

Reapplied patch to new fork.

Updated formatted comments with code review comments.
上级 d7afa838
......@@ -169,8 +169,6 @@ let splitTypeNameRight nm =
// --------------------------------------------------------------------
/// This is used to store event, property and field maps.
///
/// Review: this is not such a great data structure.
type LazyOrderedMultiMap<'Key,'Data when 'Key : equality>(keyf : 'Data -> 'Key, lazyItems : Lazy<'Data list>) =
let quickMap=
......@@ -315,9 +313,9 @@ let sha1HashBytes s = SHA1.sha1HashBytes s
// THis is because many allocations of these small lists appear in memory logs.
//
// The "obviouos" step is to use arrays instead of lists. However, this is routinely and surprisingly disappointing.
// As a result, we havent enabled the use of arrays: we had expected this change to give a perf gain,
// As a result, we haven�t enabled the use of arrays: we had expected this change to give a perf gain,
// but it does not! It even gives a small perf loss. We've tried this approach on several other occasions
// for other data structures and each time been surprised that theres no perf gain. It's possible that
// for other data structures and each time been surprised that there�s no perf gain. It's possible that
// arrays-of-references are just not as fast as we expect here: either the runtime check on assignment
// into the array, or some kind of write barrier may be degrading performance.
//
......@@ -438,7 +436,7 @@ type AssemblyRefData =
assemRefVersion: ILVersionInfo option;
assemRefLocale: Locale option; }
/// Global state: table of all assembly references keyed by AssemblyRefData
/// Global state: table of all assembly references keyed by AssemblyRefData.
let AssemblyRefUniqueStampGenerator = new UniqueStampGenerator<AssemblyRefData>()
let compareVersions x y =
......@@ -612,7 +610,7 @@ and ILArrayShapeStatics() =
static let singleDimensional = ILArrayShape [(Some 0, None)]
static member SingleDimensional = singleDimensional
/// Calling conventions. These are used in method pointer types.
/// Calling conventions. These are used in method pointer types.
[<StructuralEquality; StructuralComparison; RequireQualifiedAccess>]
type ILArgConvention =
| Default
......@@ -640,7 +638,7 @@ type ILCallingConv =
static member Instance = ILCallingConvStatics.Instance
static member Static = ILCallingConvStatics.Static
/// Static storage to amortize the allocation of ILCallingConv.Instance and ILCallingConv.Static
/// Static storage to amortize the allocation of <c>ILCallingConv.Instance</c> and <c>ILCallingConv.Static</c>.
and ILCallingConvStatics() =
static let instanceCallConv = Callconv(ILThisConvention.Instance,ILArgConvention.Default)
static let staticCallConv = Callconv(ILThisConvention.Static,ILArgConvention.Default)
......@@ -729,7 +727,7 @@ and
[<StructuralEquality; StructuralComparison>]
ILTypeSpec =
{ tspecTypeRef: ILTypeRef;
/// The type instantiation if the type is generic
/// The type instantiation if the type is generic.
tspecInst: ILGenericArgs }
member x.TypeRef=x.tspecTypeRef
member x.Scope=x.TypeRef.Scope
......@@ -1876,8 +1874,6 @@ type ILModuleDef =
// when clashes occur...
// --------------------------------------------------------------------
let mkILEmptyGenericParams = ([]: ILGenericParameterDefs)
let emptyILGenericArgsList = ([ ]: ILType list)
......@@ -2153,7 +2149,7 @@ let exitsOfCode c = CodeLabels.toList (exitsOfCodeAsSet c)
/// Finds all labels defined within this code block, seeing through restrictions.
/// This assumes that labels are unique within the code blocks, even if hidden behind restrictions.
///
// Note: Repeats in the list indicate this invariant is broken.
/// Repeats in the list indicate this invariant is broken.
let rec accLabelsOfCode acc c =
match c with
| ILBasicBlock bb -> bb.Label::acc
......@@ -2180,9 +2176,9 @@ let labelsOfCode code = accLabelsOfCode [] code
From the ECMA spec:
There are only two ways to enter a try block from outside its lexical body:
- Branching to or falling into the try blocks first instruction. The branch may be made using a 37
- Branching to or falling into the try block�s first instruction. The branch may be made using a 37
conditional branch, an unconditional branch, or a leave instruction. 38
- Using a leave instruction from that trys catch block. In this case, correct CIL code may 39
- Using a leave instruction from that try�s catch block. In this case, correct CIL code may 39
branch to any instruction within the try block, not just its first instruction, so long as that 40
branch target is not protected by yet another try, nested withing the first
*)
......@@ -2481,7 +2477,7 @@ let tname_RuntimeMethodHandle = "System.RuntimeMethodHandle"
let tname_RuntimeFieldHandle = "System.RuntimeFieldHandle"
/// Represents the capabilities of target framework profile.
/// Different profiles may omit some types or contain them in different assemblies
/// Different profiles may omit some types or contain them in different assemblies.
type IPrimaryAssemblyTraits =
abstract TypedReferenceTypeScopeRef : ILScopeRef option
......@@ -2589,9 +2585,9 @@ let mkNormalCallconstraint (ty,mspec) = I_callconstraint (Normalcall, ty, mspec,
let mkNormalNewobj mspec = I_newobj (mspec, None)
/// Comment on common object cache sizes:
/// mkLdArg - I cant imagine any IL method we generate needing more than this
/// mkLdLoc - I tried 256, and there were LdLoc allocations left, so I upped it o 512. I didnt check again.
/// mkStLoc - it should be the same as LdLoc (where theres a LdLoc there must be a StLoc)
/// mkLdArg - I can�t imagine any IL method we generate needing more than this
/// mkLdLoc - I tried 256, and there were LdLoc allocations left, so I upped it o 512. I didn�t check again.
/// mkStLoc - it should be the same as LdLoc (where there�s a LdLoc there must be a StLoc)
/// mkLdcInt32 - just a guess
let ldargs = [| for i in 0 .. 128 -> I_ldarg (uint16 i) |]
......@@ -2912,7 +2908,6 @@ let isILDoubleTy ty = typ_is_value_mscorlib_typ ty tname_Double
// Rescoping
// --------------------------------------------------------------------
let qrescope_scoref scoref scoref_old =
match scoref,scoref_old with
| _,ILScopeRef.Local -> Some scoref
......@@ -3051,7 +3046,6 @@ type ILFieldSpec with
// Make a method mbody
// --------------------------------------------------------------------
let mkILMethodBody (zeroinit,locals,maxstack,code,tag) =
{ IsZeroInit=zeroinit;
MaxStack=maxstack;
......@@ -3120,6 +3114,7 @@ let mkILNonGenericEmptyCtor tag superTy =
// Make a static, top level monomophic method - very useful for
// creating helper ILMethodDefs for internal use.
// --------------------------------------------------------------------
let mkILStaticMethod (genparams,nm,access,args,ret,impl) =
{ GenericParams=genparams;
Name=nm;
......@@ -3797,7 +3792,7 @@ let blockForInnerTrySpec (codeOffsetView:CodeOffsetViewOfLabelledItems,
let newBlock = maker (tryBlock,clauseEntryLabel,clauseBlock)
// None of the entries to the clause block are visible outside the
// entire try-clause construct, nor the other entries to the try block
// apart from the one at the. top
// apart from the one at the top.
let newStarts = CodeLabels.diff remainingBasicBlockStarts (CodeLabels.union tryHiddn (entriesOfCodeAsSet clauseBlock))
// Now return the new block, the remaining blocks and the new set
// of entries.
......@@ -3902,7 +3897,7 @@ let doStructure' (codeOffsetView:CodeOffsetViewOfLabelledItems,
// REVIEW: this function shows up on performance traces. If we eliminated the last ILX->IL rewrites from the
// F# compiler we could get rid of this structured code representation from Abstract IL altogether, and
// F# compiler we could get rid of this structured code representation from Abstract IL altogether and
// never convert F# code into this form.
let buildILCode methName lab2pc instrs tryspecs localspecs =
......@@ -4005,12 +4000,12 @@ let buildILCode methName lab2pc instrs tryspecs localspecs =
let computeCoveredBlocks ((start_pc,end_pc) as range) (blocks: Zmap<int,((int*int) * ILCode) list> ) =
// It is assumed that scopes never overlap.
// locinfo scopes could overlap if there is a bug elsewhere.
// If overlaps are discovered, an exception is raised. see NOTE#overlap.
// If overlaps are discovered, an exception is raised. see NOTE: #overlap.
let pcCovered,blocks = popRangeM start_pc (end_pc - 1) blocks
let coveredBlocks = pcCovered |> List.concat
// Look for bad input, e.g. overlapping locinfo scopes.
let overlapBlocks = List.filter (inside range >> not) coveredBlocks
if not (isNil overlapBlocks) then notFound(); (* see NOTE#overlap *)
if not (isNil overlapBlocks) then notFound(); (* see NOTE: #overlap *)
if sanityCheck then (
let assertIn block = assert (inside range block)
let assertOut block = assert (not (inside range block))
......@@ -4042,7 +4037,7 @@ let buildILCode methName lab2pc instrs tryspecs localspecs =
try
doStructure (specs1 @ specs2) (bblocks,bbstartToCodeLabelMap.BasicBlockStartCodeLabels)
with :? KeyNotFoundException->
// NOTE#overlap.
// NOTE: #overlap.
// Here, "Not_found" indicates overlapping scopes were found.
// Maybe the calling code got the locspecs scopes wrong.
// Try recovery by discarding locspec info...
......@@ -4223,7 +4218,6 @@ let sigptr_get_serstring_possibly_null bytes sigptr =
// Get the public key token from the public key.
//---------------------------------------------------------------------
let mkRefToILAssembly (m: ILAssemblyManifest) =
ILAssemblyRef.Create(m.Name, None, (match m.PublicKey with Some k -> Some (PublicKey.KeyAsToken(k)) | None -> None), m.Retargetable, m.Version, m.Locale)
......@@ -4328,7 +4322,7 @@ let rec encodeCustomAttrElemType x =
Array.append [| et_SZARRAY |] (encodeCustomAttrElemType elemType)
| _ -> failwith "encodeCustomAttrElemType: unrecognized custom element type"
/// Given a custom attribute element, work out the type of the .NET argument for that element
/// Given a custom attribute element, work out the type of the .NET argument for that element.
let rec encodeCustomAttrElemTypeForObject x =
match x with
| ILAttribElem.String _ -> [| et_STRING |]
......@@ -4519,7 +4513,7 @@ type ILGlobals with
member this.mkCompilerGeneratedAttribute () = mkILCustomAttribute this (tref_CompilerGeneratedAttribute this, [], [], [])
// Bug 2129. Requests attributes to be added to compiler generated methods
// Requests attributes to be added to compiler generated methods.
let addGeneratedAttrs ilg (attrs: ILAttributes) =
let attribs =
match ilg.generatedAttribsCache with
......@@ -4542,13 +4536,13 @@ let addFieldNeverAttrs ilg (fdef:ILFieldDef) = {fdef with CustomAttrs = add_neve
// PermissionSet is a 'blob' having the following format:
// A byte containing a period (.).
// A compressed int32 containing the number of attributes encoded in the blob.
// An array of attributes each containing the following:
// � A byte containing a period (.).
// � A compressed int32 containing the number of attributes encoded in the blob.
// � An array of attributes each containing the following:
// o A String, which is the fully-qualified type name of the attribute. (Strings are encoded
// as a compressed int to indicate the size followed by an array of UTF8 characters.)
// o A set of properties, encoded as the named arguments to a custom attribute would be (as
// in 23.3, beginning with NumNamed).
// in �23.3, beginning with NumNamed).
let mkPermissionSet (ilg: ILGlobals) (action,attributes: list<(ILTypeRef * (string * ILType * ILAttribElem) list)>) =
let bytes =
[| yield (byte '.');
......@@ -4601,9 +4595,9 @@ type ILTypeSigParser(tstring : string) =
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
//
// Note that
// Since we're only reading valid IL, we assume that the signature is properly formed
// For type parameters, if the type is non-local, it will be wrapped in brackets ([])
// Still needs testing with jagged arrays and byref parameters
// � Since we're only reading valid IL, we assume that the signature is properly formed
// � For type parameters, if the type is non-local, it will be wrapped in brackets ([])
// � Still needs testing with jagged arrays and byref parameters
member private x.ParseType() =
// Does the type name start with a leading '['? If so, ignore it
......
此差异已折叠。
......@@ -62,7 +62,7 @@ module TableNames =
let UserStrings = TableName 0x70 (* Special encoding of embedded UserString tokens - See 1.9 Partition III *)
/// Which tables are sorted and by which column
/// Which tables are sorted and by which column.
//
// Sorted bit-vector as stored by CLR V1: 00fa 0133 0002 0000
// But what does this mean? The ECMA spec does not say!
......
......@@ -387,7 +387,7 @@ module List =
| _ -> finished <- true
List.rev r, s
// note: not tail recursive
// Not tail recursive
let rec mapFoldBack f l s =
match l with
| [] -> ([],s)
......@@ -422,14 +422,14 @@ module List =
let singleton x = [x]
// note: must be tail-recursive
// NOTE: must be tail-recursive
let rec private foldMapAux f z l acc =
match l with
| [] -> z,List.rev acc
| x::xs -> let z,x = f z x
foldMapAux f z xs (x::acc)
// note: must be tail-recursive
// NOTE: must be tail-recursive
// REVIEW: systematically eliminate foldMap/mapFold duplication
let foldMap f z l = foldMapAux f z l []
......
......@@ -17,7 +17,6 @@ type EnclosingTypeDefs = ILTypeDef list * ILTypeDef
let checking = false
let notlazy v = Lazy.CreateFromValue v
// REVIEW: Consider removing Post-Dev11 M3
let mutable morphCustomAttributeData = false
let enablemorphCustomAttributeData() =
......
......@@ -16,16 +16,16 @@ open Microsoft.FSharp.Compiler.AbstractIL.IL
type 'T morph = 'T -> 'T
/// Morph each scope reference inside a type signature
/// Morph each scope reference inside a type signature.
val morphILScopeRefsInILTypeRef: ILScopeRef morph -> ILTypeRef -> ILTypeRef
val morphILMethodDefs: ILMethodDef morph -> ILMethodDefs -> ILMethodDefs
/// nb. does not do nested tdefs
/// nb. does not do nested tdefs.
val morphILTypeDefs: ILTypeDef morph -> ILTypeDefs -> ILTypeDefs
val morphExpandILTypeDefs: (ILTypeDef -> ILTypeDef list) -> ILTypeDefs -> ILTypeDefs
/// Morph all tables of ILTypeDefs in "ILModuleDef"
/// Morph all tables of ILTypeDefs in "ILModuleDef".
val morphILTypeDefsInILModule: ILTypeDefs morph -> ILModuleDef -> ILModuleDef
/// Morph all type references throughout an entire module.
......@@ -44,6 +44,5 @@ type InstrMorph =
val morphExpandILInstrsInILCode: (ILCodeLabel -> ILCodeLabel -> ILInstr -> InstrMorph) -> ILCode -> ILCode
// REVIEW: Consider removing Post-Dev11 M3
val enablemorphCustomAttributeData : unit -> unit
val disablemorphCustomAttributeData : unit -> unit
......@@ -21,7 +21,6 @@ let pretty () = true
// Pretty printing
// --------------------------------------------------------------------
let tyvar_generator =
let i = ref 0
fun n ->
......@@ -529,7 +528,7 @@ let rec goutput_apps env os = function
output_string os "--> ";
goutput_typ env os ty
/// utilities to help print out short forms of instructions
/// Print the short form of instructions
let output_short_u16 os (x:uint16) =
if int x < 256 then (output_string os ".s "; output_u16 os x)
else (output_string os " "; output_u16 os x)
......
......@@ -105,7 +105,7 @@ type BinaryFile() =
abstract CountUtf8String : addr:int -> int
abstract ReadUTF8String : addr: int -> string
/// Read file from memory mapped files
/// Read from memory mapped files.
module MemoryMapping =
type HANDLE = nativeint
......@@ -1086,7 +1086,7 @@ let seekReadModuleRow ctxt idx =
let encbaseidIdx = seekReadGuidIdx ctxt &addr
(generation, nameIdx, mvidIdx, encidIdx, encbaseidIdx)
/// Read Table ILTypeRef
/// Read Table ILTypeRef.
let seekReadTypeRefRow ctxt idx =
count ctxt.countTypeRef;
let mutable addr = ctxt.rowAddr TableNames.TypeRef idx
......@@ -1095,7 +1095,7 @@ let seekReadTypeRefRow ctxt idx =
let namespaceIdx = seekReadStringIdx ctxt &addr
(scopeIdx,nameIdx,namespaceIdx)
/// Read Table ILTypeDef
/// Read Table ILTypeDef.
let seekReadTypeDefRow ctxt idx = ctxt.seekReadTypeDefRow idx
let seekReadTypeDefRowUncached ctxtH idx =
let ctxt = getHole ctxtH
......@@ -1109,7 +1109,7 @@ let seekReadTypeDefRowUncached ctxtH idx =
let methodsIdx = seekReadUntaggedIdx TableNames.Method ctxt &addr
(flags, nameIdx, namespaceIdx, extendsIdx, fieldsIdx, methodsIdx)
/// Read Table Field
/// Read Table Field.
let seekReadFieldRow ctxt idx =
count ctxt.countField;
let mutable addr = ctxt.rowAddr TableNames.Field idx
......@@ -1118,7 +1118,7 @@ let seekReadFieldRow ctxt idx =
let typeIdx = seekReadBlobIdx ctxt &addr
(flags,nameIdx,typeIdx)
/// Read Table Method
/// Read Table Method.
let seekReadMethodRow ctxt idx =
count ctxt.countMethod;
let mutable addr = ctxt.rowAddr TableNames.Method idx
......@@ -1130,7 +1130,7 @@ let seekReadMethodRow ctxt idx =
let paramIdx = seekReadUntaggedIdx TableNames.Param ctxt &addr
(codeRVA, implflags, flags, nameIdx, typeIdx, paramIdx)
/// Read Table Param
/// Read Table Param.
let seekReadParamRow ctxt idx =
count ctxt.countParam;
let mutable addr = ctxt.rowAddr TableNames.Param idx
......@@ -1139,7 +1139,7 @@ let seekReadParamRow ctxt idx =
let nameIdx = seekReadStringIdx ctxt &addr
(flags,seq,nameIdx)
/// Read Table InterfaceImpl
/// Read Table InterfaceImpl.
let seekReadInterfaceImplRow ctxt idx = ctxt.seekReadInterfaceImplRow idx
let seekReadInterfaceImplRowUncached ctxtH idx =
let ctxt = getHole ctxtH
......@@ -1149,7 +1149,7 @@ let seekReadInterfaceImplRowUncached ctxtH idx =
let intfIdx = seekReadTypeDefOrRefOrSpecIdx ctxt &addr
(tidx,intfIdx)
/// Read Table MemberRef
/// Read Table MemberRef.
let seekReadMemberRefRow ctxt idx =
count ctxt.countMemberRef;
let mutable addr = ctxt.rowAddr TableNames.MemberRef idx
......@@ -1158,7 +1158,7 @@ let seekReadMemberRefRow ctxt idx =
let typeIdx = seekReadBlobIdx ctxt &addr
(mrpIdx,nameIdx,typeIdx)
/// Read Table Constant
/// Read Table Constant.
let seekReadConstantRow ctxt idx = ctxt.seekReadConstantRow idx
let seekReadConstantRowUncached ctxtH idx =
let ctxt = getHole ctxtH
......@@ -1169,7 +1169,7 @@ let seekReadConstantRowUncached ctxtH idx =
let valIdx = seekReadBlobIdx ctxt &addr
(kind, parentIdx, valIdx)
/// Read Table CustomAttribute
/// Read Table CustomAttribute.
let seekReadCustomAttributeRow ctxt idx =
count ctxt.countCustomAttribute;
let mutable addr = ctxt.rowAddr TableNames.CustomAttribute idx
......@@ -1178,7 +1178,7 @@ let seekReadCustomAttributeRow ctxt idx =
let valIdx = seekReadBlobIdx ctxt &addr
(parentIdx, typeIdx, valIdx)
/// Read Table FieldMarshal
/// Read Table FieldMarshal.
let seekReadFieldMarshalRow ctxt idx = ctxt.seekReadFieldMarshalRow idx
let seekReadFieldMarshalRowUncached ctxtH idx =
let ctxt = getHole ctxtH
......@@ -1188,7 +1188,7 @@ let seekReadFieldMarshalRowUncached ctxtH idx =
let typeIdx = seekReadBlobIdx ctxt &addr
(parentIdx, typeIdx)
/// Read Table Permission
/// Read Table Permission.
let seekReadPermissionRow ctxt idx =
count ctxt.countPermission;
let mutable addr = ctxt.rowAddr TableNames.Permission idx
......@@ -1197,7 +1197,7 @@ let seekReadPermissionRow ctxt idx =
let typeIdx = seekReadBlobIdx ctxt &addr
(action, parentIdx, typeIdx)
/// Read Table ClassLayout
/// Read Table ClassLayout.
let seekReadClassLayoutRow ctxt idx =
count ctxt.countClassLayout;
let mutable addr = ctxt.rowAddr TableNames.ClassLayout idx
......@@ -1206,7 +1206,7 @@ let seekReadClassLayoutRow ctxt idx =
let tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt &addr
(pack,size,tidx)
/// Read Table FieldLayout
/// Read Table FieldLayout.
let seekReadFieldLayoutRow ctxt idx =
count ctxt.countFieldLayout;
let mutable addr = ctxt.rowAddr TableNames.FieldLayout idx
......@@ -1214,14 +1214,14 @@ let seekReadFieldLayoutRow ctxt idx =
let fidx = seekReadUntaggedIdx TableNames.Field ctxt &addr
(offset,fidx)
//// Read Table StandAloneSig
//// Read Table StandAloneSig.
let seekReadStandAloneSigRow ctxt idx =
count ctxt.countStandAloneSig;
let mutable addr = ctxt.rowAddr TableNames.StandAloneSig idx
let sigIdx = seekReadBlobIdx ctxt &addr
sigIdx
/// Read Table EventMap
/// Read Table EventMap.
let seekReadEventMapRow ctxt idx =
count ctxt.countEventMap;
let mutable addr = ctxt.rowAddr TableNames.EventMap idx
......@@ -1229,7 +1229,7 @@ let seekReadEventMapRow ctxt idx =
let eventsIdx = seekReadUntaggedIdx TableNames.Event ctxt &addr
(tidx,eventsIdx)
/// Read Table Event
/// Read Table Event.
let seekReadEventRow ctxt idx =
count ctxt.countEvent;
let mutable addr = ctxt.rowAddr TableNames.Event idx
......@@ -1238,7 +1238,7 @@ let seekReadEventRow ctxt idx =
let typIdx = seekReadTypeDefOrRefOrSpecIdx ctxt &addr
(flags,nameIdx,typIdx)
/// Read Table PropertyMap
/// Read Table PropertyMap.
let seekReadPropertyMapRow ctxt idx = ctxt.seekReadPropertyMapRow idx
let seekReadPropertyMapRowUncached ctxtH idx =
let ctxt = getHole ctxtH
......@@ -1248,7 +1248,7 @@ let seekReadPropertyMapRowUncached ctxtH idx =
let propsIdx = seekReadUntaggedIdx TableNames.Property ctxt &addr
(tidx,propsIdx)
/// Read Table Property
/// Read Table Property.
let seekReadPropertyRow ctxt idx =
count ctxt.countProperty;
let mutable addr = ctxt.rowAddr TableNames.Property idx
......@@ -1257,7 +1257,7 @@ let seekReadPropertyRow ctxt idx =
let typIdx = seekReadBlobIdx ctxt &addr
(flags,nameIdx,typIdx)
/// Read Table MethodSemantics
/// Read Table MethodSemantics.
let seekReadMethodSemanticsRow ctxt idx = ctxt.seekReadMethodSemanticsRow idx
let seekReadMethodSemanticsRowUncached ctxtH idx =
let ctxt = getHole ctxtH
......@@ -1268,7 +1268,7 @@ let seekReadMethodSemanticsRowUncached ctxtH idx =
let assocIdx = seekReadHasSemanticsIdx ctxt &addr
(flags,midx,assocIdx)
/// Read Table MethodImpl
/// Read Table MethodImpl.
let seekReadMethodImplRow ctxt idx =
count ctxt.countMethodImpl;
let mutable addr = ctxt.rowAddr TableNames.MethodImpl idx
......@@ -1277,21 +1277,21 @@ let seekReadMethodImplRow ctxt idx =
let mdeclIdx = seekReadMethodDefOrRefIdx ctxt &addr
(tidx,mbodyIdx,mdeclIdx)
/// Read Table ILModuleRef
/// Read Table ILModuleRef.
let seekReadModuleRefRow ctxt idx =
count ctxt.countModuleRef;
let mutable addr = ctxt.rowAddr TableNames.ModuleRef idx
let nameIdx = seekReadStringIdx ctxt &addr
nameIdx
/// Read Table ILTypeSpec
/// Read Table ILTypeSpec.
let seekReadTypeSpecRow ctxt idx =
count ctxt.countTypeSpec;
let mutable addr = ctxt.rowAddr TableNames.TypeSpec idx
let blobIdx = seekReadBlobIdx ctxt &addr
blobIdx
/// Read Table ImplMap
/// Read Table ImplMap.
let seekReadImplMapRow ctxt idx =
count ctxt.countImplMap;
let mutable addr = ctxt.rowAddr TableNames.ImplMap idx
......@@ -1301,7 +1301,7 @@ let seekReadImplMapRow ctxt idx =
let scopeIdx = seekReadUntaggedIdx TableNames.ModuleRef ctxt &addr
(flags, forwrdedIdx, nameIdx, scopeIdx)
/// Read Table FieldRVA
/// Read Table FieldRVA.
let seekReadFieldRVARow ctxt idx =
count ctxt.countFieldRVA;
let mutable addr = ctxt.rowAddr TableNames.FieldRVA idx
......@@ -1309,7 +1309,7 @@ let seekReadFieldRVARow ctxt idx =
let fidx = seekReadUntaggedIdx TableNames.Field ctxt &addr
(rva,fidx)
/// Read Table Assembly
/// Read Table Assembly.
let seekReadAssemblyRow ctxt idx =
count ctxt.countAssembly;
let mutable addr = ctxt.rowAddr TableNames.Assembly idx
......@@ -1324,7 +1324,7 @@ let seekReadAssemblyRow ctxt idx =
let localeIdx = seekReadStringIdx ctxt &addr
(hash,v1,v2,v3,v4,flags,publicKeyIdx, nameIdx, localeIdx)
/// Read Table ILAssemblyRef
/// Read Table ILAssemblyRef.
let seekReadAssemblyRefRow ctxt idx =
count ctxt.countAssemblyRef;
let mutable addr = ctxt.rowAddr TableNames.AssemblyRef idx
......@@ -1339,7 +1339,7 @@ let seekReadAssemblyRefRow ctxt idx =
let hashValueIdx = seekReadBlobIdx ctxt &addr
(v1,v2,v3,v4,flags,publicKeyOrTokenIdx, nameIdx, localeIdx,hashValueIdx)
/// Read Table File
/// Read Table File.
let seekReadFileRow ctxt idx =
count ctxt.countFile;
let mutable addr = ctxt.rowAddr TableNames.File idx
......@@ -1348,7 +1348,7 @@ let seekReadFileRow ctxt idx =
let hashValueIdx = seekReadBlobIdx ctxt &addr
(flags, nameIdx, hashValueIdx)
/// Read Table ILExportedTypeOrForwarder
/// Read Table ILExportedTypeOrForwarder.
let seekReadExportedTypeRow ctxt idx =
count ctxt.countExportedType;
let mutable addr = ctxt.rowAddr TableNames.ExportedType idx
......@@ -1359,7 +1359,7 @@ let seekReadExportedTypeRow ctxt idx =
let implIdx = seekReadImplementationIdx ctxt &addr
(flags,tok,nameIdx,namespaceIdx,implIdx)
/// Read Table ManifestResource
/// Read Table ManifestResource.
let seekReadManifestResourceRow ctxt idx =
count ctxt.countManifestResource;
let mutable addr = ctxt.rowAddr TableNames.ManifestResource idx
......@@ -1369,7 +1369,7 @@ let seekReadManifestResourceRow ctxt idx =
let implIdx = seekReadImplementationIdx ctxt &addr
(offset,flags,nameIdx,implIdx)
/// Read Table Nested
/// Read Table Nested.
let seekReadNestedRow ctxt idx = ctxt.seekReadNestedRow idx
let seekReadNestedRowUncached ctxtH idx =
let ctxt = getHole ctxtH
......@@ -1379,7 +1379,7 @@ let seekReadNestedRowUncached ctxtH idx =
let enclIdx = seekReadUntaggedIdx TableNames.TypeDef ctxt &addr
(nestedIdx,enclIdx)
/// Read Table GenericParam
/// Read Table GenericParam.
let seekReadGenericParamRow ctxt idx =
count ctxt.countGenericParam;
let mutable addr = ctxt.rowAddr TableNames.GenericParam idx
......@@ -1389,7 +1389,7 @@ let seekReadGenericParamRow ctxt idx =
let nameIdx = seekReadStringIdx ctxt &addr
(idx,seq,flags,ownerIdx,nameIdx)
// Read Table GenericParamConstraint
// Read Table GenericParamConstraint.
let seekReadGenericParamConstraintRow ctxt idx =
count ctxt.countGenericParamConstraint;
let mutable addr = ctxt.rowAddr TableNames.GenericParamConstraint idx
......@@ -1397,7 +1397,7 @@ let seekReadGenericParamConstraintRow ctxt idx =
let constraintIdx = seekReadTypeDefOrRefOrSpecIdx ctxt &addr
(pidx,constraintIdx)
/// Read Table ILMethodSpec
/// Read Table ILMethodSpec.
let seekReadMethodSpecRow ctxt idx =
count ctxt.countMethodSpec;
let mutable addr = ctxt.rowAddr TableNames.MethodSpec idx
......@@ -3170,7 +3170,7 @@ and sigptrGetILNativeType ctxt bytes sigptr =
if (u = int nt_MAX) then
ILNativeType.Empty, sigptr'
else
(* note: go back to start and read native type *)
// NOTE: go back to start and read native type
sigptrGetILNativeType ctxt bytes sigptr
if sigptr >= bytes.Length then
ILNativeType.Array (Some nt,None), sigptr
......
......@@ -3,7 +3,7 @@
/// Binary reader. Read a .NET binary and concert it to Abstract IL data
/// structures.
///
/// Notes:
/// NOTE:
/// - The metadata in the loaded modules will be relative to
/// those modules, e.g. ILScopeRef.Local will mean "local to
/// that module". You must use [rescopeILType] etc. if you want to include
......@@ -14,7 +14,7 @@
/// This indicates if you want to search for PDB files and have the
/// reader fold them in. You cannot currently name the pdb file
/// directly - you can only name the path. Giving "None" says
/// "do not read the PDB file even if one exists"
/// "do not read the PDB file even if one exists".
///
/// The debug info appears primarily as I_seqpoint annotations in
/// the instruction streams. Unfortunately the PDB information does
......
......@@ -329,13 +329,13 @@ let convAssemblyRef (aref:ILAssemblyRef) =
#endif
asmName
/// The global environment
/// The global environment.
type cenv =
{ ilg: ILGlobals;
generatePdb: bool;
resolvePath: (ILAssemblyRef -> Choice<string,System.Reflection.Assembly> option) }
/// Convert an Abstract IL type reference to Reflection.Emit System.Type value
/// Convert an Abstract IL type reference to Reflection.Emit System.Type value.
// REVIEW: This ought to be an adequate substitute for this whole function, but it needs
// to be thoroughly tested.
// Type.GetType(tref.QualifiedName)
......@@ -545,7 +545,7 @@ and convTypeAux cenv emEnv preferCreated typ =
| ILType.Byref eltType -> let baseT = convTypeAux cenv emEnv preferCreated eltType |> nonNull "convType: byref eltType"
baseT.MakeByRefType() |> nonNull "convType: byref"
| ILType.TypeVar tv -> envGetTyvar emEnv tv |> nonNull "convType: tyvar"
// XXX: REVIEW: complete the following cases.
// REVIEW: complete the following cases.
| ILType.Modified (false, _, modifiedTy) -> convTypeAux cenv emEnv preferCreated modifiedTy
| ILType.Modified (true, _, _) -> failwith "convType: modreq"
| ILType.FunctionPointer _callsig -> failwith "convType: fptr"
......@@ -567,7 +567,7 @@ and convTypeAux cenv emEnv preferCreated typ =
// If convCreatedType replaced convType functions like convMethodRef, convConstructorSpec, ... (and more?)
// will need to be fixed for emitted types to handle both TypeBuilder and later Type proper.
/// Uses TypeBuilder/TypeBuilderInstantiation for emitted types
/// Uses TypeBuilder/TypeBuilderInstantiation for emitted types.
let convType cenv emEnv typ = convTypeAux cenv emEnv false typ
// Used for ldtoken
......@@ -581,7 +581,7 @@ let convTypes cenv emEnv (typs:ILTypes) = ILList.map (convType cenv emEnv) typs
let convTypesToArray cenv emEnv (typs:ILTypes) = convTypes cenv emEnv typs |> ILList.toArray
/// Uses the .CreateType() for emitted type (if available)
/// Uses the .CreateType() for emitted type if available.
let convCreatedType cenv emEnv typ = convTypeAux cenv emEnv true typ
let convCreatedTypeRef cenv emEnv typ = convTypeRef cenv emEnv true typ
......@@ -820,7 +820,7 @@ let defineLabel (ilG:ILGenerator) emEnv (label:ILCodeLabel) =
// emitInstr cenv - I_arith
//----------------------------------------------------------------------------
///Emit comparison instructions
///Emit comparison instructions.
let emitInstrCompare emEnv (ilG:ILGenerator) comp targ =
match comp with
| BI_beq -> ilG.EmitAndLog(OpCodes.Beq,envGetLabel emEnv targ)
......@@ -1433,10 +1433,6 @@ let convMethodImplFlags mdef =
//----------------------------------------------------------------------------
let rec buildMethodPass2 cenv tref (typB:TypeBuilder) emEnv (mdef : ILMethodDef) =
// remaining REVIEW:
// SecurityDecls: Permissions;
// IsUnmanagedExport: bool; (* -- The method is exported to unmanaged code using COM interop. *)
// IsMustRun: bool; (* Whidbey feature: SafeHandle finalizer must be run *)
let attrs = convMethodAttributes mdef
let implflags = convMethodImplFlags mdef
let cconv = convCallConv mdef.CallingConv
......@@ -1499,7 +1495,7 @@ let rec buildMethodPass2 cenv tref (typB:TypeBuilder) emEnv (mdef : ILMethodDef)
consB.SetImplementationFlagsAndLog(implflags);
envBindConsRef emEnv mref consB
| _name ->
// Note the return/argument types may involve the generic parameters
// The return/argument types may involve the generic parameters
let methB = typB.DefineMethodAndLog(mdef.Name,attrs,cconv)
// Method generic type parameters
......@@ -1507,7 +1503,7 @@ let rec buildMethodPass2 cenv tref (typB:TypeBuilder) emEnv (mdef : ILMethodDef)
let genArgs = getGenericArgumentsOfMethod methB
let emEnv = envPushTyvars emEnv (Array.append (getGenericArgumentsOfType (typB.AsType())) genArgs)
buildGenParamsPass1b cenv emEnv genArgs mdef.GenericParams;
// set parameter and return types (may depend on generic args)
// Set parameter and return types (may depend on generic args)
methB.SetParametersAndLog(convTypesToArray cenv emEnv mdef.ParameterTypes);
methB.SetReturnTypeAndLog(convType cenv emEnv mdef.Return.Type);
let emEnv = envPopTyvars emEnv
......@@ -1595,7 +1591,8 @@ let buildFieldPass2 cenv tref (typB:TypeBuilder) emEnv (fdef : ILFieldDef) =
| Some initial ->
if not fieldT.IsEnum
#if FX_ATLEAST_45
|| not fieldT.Assembly.IsDynamic // it is ok to init fields with type = enum that are defined in other assemblies
// it is ok to init fields with type = enum that are defined in other assemblies
|| not fieldT.Assembly.IsDynamic
#endif
then
fieldB.SetConstant(convFieldInit initial)
......
......@@ -784,7 +784,7 @@ let unlinkResource (ulLinkedResourceBaseRVA:int32) (pbLinkedResource:byte[]) =
let pResNodes : ResFormatNode [] = Array.zeroCreate nResNodes
nResNodes <- 0 ;
// fill out the entry buffer
// 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)) ;
let dwTypeID = pirdeType.Name
......@@ -1310,17 +1310,17 @@ type ICLRMetaHost =
[<In; MarshalAs(UnmanagedType.LPWStr)>] version : string *
[<In; MarshalAs(UnmanagedType.LPStruct)>] interfaceId : System.Guid -> [<MarshalAs(UnmanagedType.Interface)>] System.Object
// Note, methods that we don't need are stubbed out for now...
// NOTE: Methods that we don't need are stubbed out for now...
abstract GetVersionFromFile : UnusedCOMMethod
abstract EnumerateInstalledRuntimes : UnusedCOMMethod
abstract EnumerateLoadedRuntimes : UnusedCOMMethod
abstract Reserved01 : UnusedCOMMethod
// Note, We don't currently support ComConversionLoss
// NOTE: We don't currently support ComConversionLoss
[<System.Security.SecurityCritical; Interface>]
[<ComImport; ComConversionLoss; InterfaceType(ComInterfaceType.InterfaceIsIUnknown); Guid("9FD93CCF-3280-4391-B3A9-96E1CDE77C8D")>]
type ICLRStrongName =
// Note, methods that we don't need are stubbed out for now...
// NOTE: Methods that we don't need are stubbed out for now...
abstract GetHashFromAssemblyFile : UnusedCOMMethod
abstract GetHashFromAssemblyFileW : UnusedCOMMethod
abstract GetHashFromBlob : UnusedCOMMethod
......
......@@ -3855,7 +3855,7 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
writeInt32AsUInt16 os ((if isDll then 0x2000 else 0x0000) ||| 0x0002 ||| 0x0004 ||| 0x0008 ||| iMachineCharacteristic);
// Now comes optional header
// Now comes optional header
let peOptionalHeaderByte = peOptionalHeaderByteByCLRVersion desiredMetadataVersion
......@@ -3866,7 +3866,7 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer:
writeInt32AsUInt16 os 0x010b; // Always 0x10B (see Section 23.1).
writeInt32AsUInt16 os peOptionalHeaderByte; // ECMA spec says 6, some binaries, e.g. fscmanaged.exe say 7, Whidbey binaries say 8
writeInt32 os textSectionPhysSize; // Size of the code (text) section, or the sum of all code sections if there are multiple sections.
// 000000a0
// 000000a0
writeInt32 os dataSectionPhysSize; // Size of the initialized data section, or the sum of all such sections if there are multiple data sections.
writeInt32 os 0x00; // Size of the uninitialized data section, or the sum of all such sections if there are multiple unitinitalized data sections.
writeInt32 os entrypointCodeChunk.addr; // RVA of entry point , needs to point to bytes 0xFF 0x25 followed by the RVA+!0x4000000 in a section marked execute/read for EXEs or 0 for DLLs e.g. 0x0000b57e
......
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
/// The IL Binary writer
/// The IL Binary writer.
module internal Microsoft.FSharp.Compiler.AbstractIL.ILBinaryWriter
open Microsoft.FSharp.Compiler.AbstractIL
......
......@@ -17,7 +17,7 @@ type IlxUnionField =
new : ILFieldDef -> IlxUnionField
member Type : ILType
member Name : string
/// The name used for the field in parameter or IL field position
/// The name used for the field in parameter or IL field position.
member LowerName : string
member ILField : ILFieldDef
......@@ -83,15 +83,13 @@ type IlxClosureSpec =
member Constructor : ILMethodSpec
/// IlxClosureApps - i.e. types being applied at a callsite
/// IlxClosureApps - i.e. types being applied at a callsite.
type IlxClosureApps =
| Apps_tyapp of ILType * IlxClosureApps
| Apps_app of ILType * IlxClosureApps
| Apps_done of ILType
/// ILX extensions to the instruction set
///
/// ILX extensions to the instruction set.
type IlxInstr =
| EI_lddata of (* avoidHelpers: *) bool * IlxUnionSpec * int * int
| EI_isdata of (* avoidHelpers: *) bool * IlxUnionSpec * int
......@@ -130,7 +128,7 @@ and IlxUnionInfo =
cudDebugDisplayAttributes: ILAttribute list;
cudAlternatives: IlxUnionAlternative[];
cudNullPermitted: bool;
/// Debug info for generated code for classunions
/// Debug info for generated code for classunions.
cudWhere: ILSourceMarker option;
}
......
......@@ -14,7 +14,7 @@ open System
// General error recovery mechanism
//-----------------------------------------------------------------------
/// Thrown when want to add some range information to some .NET exception
/// Thrown when we want to add some range information to a .NET exception
exception WrappedError of exn * range
/// Thrown when immediate, local error recovery is not possible. This indicates
......@@ -60,7 +60,7 @@ exception Deprecated of string * range
exception Experimental of string * range
exception PossibleUnverifiableCode of range
// Range\NoRange Duals
// Range/NoRange Duals
exception UnresolvedReferenceNoRange of (*assemblyname*) string
exception UnresolvedReferenceError of (*assemblyname*) string * range
exception UnresolvedPathReferenceNoRange of (*assemblyname*) string * (*path*) string
......@@ -181,7 +181,7 @@ type PhasedError = { Exception:exn; Phase:BuildPhase } with
/// Return true if the textual phase given is from the compile part of the build process.
/// This set needs to be equal to the set of subcategories that the language service can produce.
static member IsSubcategoryOfCompile(subcategory:string) =
// Beware: This code logic is duplicated in DocumentTask.cs in the language service
// This code logic is duplicated in DocumentTask.cs in the language service.
match subcategory with
| BuildPhaseSubcategory.Compile
| BuildPhaseSubcategory.Parameter
......@@ -224,7 +224,8 @@ type PhasedError = { Exception:exn; Phase:BuildPhase } with
[<System.Diagnostics.DebuggerDisplay("{DebugDisplay()}")>]
type ErrorLogger(nameForDebugging:string) =
abstract ErrorCount: int
// the purpose of the 'Impl' factoring is so that you can put a breakpoint on the non-Impl code just below, and get a breakpoint for all implementations of error loggers
// The 'Impl' factoring enables a developer to place a breakpoint at the non-Impl
// code just below and get a breakpoint for all error logger implementations.
abstract WarnSinkImpl: PhasedError -> unit
abstract ErrorSinkImpl: PhasedError -> unit
member this.WarnSink err =
......@@ -232,7 +233,7 @@ type ErrorLogger(nameForDebugging:string) =
member this.ErrorSink err =
this.ErrorSinkImpl err
member this.DebugDisplay() = sprintf "ErrorLogger(%s)" nameForDebugging
// record the reported error/warning numbers for SQM purpose
// Record the reported error/warning numbers for SQM purpose
abstract ErrorNumbers : int list
abstract WarningNumbers : int list
default this.ErrorNumbers = []
......@@ -259,7 +260,7 @@ let AssertFalseErrorLogger =
/// When no errorLogger is installed (on the thread) use this one.
let uninitializedErrorLoggerFallback = ref AssertFalseErrorLogger
/// Type holds thread-static globals for use by the compile
/// Type holds thread-static globals for use by the compile.
type internal CompileThreadStatic =
[<System.ThreadStatic;DefaultValue>]
static val mutable private buildPhase : BuildPhase
......@@ -282,8 +283,8 @@ module ErrorLoggerExtensions =
open System.Reflection
// Instruct the exception not to reset itself when thrown again.
// Why don?t we just not catch these in the first place? Because we made the design choice to ask the user to send mail to fsbugs@microsoft.com.
// To achieve this, we need to catch the exception, report the email address and stack trace, and then reraise.
// Design Note: This enables the compiler to prompt the user to send mail to fsbugs@microsoft.com,
// by catching the exception, prompting and then propagating the exception with reraise.
let PreserveStackTrace(exn) =
try
let preserveStackTrace = typeof<System.Exception>.GetMethod("InternalPreserveStackTrace", BindingFlags.Instance ||| BindingFlags.NonPublic)
......@@ -379,7 +380,7 @@ let SetThreadBuildPhaseNoUnwind(phase:BuildPhase) = CompileThreadStatic.BuildPha
let SetThreadErrorLoggerNoUnwind(errorLogger) = CompileThreadStatic.ErrorLogger <- errorLogger
let SetUninitializedErrorLoggerFallback errLogger = uninitializedErrorLoggerFallback := errLogger
// Global functions are still used by parser and TAST ops
// Global functions are still used by parser and TAST ops.
let errorR exn = CompileThreadStatic.ErrorLogger.ErrorR exn
let warning exn = CompileThreadStatic.ErrorLogger.Warning exn
let error exn = CompileThreadStatic.ErrorLogger.Error exn
......
......@@ -800,7 +800,7 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("Skip")>]
val skip: count:int -> array:'T[] -> 'T[]
/// <summary>Bypasses elements in an array while the given predicate returns <c>true</c>, and then returns
/// <summary>Bypasses elements in an array while the given predicate returns True, and then returns
/// the remaining elements in a new array.</summary>
/// <param name="predicate">A function that evaluates an element of the array to a boolean value.</param>
/// <param name="source">The input array.</param>
......@@ -950,7 +950,7 @@ namespace Microsoft.FSharp.Collections
val take: count:int -> array:'T[] -> 'T[]
/// <summary>Returns an array that contains all elements of the original array while the
/// given predicate returns <c>true</c>, and then returns no further elements.</summary>
/// given predicate returns True, and then returns no further elements.</summary>
///
/// <param name="predicate">A function that evaluates to false when no more items should be returned.</param>
/// <param name="array">The input array.</param>
......@@ -992,8 +992,8 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("Truncate")>]
val truncate: count:int -> array:'T[] -> 'T[]
/// <summary>Returns the first element for which the given function returns <c>true</c>.
/// Return <c>None</c> if no such element exists.</summary>
/// <summary>Returns the first element for which the given function returns True.
/// Return None if no such element exists.</summary>
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="array">The input array.</param>
/// <returns>The first element that satisfies the predicate, or None.</returns>
......@@ -1001,8 +1001,8 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("TryFind")>]
val tryFind: predicate:('T -> bool) -> array:'T[] -> 'T option
/// <summary>Returns the last element for which the given function returns <c>true</c>.
/// Return <c>None</c> if no such element exists.</summary>
/// <summary>Returns the last element for which the given function returns True.
/// Return None if no such element exists.</summary>
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="array">The input array.</param>
/// <exception cref="System.ArgumentNullException">Thrown when the input array is null.</exception>
......
......@@ -197,7 +197,7 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("Exists2")>]
val exists2: predicate:('T1 -> 'T2 -> bool) -> list1:'T1 list -> list2:'T2 list -> bool
/// <summary>Returns the first element for which the given function returns <c>true</c>.
/// <summary>Returns the first element for which the given function returns True.
/// Raises <c>KeyNotFoundException</c> if no such element exists.</summary>
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="list">The input list.</param>
......@@ -207,7 +207,7 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("Find")>]
val find: predicate:('T -> bool) -> list:'T list -> 'T
/// <summary>Returns the last element for which the given function returns <c>true</c>.
/// <summary>Returns the last element for which the given function returns True.
/// Raises <c>KeyNotFoundException</c> if no such element exists.</summary>
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="list">The input list.</param>
......@@ -548,7 +548,7 @@ namespace Microsoft.FSharp.Collections
val pairwise: list:'T list -> ('T * 'T) list
/// <summary>Splits the collection into two collections, containing the
/// elements for which the given predicate returns <c>true</c> and <c>false</c>
/// elements for which the given predicate returns True and False
/// respectively. Element order is preserved in both of the created lists.</summary>
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="list">The input list.</param>
......@@ -650,7 +650,7 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("Skip")>]
val skip: count:int -> list: 'T list -> 'T list
/// <summary>Bypasses elements in a list while the given predicate returns <c>true</c>, and then returns
/// <summary>Bypasses elements in a list while the given predicate returns True, and then returns
/// the remaining elements of the list.</summary>
/// <param name="predicate">A function that evaluates an element of the list to a boolean value.</param>
/// <param name="list">The input list.</param>
......@@ -753,7 +753,7 @@ namespace Microsoft.FSharp.Collections
val take: count:int -> list:'T list -> 'T list
/// <summary>Returns a list that contains all elements of the original list while the
/// given predicate returns <c>true</c>, and then returns no further elements.</summary>
/// given predicate returns True, and then returns no further elements.</summary>
///
/// <param name="predicate">A function that evaluates to false when no more items should be returned.</param>
/// <param name="list">The input list.</param>
......@@ -797,8 +797,8 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("TryPick")>]
val tryPick: chooser:('T -> 'U option) -> list:'T list -> 'U option
/// <summary>Returns the first element for which the given function returns <c>true.</c>.
/// Return <c>None</c> if no such element exists.</summary>
/// <summary>Returns the first element for which the given function returns True.
/// Return None if no such element exists.</summary>
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="list">The input list.</param>
/// <returns>The first element for which the predicate returns true, or None if
......@@ -806,8 +806,8 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("TryFind")>]
val tryFind: predicate:('T -> bool) -> list:'T list -> 'T option
/// <summary>Returns the last element for which the given function returns <c>true.</c>.
/// Return <c>None</c> if no such element exists.</summary>
/// <summary>Returns the last element for which the given function returns True.
/// Return None if no such element exists.</summary>
/// <param name="predicate">The function to test the input elements.</param>
/// <param name="list">The input list.</param>
/// <returns>The last element for which the predicate returns true, or None if
......
......@@ -2209,7 +2209,7 @@ namespace Microsoft.FSharp.Core
/// <returns>The concatenation of the lists.</returns>
val (@): list1:'T list -> list2:'T list -> 'T list
/// <summary>Negate a logical value. <c>not true</c> equals <c>false</c> and <c>not false</c> equals <c>true</c></summary>
/// <summary>Negate a logical value. Not True equals False and not False equals True</summary>
/// <param name="value">The value to negate.</param>
/// <returns>The result of the negation.</returns>
[<CompiledName("Not")>]
......
......@@ -358,12 +358,12 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("Where")>]
val where: predicate:('T -> bool) -> source:seq<'T> -> seq<'T>
/// <summary>Returns the first element for which the given function returns <c>true</c>.</summary>
/// <summary>Returns the first element for which the given function returns True.</summary>
///
/// <param name="predicate">A function to test whether an item in the sequence should be returned.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The first element for which the predicate returns <c>true</c>.</returns>
/// <returns>The first element for which the predicate returns True.</returns>
///
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown if no element returns true when
/// evaluated by the predicate</exception>
......@@ -371,12 +371,12 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("Find")>]
val find: predicate:('T -> bool) -> source:seq<'T> -> 'T
/// <summary>Returns the last element for which the given function returns <c>true</c>.</summary>
/// <summary>Returns the last element for which the given function returns True.</summary>
/// <remarks>This function digests the whole initial sequence as soon as it is called. As a
/// result this function should not be used with large or infinite sequences.</remarks>
/// <param name="predicate">A function to test whether an item in the sequence should be returned.</param>
/// <param name="source">The input sequence.</param>
/// <returns>The last element for which the predicate returns <c>true</c>.</returns>
/// <returns>The last element for which the predicate returns True.</returns>
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown if no element returns true when
/// evaluated by the predicate</exception>
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null</exception>
......@@ -384,12 +384,12 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("FindBack")>]
val findBack: predicate:('T -> bool) -> source:seq<'T> -> 'T
/// <summary>Returns the index of the first element for which the given function returns <c>true</c>.</summary>
/// <summary>Returns the index of the first element for which the given function returns True.</summary>
///
/// <param name="predicate">A function to test whether the index of a particular element should be returned.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The index of the first element for which the predicate returns <c>true</c>.</returns>
/// <returns>The index of the first element for which the predicate returns True.</returns>
///
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown if no element returns true when
/// evaluated by the predicate</exception>
......@@ -397,12 +397,12 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("FindIndex")>]
val findIndex: predicate:('T -> bool) -> source:seq<'T> -> int
/// <summary>Returns the index of the last element for which the given function returns <c>true</c>.</summary>
/// <summary>Returns the index of the last element for which the given function returns True.</summary>
/// <remarks>This function digests the whole initial sequence as soon as it is called. As a
/// result this function should not be used with large or infinite sequences.</remarks>
/// <param name="predicate">A function to test whether the index of a particular element should be returned.</param>
/// <param name="source">The input sequence.</param>
/// <returns>The index of the last element for which the predicate returns <c>true</c>.</returns>
/// <returns>The index of the last element for which the predicate returns True.</returns>
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown if no element returns true when
/// evaluated by the predicate</exception>
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null</exception>
......@@ -1025,7 +1025,7 @@ namespace Microsoft.FSharp.Collections
val skip: count:int -> source:seq<'T> -> seq<'T>
/// <summary>Returns a sequence that, when iterated, skips elements of the underlying sequence while the
/// given predicate returns <c>true</c>, and then yields the remaining elements of the sequence.</summary>
/// given predicate returns True, and then yields the remaining elements of the sequence.</summary>
///
/// <param name="predicate">A function that evaluates an element of the sequence to a boolean value.</param>
/// <param name="source">The input sequence.</param>
......@@ -1177,7 +1177,7 @@ namespace Microsoft.FSharp.Collections
val take: count:int -> source:seq<'T> -> seq<'T>
/// <summary>Returns a sequence that, when iterated, yields elements of the underlying sequence while the
/// given predicate returns <c>true</c>, and then returns no further elements.</summary>
/// given predicate returns True, and then returns no further elements.</summary>
///
/// <param name="predicate">A function that evaluates to false when no more items should be returned.</param>
/// <param name="source">The input sequence.</param>
......@@ -1208,25 +1208,25 @@ namespace Microsoft.FSharp.Collections
[<CompiledName("ToList")>]
val toList: source:seq<'T> -> 'T list
/// <summary>Returns the first element for which the given function returns <c>true</c>.
/// Return <c>None</c> if no such element exists.</summary>
/// <summary>Returns the first element for which the given function returns True.
/// Return None if no such element exists.</summary>
///
/// <param name="predicate">A function that evaluates to a Boolean when given an item in the sequence.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The found element or <c>None</c>.</returns>
/// <returns>The found element or None.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("TryFind")>]
val tryFind: predicate:('T -> bool) -> source:seq<'T> -> 'T option
/// <summary>Returns the last element for which the given function returns <c>true</c>.
/// Return <c>None</c> if no such element exists.</summary>
/// <summary>Returns the last element for which the given function returns True.
/// Return None if no such element exists.</summary>
/// <remarks>This function digests the whole initial sequence as soon as it is called. As a
/// result this function should not be used with large or infinite sequences.</remarks>
/// <param name="predicate">A function that evaluates to a Boolean when given an item in the sequence.</param>
/// <param name="source">The input sequence.</param>
/// <returns>The found element or <c>None</c>.</returns>
/// <returns>The found element or None.</returns>
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <remarks>This function consumes the whole input sequence before returning the result.</remarks>
[<CompiledName("TryFindBack")>]
......@@ -1238,7 +1238,7 @@ namespace Microsoft.FSharp.Collections
/// <param name="predicate">A function that evaluates to a Boolean when given an item in the sequence.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The found index or <c>None</c>.</returns>
/// <returns>The found index or None.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("TryFindIndex")>]
......
......@@ -184,7 +184,7 @@ namespace Microsoft.FSharp.Collections
val exists: predicate:('T -> bool) -> set:Set<'T> -> bool
/// <summary>Returns a new collection containing only the elements of the collection
/// for which the given predicate returns <c>true</c>.</summary>
/// for which the given predicate returns True.</summary>
/// <param name="predicate">The function to test set elements.</param>
/// <param name="set">The input set.</param>
/// <returns>The set containing only the elements for which <c>predicate</c> returns true.</returns>
......
......@@ -34,7 +34,7 @@ type internal AgedLookup<'TKey,'TValue when 'TValue : not struct>(keepStrongly:i
let mutable keepMax = max keepStrongly keepMax
let requiredToKeep = defaultArg requiredToKeep (fun _ -> false)
/// Look up a the given key, return None if not found.
/// Look up a the given key, return <c>None</c> if not found.
let TryPeekKeyValueImpl(data,key) =
let rec Lookup key = function
// Treat a list of key-value pairs as a lookup collection.
......@@ -53,11 +53,11 @@ type internal AgedLookup<'TKey,'TValue when 'TValue : not struct>(keepStrongly:i
let Add(data,key,value) =
data @ [key,value]
/// Promote a particular key value
/// Promote a particular key value.
let Promote (data, key, value) =
(data |> List.filter (fun (key',_)-> not (areSame(key,key')))) @ [ (key, value) ]
/// Remove a particular key value
/// Remove a particular key value.
let RemoveImpl (data, key) =
let discard,keep = data |> List.partition (fun (key',_)-> areSame(key,key'))
keep, discard
......@@ -69,7 +69,7 @@ type internal AgedLookup<'TKey,'TValue when 'TValue : not struct>(keepStrongly:i
result,Promote (data,key',value)
| None -> None,data
/// Remove weak entries from the list that have been collected
/// Remove weak entries from the list that have been collected.
let FilterAndHold() =
[ for (key,value) in refs do
match value with
......@@ -154,7 +154,7 @@ type internal AgedLookup<'TKey,'TValue when 'TValue : not struct>(keepStrongly:i
type internal MruCache<'TKey,'TValue when 'TValue : not struct>(keepStrongly, areSame, ?isStillValid : 'TKey*'TValue->bool, ?areSameForSubsumption, ?requiredToKeep, ?onStrongDiscard, ?keepMax) =
/// Default behavior of areSameForSubsumption function is areSame
/// Default behavior of <c>areSameForSubsumption</c> function is areSame.
let areSameForSubsumption = defaultArg areSameForSubsumption areSame
/// The list of items in the cache. Youngest is at the end of the list.
......@@ -194,7 +194,8 @@ type internal MruCache<'TKey,'TValue when 'TValue : not struct>(keepStrongly, ar
/// List helpers
[<Sealed>]
type internal List =
/// Return a new list with one element for each unique 'TKey. Multiple 'TValues are flattened. The original order of the first instance of 'TKey is preserved.
/// Return a new list with one element for each unique 'TKey. Multiple 'TValues are flattened.
/// The original order of the first instance of 'TKey is preserved.
static member groupByFirst( l : ('TKey * 'TValue) list) : ('TKey * 'TValue list) list =
let nextIndex = ref 0
let result = System.Collections.Generic.List<'TKey * System.Collections.Generic.List<'TValue>>()
......
......@@ -20,7 +20,7 @@ namespace Internal.Utilities.Collections
/// Returns the original key value because the areSame function
/// may have unified two different keys.
member TryGetKeyValue : key:'TKey -> ('TKey*'TValue) option
/// Lookup a value and make it the most recent. Return None if it wasn't there.
/// Lookup a value and make it the most recent. Return <c>None</c> if it wasn't there.
member TryGet : key:'TKey -> 'TValue option
/// Add an element to the collection. Make it the most recent.
member Put : 'TKey*'TValue -> unit
......@@ -31,7 +31,7 @@ namespace Internal.Utilities.Collections
/// Resize
member Resize : keepStrongly: int * ?keepMax : int -> unit
/// Simple priority caching for a small number of key\value associations.
/// Simple priority caching for a small number of key/value associations.
/// This cache may age-out results that have been Set by the caller.
/// Because of this, the caller must be able to tolerate values
/// that aren't what was originally passed to the Set function.
......@@ -46,7 +46,7 @@ namespace Internal.Utilities.Collections
-> MruCache<'TKey,'TValue>
/// Clear out the cache.
member Clear : unit -> unit
/// Get the value for the given key or None if not already available
/// Get the value for the given key or <c>None</c> if not already available.
member TryGetAny : key:'TKey -> 'TValue option
/// Get the value for the given key or None if not already available
member TryGet : key:'TKey -> 'TValue option
......@@ -59,7 +59,8 @@ namespace Internal.Utilities.Collections
[<Sealed>]
type internal List =
/// Return a new list with one element for each unique 'TKey. Multiple 'TValues are flattened. The original order of the first instance of 'TKey is preserved.
/// Return a new list with one element for each unique 'TKey. Multiple 'TValues are flattened.
/// The original order of the first instance of 'TKey is preserved.
static member groupByFirst : l:('TKey * 'TValue) list -> ('TKey * 'TValue list) list when 'TKey : equality
/// Return each distinct item in the list using reference equality.
static member referenceDistinct : 'T list -> 'T list when 'T : not struct
......@@ -12,7 +12,7 @@ open System.Collections.Generic
/// The type doesn't support structural hashing or comparison.
type internal QueueList<'T>(firstElementsIn: FlatList<'T>, lastElementsRevIn: 'T list, numLastElementsIn: int) =
let numFirstElements = firstElementsIn.Length
// Push the lastElementsRev onto the firstElements every so often
// Push the lastElementsRev onto the firstElements every so often.
let push = numLastElementsIn > numFirstElements / 5
// Compute the contents after pushing.
......@@ -20,7 +20,7 @@ type internal QueueList<'T>(firstElementsIn: FlatList<'T>, lastElementsRevIn: '
let lastElementsRev = if push then [] else lastElementsRevIn
let numLastElements = if push then 0 else numLastElementsIn
// Compute the last elements on demand
// Compute the last elements on demand.
let lastElements() = if push then [] else List.rev lastElementsRev
static let empty = QueueList<'T>(FlatList.empty, [], 0)
......@@ -32,11 +32,11 @@ type internal QueueList<'T>(firstElementsIn: FlatList<'T>, lastElementsRevIn: '
member internal x.FirstElements = firstElements
member internal x.LastElements = lastElements()
/// Note this operation is O(1), unless a push happens, which is rare
/// NOTE: this operation is O(1), unless a push happens, which is rare.
member x.AppendOne(y) = QueueList(firstElements, y :: lastElementsRev, numLastElements+1)
member x.Append(ys:seq<_>) = QueueList(firstElements, (List.rev (Seq.toList ys) @ lastElementsRev), numLastElements+1)
/// Note this operation is O(n) anyway, so executing ToFlatList() here is OK
/// NOTE: this operation is O(n) anyway, so executing ToFlatList() here is OK
interface IEnumerable<'T> with
member x.GetEnumerator() : IEnumerator<'T> = (x.ToFlatList() :> IEnumerable<_>).GetEnumerator()
interface IEnumerable with
......
......@@ -43,17 +43,17 @@ module internal MSBuildResolver =
open System.IO
type ResolvedFile =
{ /// Item specification
{ /// Item specification.
itemSpec:string
/// Location that the assembly was resolved from
/// Location that the assembly was resolved from.
resolvedFrom:ResolvedFrom
/// The long fusion name of the assembly
/// The long fusion name of the assembly.
fusionName:string
/// The version of the assembly (like 4.0.0.0)
/// The version of the assembly (like 4.0.0.0).
version:string
/// The name of the redist the assembly was found in
/// The name of the redist the assembly was found in.
redist:string
/// Round-tripped baggage string
/// Round-tripped baggage string.
baggage:string
}
......@@ -61,17 +61,17 @@ module internal MSBuildResolver =
/// Reference resolution results. All paths are fully qualified.
type ResolutionResults =
{ /// Paths to primary references
{ /// Paths to primary references.
resolvedFiles:ResolvedFile[]
/// Paths to dependencies
/// Paths to dependencies.
referenceDependencyPaths:string[]
/// Paths to related files (like .xml and .pdb)
/// Paths to related files (like .xml and .pdb).
relatedPaths:string[]
/// Paths to satellite assemblies used for localization.
referenceSatellitePaths:string[]
/// Additional files required to support multi-file assemblies.
referenceScatterPaths:string[]
/// Paths to files that reference resolution recommend be copied to the local directory
/// Paths to files that reference resolution recommend be copied to the local directory.
referenceCopyLocalPaths:string[]
/// Binding redirects that reference resolution recommends for the app.config file.
suggestedBindingRedirects:string[]
......@@ -88,9 +88,10 @@ module internal MSBuildResolver =
}
/// Get the Reference Assemblies directory for the .NET Framework on Window
/// Get the Reference Assemblies directory for the .NET Framework on Window.
let DotNetFrameworkReferenceAssembliesRootDirectoryOnWindows =
// Note that ProgramFilesX86 is correct for both x86 and x64 architectures (the reference assemblies are always in the 32-bit location, which is PF(x86) on an x64 machine)
// NOTE: that ProgramFilesX86 is correct for both x86 and x64 architectures
// (the reference assemblies are always in the 32-bit location, which is PF(x86) on an x64 machine)
let PF =
match Environment.GetEnvironmentVariable("ProgramFiles(x86)") with
| null -> Environment.GetEnvironmentVariable("ProgramFiles") // if PFx86 is null, then we are 32-bit and just get PF
......@@ -416,7 +417,7 @@ module internal MSBuildResolver =
outputDirectory, fsharpCoreExplicitDirOrFSharpBinariesDir, explicitIncludeDirs, implicitIncludeDir, frameworkRegistryBase,
assemblyFoldersSuffix, assemblyFoldersConditions, logMessage, logWarning, logError) =
// The {RawFileName} target is 'dangerous', in the sense that is uses Directory.GetCurrentDirectory() to resolve unrooted file paths.
// The {RawFileName} target is 'dangerous', in the sense that is uses <c>Directory.GetCurrentDirectory()</c> to resolve unrooted file paths.
// It is unreliable to use this mutable global state inside Visual Studio. As a result, we partition all references into a "rooted" set
// (which contains e.g. C:\MyDir\MyAssem.dll) and "unrooted" (everything else). We only allow "rooted" to use {RawFileName}. Note that
// unrooted may still find 'local' assemblies by virtue of the fact that "implicitIncludeDir" is one of the places searched during
......
......@@ -32,39 +32,39 @@ module internal MSBuildResolver =
/// Information about a resolved file.
type ResolvedFile =
{ /// Item specification
{ /// Item specification.
itemSpec:string
/// Location that the assembly was resolved from
/// Location that the assembly was resolved from.
resolvedFrom:ResolvedFrom
/// The long fusion name of the assembly
/// The long fusion name of the assembly.
fusionName:string
/// The version of the assembly (like 4.0.0.0)
/// The version of the assembly (like 4.0.0.0).
version:string
/// The name of the redist the assembly was found in
/// The name of the redist the assembly was found in.
redist:string
/// Round-tripped baggage string
/// Round-tripped baggage string.
baggage:string
}
/// Reference resolution results. All paths are fully qualified.
type ResolutionResults =
{ /// Paths to primary references
{ /// Paths to primary references.
resolvedFiles:ResolvedFile[]
/// Paths to dependencies
/// Paths to dependencies.
referenceDependencyPaths:string[]
/// Paths to related files (like .xml and .pdb)
/// Paths to related files (like .xml and .pdb).
relatedPaths:string[]
/// Paths to satellite assemblies used for localization.
referenceSatellitePaths:string[]
/// Additional files required to support multi-file assemblies.
referenceScatterPaths:string[]
/// Paths to files that reference resolution recommend be copied to the local directory
/// Paths to files that reference resolution recommend be copied to the local directory.
referenceCopyLocalPaths:string[]
/// Binding redirects that reference resolution recommends for the app.config file.
suggestedBindingRedirects:string[] }
/// Perform assembly resolution on the given references
/// Perform assembly resolution on the given references.
val Resolve:
resolutionEnvironment: ResolutionEnvironment *
references:seq<string (* baggage *) * string> *
......
......@@ -57,7 +57,7 @@ type internal Trace private() =
if String.IsNullOrEmpty(Trace.threadName) then sprintf "(id=%d)" Thread.CurrentThread.ManagedThreadId
else sprintf "(id=%d,name=%s)" Thread.CurrentThread.ManagedThreadId Trace.threadName
/// Report the elapsed time since start
/// Report the elapsed time since start.
static member private ElapsedTime(start) =
let elapsed : TimeSpan = (DateTime.Now-start)
sprintf "%A ms" elapsed.TotalMilliseconds
......@@ -82,7 +82,7 @@ type internal Trace private() =
else if not(current.Contains(threadName)) then Trace.threadName <- current^","^threadName
| None -> ()
/// Base implementation of the call function
/// Base implementation of the call function.
static member private CallImpl(loggingClass,functionName,descriptionFunc,threadName:string option) : IDisposable =
#if DEBUG
if Trace.ShouldLog(loggingClass) then
......@@ -127,9 +127,9 @@ type internal Trace private() =
noopDisposable : IDisposable
#endif
/// Log a method as its called.
/// Log a method as it's called.
static member Call(loggingClass:string,functionName:string,descriptionFunc:unit->string) = Trace.CallImpl(loggingClass,functionName,descriptionFunc,None)
/// Log a method as its called. Expected always to be called on the same thread which will be named 'threadName'
/// Log a method as it's called. Expected always to be called on the same thread which will be named 'threadName'.
static member CallByThreadNamed(loggingClass:string,functionName:string,threadName:string,descriptionFunc:unit->string) = Trace.CallImpl(loggingClass,functionName,descriptionFunc,Some(threadName))
/// Log a message by logging class.
static member PrintLine(loggingClass:string, messageFunc:unit->string) =
......
......@@ -105,29 +105,29 @@ module NameMap =
//-------------------------------------------------------------------------
module Check =
/// Throw System.InvalidOperationException() if argument is None.
/// If there is a value (e.g. Some(value)) then value is returned.
/// Throw <c>System.InvalidOperationException()</c> if argument is <c>None</c>.
/// If there is a value (e.g. <c>Some(value)</c>) then value is returned.
let NotNone argname (arg:'T option) : 'T =
match arg with
| None -> raise (new System.InvalidOperationException(argname))
| Some x -> x
/// Throw System.ArgumentNullException() if argument is null.
/// Throw <c>System.ArgumentNullException()</c> if argument is <c>null</c>.
let ArgumentNotNull arg argname =
match box(arg) with
| null -> raise (new System.ArgumentNullException(argname))
| _ -> ()
/// Throw System.ArgumentNullException() if array argument is null.
/// Throw System.ArgumentOutOfRangeException() is array argument is empty.
/// Throw <c>System.ArgumentNullException()</c> if array argument is <c>null</c>.
/// Throw <c>System.ArgumentOutOfRangeException()</c> is array argument is empty.
let ArrayArgumentNotNullOrEmpty (arr:'T[]) argname =
ArgumentNotNull arr argname
if (0 = arr.Length) then
raise (new System.ArgumentOutOfRangeException(argname))
/// Throw System.ArgumentNullException() if string argument is null.
/// Throw System.ArgumentOutOfRangeException() is string argument is empty.
/// Throw <c>System.ArgumentNullException()</c> if string argument is <c>null</c>.
/// Throw <c>System.ArgumentOutOfRangeException()</c> is string argument is empty.
let StringArgumentNotNullOrEmpty (s:string) argname =
ArgumentNotNull s argname
if s.Length = 0 then
......@@ -402,9 +402,9 @@ let inline cacheOptRef cache f =
// The bug manifests itself as an ExecutionEngine failure or fast-fail process exit which comes
// and goes depending on whether components are NGEN'd or not, e.g. 'ngen install FSharp.COmpiler.dll'
// One workaround for the bug is to break NGEN loading and fixups into smaller fragments. Roughly speaking, the NGEN
// loading process works by doing delayed fixups of references in NGEN code. This happens on a per-method
// basis. For example, one manifestation is that a "print" before calling a method like LexFilter.create gets
// displayed but the corresponding "print" in the body of that function doesn't get displayed. In between, the NGEN
// loading process works by doing delayed fixups of references in NGEN code. This happens on a per-method basis.
// e.g. one manifestation is that a 'print' before calling a method like LexFilter.create gets
// displayed but the corresponding 'print' in the body of that function doesn't get displayed. In between, the NGEN
// image loader is performing a whole bunch of fixups of the NGEN code for the body of that method, and also for
// bodies of methods referred to by that method. That second bit is very important: the fixup causing the crash may
// be a couple of steps down the dependency chain.
......@@ -442,7 +442,7 @@ module internal AsyncUtil =
open System.Threading
open Microsoft.FSharp.Control
/// Represents the reified result of an asynchronous computation
/// Represents the reified result of an asynchronous computation.
[<NoEquality; NoComparison>]
type AsyncResult<'T> =
| AsyncOk of 'T
......@@ -456,7 +456,7 @@ module internal AsyncUtil =
| AsyncException exn -> econt exn
| AsyncCanceled exn -> ccont exn)
/// When using .NET 4.0 you can replace this type by Task<'T>
/// When using .NET 4.0 you can replace this type by <see cref="Task{T}"/>
[<Sealed>]
type AsyncResultCell<'T>() =
let mutable result = None
......@@ -496,7 +496,7 @@ module internal AsyncUtil =
| _ ->
grabbedConts |> List.iter postOrQueue
/// Get the reified result
/// Get the reified result.
member private x.AsyncPrimitiveResult =
Async.FromContinuations(fun (cont,_,_) ->
let grabbedResult =
......@@ -515,7 +515,7 @@ module internal AsyncUtil =
| Some res -> cont res)
/// Get the result and commit it
/// Get the result and Commit(...).
member x.AsyncResult =
async { let! res = x.AsyncPrimitiveResult
return! AsyncResult.Commit(res) }
......
......@@ -189,7 +189,7 @@ let posEq (p1:pos) (p2:pos) = (p1.Line = p2.Line && p1.Column = p2.Column)
let posGeq p1 p2 = posEq p1 p2 || posGt p1 p2
let posLt p1 p2 = posGt p2 p1
// Note, this is deliberately written in an allocation-free way, i.e. m1.Start, m1.End etc. are not called
// NOTE: this is deliberately written in an allocation-free way, i.e. m1.Start, m1.End etc. are not called
let unionRanges (m1:range) (m2:range) =
if m1.FileIndex <> m2.FileIndex then m2 else
let b =
......
......@@ -84,7 +84,7 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>)
member x.Remove(y) =
let mutable res = Unchecked.defaultof<'Value>
let ok = firstEntries.TryGetValue(y,&res)
// Note, if not ok then nothing to remove - nop
// NOTE: If not ok then nothing to remove - nop
if ok then
// We drop the FirstEntry. Here we compute the new FirstEntry and residue MoreEntries
let mutable res = []
......@@ -98,7 +98,6 @@ type internal HashMultiMap<'Key,'Value>(n: int, hasheq: IEqualityComparer<'Key>)
firstEntries.[y] <- h
rest.[y] <- t
| _ ->
// note: broken invariant
()
else
firstEntries.Remove(y) |> ignore
......
......@@ -10,52 +10,52 @@ open System.Collections.Generic
/// The table may map a single key to multiple bindings.
[<Sealed>]
type internal HashMultiMap<'Key,'Value> =
/// Create a new empty mutable HashMultiMap with the given key hash/equality functions
/// Create a new empty mutable HashMultiMap with the given key hash/equality functions.
new : comparer:IEqualityComparer<'Key> -> HashMultiMap<'Key,'Value>
/// Create a new empty mutable HashMultiMap with an internal bucket array of the given approximate size
/// and with the given key hash/equality functions
/// and with the given key hash/equality functions.
new : size:int * comparer:IEqualityComparer<'Key> -> HashMultiMap<'Key,'Value>
/// Build a map that contains the bindings of the given IEnumerable
/// Build a map that contains the bindings of the given IEnumerable.
new : entries:seq<'Key * 'Value> * comparer:IEqualityComparer<'Key> -> HashMultiMap<'Key,'Value>
/// Make a shallow copy of the collection
/// Make a shallow copy of the collection.
member Copy : unit -> HashMultiMap<'Key,'Value>
/// Add a binding for the element to the table
/// Add a binding for the element to the table.
member Add : 'Key * 'Value -> unit
/// Clear all elements from the collection
/// Clear all elements from the collection.
member Clear : unit -> unit
/// Test if the collection contains any bindings for the given element
/// Test if the collection contains any bindings for the given element.
member ContainsKey: 'Key -> bool
/// Remove the latest binding (if any) for the given element from the table
/// Remove the latest binding if any for the given element from the table.
member Remove : 'Key -> unit
/// Replace the latest binding (if any) for the given element.
/// Replace the latest binding if any for the given element.
member Replace : 'Key * 'Value -> unit
/// Lookup or set the given element in the table. Set replaces all existing bindings for a value with a single
/// bindings. Raise <c>KeyNotFoundException</c> if the element is not found.
member Item : 'Key -> 'Value with get,set
/// Lookup the given element in the table, returning the result as an Option
/// Lookup the given element in the table, returning the result as an Option.
member TryFind : 'Key -> 'Value option
/// Find all bindings for the given element in the table, if any
/// Find all bindings for the given element in the table, if any.
member FindAll : 'Key -> 'Value list
/// Apply the given function to each element in the collection threading the accumulating parameter
/// through the sequence of function applications
/// through the sequence of function applications.
member Fold : ('Key -> 'Value -> 'State -> 'State) -> 'State -> 'State
/// The total number of keys in the hash table
/// The total number of keys in the hash table.
member Count : int
///Apply the given function to each binding in the hash table
/// Apply the given function to each binding in the hash table.
member Iterate : ('Key -> 'Value -> unit) -> unit
interface IDictionary<'Key, 'Value>
......
......@@ -27,29 +27,29 @@ module internal ResizeArray =
/// Create an array by calling the given generator on each index.
val init: int -> (int -> 'T) -> ResizeArray<'T>
///Build a new array that contains the elements of the first array followed by the elements of the second array
/// Build a new array that contains the elements of the first array followed by the elements of the second array.
val append: ResizeArray<'T> -> ResizeArray<'T> -> ResizeArray<'T>
///Build a new array that contains the elements of each of the given list of arrays
/// Build a new array that contains the elements of each of the given list of arrays.
val concat: ResizeArray<'T> list -> ResizeArray<'T>
///Build a new array that contains the given subrange specified by
///starting index and length.
/// Build a new array that contains the given subrange specified by
/// starting index and length.
val sub: ResizeArray<'T> -> int -> int -> ResizeArray<'T>
///Build a new array that contains the elements of the given array
/// Build a new array that contains the elements of the given array.
val copy: ResizeArray<'T> -> ResizeArray<'T>
///Fill a range of the collection with the given element
/// Fill a range of the collection with the given element.
val fill: ResizeArray<'T> -> int -> int -> 'T -> unit
///Read a range of elements from the first array and write them into the second.
/// Read a range of elements from the first array and write them into the second.
val blit: ResizeArray<'T> -> int -> ResizeArray<'T> -> int -> int -> unit
///Build a list from the given array
/// Build a list from the given array.
val toList: ResizeArray<'T> -> 'T list
///Build an array from the given list
/// Build an array from the given list.
val ofList: 'T list -> ResizeArray<'T>
/// Apply a function to each element of the collection, threading an accumulator argument
......@@ -62,30 +62,30 @@ module internal ResizeArray =
/// computes <c>f i0 (...(f iN s))</c>.
val foldBack: ('T -> 'U -> 'U) -> ResizeArray<'T> -> 'U -> 'U
///Apply the given function to each element of the array.
/// Apply the given function to each element of the array.
val iter: ('T -> unit) -> ResizeArray<'T> -> unit
///Build a new array whose elements are the results of applying the given function
///to each of the elements of the array.
/// Build a new array whose elements are the results of applying the given function
/// to each of the elements of the array.
val map: ('T -> 'U) -> ResizeArray<'T> -> ResizeArray<'U>
///Apply the given function to two arrays simultaneously. The
///two arrays must have the same lengths, otherwise an Invalid_argument exception is
///raised.
/// Apply the given function to two arrays simultaneously. The
/// two arrays must have the same lengths, otherwise an Invalid_argument exception is
/// raised.
val iter2: ('T -> 'U -> unit) -> ResizeArray<'T> -> ResizeArray<'U> -> unit
///Build a new collection whose elements are the results of applying the given function
///to the corresponding elements of the two collections pairwise. The two input
///arrays must have the same lengths.
/// Build a new collection whose elements are the results of applying the given function
/// to the corresponding elements of the two collections pairwise. The two input
/// arrays must have the same lengths.
val map2: ('T -> 'U -> 'c) -> ResizeArray<'T> -> ResizeArray<'U> -> ResizeArray<'c>
///Apply the given function to each element of the array. The integer passed to the
///function indicates the index of element.
/// Apply the given function to each element of the array. The integer passed to the
/// function indicates the index of element.
val iteri: (int -> 'T -> unit) -> ResizeArray<'T> -> unit
///Build a new array whose elements are the results of applying the given function
///to each of the elements of the array. The integer index passed to the
///function indicates the index of element being transformed.
/// Build a new array whose elements are the results of applying the given function
/// to each of the elements of the array. The integer index passed to the
/// function indicates the index of element being transformed.
val mapi: (int -> 'T -> 'U) -> ResizeArray<'T> -> ResizeArray<'U>
/// Test if any element of the array satisfies the given predicate.
......@@ -98,46 +98,48 @@ module internal ResizeArray =
/// then computes <c>p i0 && ... && p iN</c>.
val forall: ('T -> bool) -> ResizeArray<'T> -> bool
///Return a new collection containing only the elements of the collection
///for which the given predicate returns <c>true</c>
/// Return a new collection containing only the elements of the collection
/// for which the given predicate returns True.
val filter: ('T -> bool) -> ResizeArray<'T> -> ResizeArray<'T>
///Split the collection into two collections, containing the
///elements for which the given predicate returns <c>true</c> and <c>false</c>
///respectively
/// Split the collection into two collections, containing the
/// elements for which the given predicate returns True and False
/// respectively.
val partition: ('T -> bool) -> ResizeArray<'T> -> ResizeArray<'T> * ResizeArray<'T>
///Apply the given function to each element of the array. Return
///the array comprised of the results "x" for each element where
///the function returns Some(x)
/// Apply the given function to each element of the array. Return
/// the array comprised of the results "x" for each element where
/// the function returns <c>Some(x)</c>.
val choose: ('T -> 'U option) -> ResizeArray<'T> -> ResizeArray<'U>
///Return the first element for which the given function returns <c>true</c>.
///Raise <c>KeyNotFoundException</c> if no such element exists.
/// Return the first element for which the given function returns True.
/// Raise <c>KeyNotFoundException</c> if no such element exists.
val find: ('T -> bool) -> ResizeArray<'T> -> 'T
///Return the first element for which the given function returns <c>true</c>.
///Return None if no such element exists.
/// Return the first element for which the given function returns True.
/// Return None if no such element exists.
val tryFind: ('T -> bool) -> ResizeArray<'T> -> 'T option
///Apply the given function to successive elements, returning the first
///result where function returns "Some(x)" for some x.
/// Apply the given function to successive elements, returning the first
/// result where function returns Some(x) for some x.
val tryPick: ('T -> 'U option) -> ResizeArray<'T> -> 'U option
///Return a new array with the elements in reverse order
/// Return a new array with the elements in reverse order.
val rev: ResizeArray<'T> -> ResizeArray<'T>
/// Sort the elements using the given comparison function
/// Sort the elements using the given comparison function.
val sort: ('T -> 'T -> int) -> ResizeArray<'T> -> unit
/// Sort the elements using the key extractor and generic comparison on the keys
/// Sort the elements using the key extractor and generic comparison on the keys.
val sortBy: ('T -> 'Key) -> ResizeArray<'T> -> unit when 'Key : comparison
/// Return a fixed-length array containing the elements of the input ResizeArray
/// Return a fixed-length array containing the elements of the input <c>ResizeArray</c>.
val toArray : ResizeArray<'T> -> 'T[]
/// Build a ResizeArray from the given elements
/// Build a <c>ResizeArray</c> from the given elements.
val ofArray : 'T[] -> ResizeArray<'T>
/// Return a view of the array as an enumerable object
/// Return a view of the array as an enumerable object.
val toSeq : ResizeArray<'T> -> seq<'T>
/// Test elements of the two arrays pairwise to see if any pair of element satisfies the given predicate.
......@@ -178,10 +180,10 @@ module internal ResizeArray =
val foldBack2 : ('a1 -> 'a2 -> 'U -> 'U) -> ResizeArray<'a1> -> ResizeArray<'a2> -> 'U -> 'U
/// Test elements of the two arrays pairwise to see if all pairs of elements satisfy the given predicate.
/// Raise ArgumentException if the arrays have different lengths.
/// Raise <c>ArgumentException</c> if the arrays have different lengths.
val forall2 : ('T -> 'U -> bool) -> ResizeArray<'T> -> ResizeArray<'U> -> bool
/// Return true if the given array is empty, otherwise false
/// Return True if the given array is empty, otherwise False.
val isEmpty : ResizeArray<'T> -> bool
/// Apply the given function to pair of elements drawn from matching indices in two arrays,
......@@ -195,13 +197,13 @@ module internal ResizeArray =
/// raised.
val mapi2 : (int -> 'T -> 'U -> 'c) -> ResizeArray<'T> -> ResizeArray<'U> -> ResizeArray<'c>
/// Like <c>fold</c>, but return the intermediary and final results
/// Like <c>fold</c>, but return the intermediary and final results.
val scan : ('U -> 'T -> 'U) -> 'U -> ResizeArray<'T> -> ResizeArray<'U>
/// Like <c>foldBack</c>, but return both the intermediary and final results
/// Like <c>foldBack</c>, but return both the intermediary and final results.
val scanBack : ('T -> 'c -> 'c) -> ResizeArray<'T> -> 'c -> ResizeArray<'c>
/// Return an array containing the given element
/// Return an array containing the given element.
val singleton : 'T -> ResizeArray<'T>
/// Return the index of the first element in the array
......@@ -216,5 +218,5 @@ module internal ResizeArray =
/// raised..
val zip : ResizeArray<'T> -> ResizeArray<'U> -> ResizeArray<'T * 'U>
/// Split an array of pairs into two arrays
/// Split an array of pairs into two arrays.
val unzip : ResizeArray<'T * 'U> -> ResizeArray<'T> * ResizeArray<'U>
......@@ -711,9 +711,6 @@ namespace Internal.Utilities.Collections.Tagged
#if ONE
| MapOne of 'Key * 'T
#endif
// Note: performance rumour has it that the data held in this node should be
// exactly one cache line. It is currently ~7 words. Thus it might be better to
// move to a n-way tree.
| MapNode of 'Key * 'T * MapTree<'Key,'T> * MapTree<'Key,'T> * int
......
......@@ -12,62 +12,62 @@ namespace Internal.Utilities.Collections.Tagged
[<Sealed>]
type internal Set<'T,'ComparerTag> when 'ComparerTag :> IComparer<'T> =
/// A useful shortcut for Set.add. Note this operation produces a new set
/// A useful shortcut for <c>Set.add</c>. Note this operation produces a new set
/// and does not mutate the original set. The new set will share many storage
/// nodes with the original. See the Set module for further operations on sets.
/// nodes with the original. See the <c>Set</c> module for further operations on sets.
member Add : 'T -> Set<'T,'ComparerTag>
/// A useful shortcut for Set.remove. Note this operation produces a new set
/// A useful shortcut for <c>Set.remove</c>. Note this operation produces a new set
/// and does not mutate the original set. The new set will share many storage
/// nodes with the original. See the Set module for further operations on sets.
/// nodes with the original. See the <c>Set</c> module for further operations on sets.
member Remove : 'T -> Set<'T,'ComparerTag>
/// Return the number of elements in the set
/// Return the number of elements in the set.
member Count : int
/// A useful shortcut for Set.contains. See the Set module for further operations on sets.
/// A useful shortcut for <c>Set.contains</c>. See the <c>Set</c> module for further operations on sets.
member Contains : 'T -> bool
/// A useful shortcut for Set.isEmpty. See the Set module for further operations on sets.
/// A useful shortcut for <c>Set.isEmpty</c>. See the <c>Set</c> module for further operations on sets.
member IsEmpty : bool
/// Apply the given function to each binding in the collection
/// Apply the given function to each binding in the collection.
member Iterate : ('T -> unit) -> unit
/// Apply the given accumulating function to all the elements of the set
/// Apply the given accumulating function to all the elements of the set.
member Fold : ('T -> 'State -> 'State) -> 'State -> 'State
/// Build two new sets, one containing the elements for which the given predicate returns 'true',
/// and the other the remaining elements.
/// Build two new sets, one containing the elements for which the given predicate returns True,
/// and another with the remaining elements.
member Partition: predicate:('T -> bool) -> Set<'T,'ComparerTag> * Set<'T,'ComparerTag>
/// Return a new collection containing only the elements of the collection
/// for which the given predicate returns "true"
/// for which the given predicate returns True.
member Filter: predicate:('T -> bool) -> Set<'T,'ComparerTag>
/// Test if any element of the collection satisfies the given predicate.
/// If the input function is <c>f</c> and the elements are <c>i0...iN</c> then computes
/// <c>p i0 or ... or p iN</c>.
/// If the input function is f and the elements are i0...iN then computes
/// p i0 or ... or p iN.
member Exists: predicate:('T -> bool) -> bool
/// Test if all elements of the collection satisfy the given predicate.
/// If the input function is <c>f</c> and the elements are <c>i0...iN</c> and <c>j0...jN</c> then
/// computes <c>p i0 && ... && p iN</c>.
/// If the input function is f and the elements are i0...iN and j0...jN then
/// computes p i0 && ... && p iN.
member ForAll: predicate:('T -> bool) -> bool
/// A set based on the given comparer containing the given initial elements
/// A set based on the given comparer containing the given initial elements.
static member Create: 'ComparerTag * seq<'T> -> Set<'T,'ComparerTag>
/// The empty set based on the given comparer
/// The empty set based on the given comparer.
static member Empty: 'ComparerTag -> Set<'T,'ComparerTag>
/// A singleton set based on the given comparison operator
/// A singleton set based on the given comparison operator.
static member Singleton: 'ComparerTag * 'T -> Set<'T,'ComparerTag>
/// Compares two sets and returns true if they are equal or false otherwise
/// Compares two sets and returns True if they are equal or False otherwise.
static member Equality : Set<'T,'ComparerTag> * Set<'T,'ComparerTag> -> bool
/// Compares a and b and returns 1 if a > b, -1 if b < a and 0 if a = b
/// Compares a and b and returns 1 if a > b, -1 if b < a and 0 if a = b.
static member Compare : a:Set<'T,'ComparerTag> * b:Set<'T,'ComparerTag> -> int
/// Return a new set with the elements of the second set removed from the first.
......@@ -85,19 +85,19 @@ namespace Internal.Utilities.Collections.Tagged
/// Return a new set with the elements of the second set removed from the first.
static member Difference: Set<'T,'ComparerTag> * Set<'T,'ComparerTag> -> Set<'T,'ComparerTag>
/// The number of elements in the set
/// The number of elements in the set.
member Choose : 'T
/// Returns the lowest element in the set according to the ordering being used for the set
/// Returns the lowest element in the set according to the ordering being used for the set.
member MinimumElement: 'T
/// Returns the highest element in the set according to the ordering being used for the set
/// Returns the highest element in the set according to the ordering being used for the set.
member MaximumElement: 'T
/// Evaluates to "true" if all elements of the second set are in the first
/// Evaluates to True if all elements of the second set are in the first.
member IsSubsetOf: Set<'T,'ComparerTag> -> bool
/// Evaluates to "true" if all elements of the first set are in the second
/// Evaluates to True if all elements of the first set are in the second.
member IsSupersetOf: Set<'T,'ComparerTag> -> bool
/// The elements of the set as a list.
......@@ -131,7 +131,7 @@ namespace Internal.Utilities.Collections.Tagged
/// Return a new map with the binding added to the given map.
member Add: 'Key * 'Value -> Map<'Key,'Value,'ComparerTag>
/// Return true if there are no bindings in the map.
/// Return True if there are no bindings in the map.
member IsEmpty: bool
//member Comparer : 'ComparerTag
......@@ -142,32 +142,32 @@ namespace Internal.Utilities.Collections.Tagged
static member FromList : 'ComparerTag * ('Key * 'Value) list -> Map<'Key,'Value,'ComparerTag>
/// Build a map that contains the bindings of the given IEnumerable
/// and where comparison of elements is based on the given comparison function
/// Build a map that contains the bindings of the given <c>IEnumerable</c>
/// and where comparison of elements is based on the given comparison function.
static member Create: 'ComparerTag * seq<'Key * 'Value> -> Map<'Key,'Value,'ComparerTag>
/// Test is an element is in the domain of the map
/// Test is an element is in the domain of the map.
member ContainsKey: 'Key -> bool
/// The number of bindings in the map
/// The number of bindings in the map.
member Count: int
/// Lookup an element in the map. Raise <c>KeyNotFoundException</c> if no binding
/// exists in the map.
member Item : 'Key -> 'Value with get
/// Search the map looking for the first element where the given function returns a <c>Some</c> value
/// Search the map looking for the first element where the given function returns a Some value.
member First: ('Key -> 'Value -> 'T option) -> 'T option
/// Return true if the given predicate returns true for all of the
/// Return True if the given predicate returns true for all of the
/// bindings in the map. Always returns true if the map is empty.
member ForAll: ('Key -> 'Value -> bool) -> bool
/// Return true if the given predicate returns true for one of the
/// Return True if the given predicate returns true for one of the
/// bindings in the map. Always returns false if the map is empty.
member Exists: ('Key -> 'Value -> bool) -> bool
/// Build a new map containing the bindings for which the given predicate returns 'true'.
/// Build a new map containing the bindings for which the given predicate returns True.
member Filter: ('Key -> 'Value -> bool) -> Map<'Key,'Value,'ComparerTag>
/// Fold over the bindings in the map.
......@@ -181,7 +181,7 @@ namespace Internal.Utilities.Collections.Tagged
/// Fold over the bindings in the map.
member FoldAndMap: ('Key -> 'Value -> 'State -> 'T * 'State) -> 'State -> Map<'Key,'T,'ComparerTag> * 'State
/// Apply the given function to each binding in the dictionary
/// Apply the given function to each binding in the dictionary.
member Iterate: action:('Key -> 'Value -> unit) -> unit
/// Build a new collection whose elements are the results of applying the given function
......@@ -193,21 +193,21 @@ namespace Internal.Utilities.Collections.Tagged
/// to each of the elements of the collection.
member MapRange: mapping:('Value -> 'T) -> Map<'Key,'T,'ComparerTag>
/// Build two new maps, one containing the bindings for which the given predicate returns 'true',
/// and the other the remaining bindings.
/// Build two new maps, one containing the bindings for which the given predicate returns True,
/// and another for the remaining bindings.
member Partition: ('Key -> 'Value -> bool) -> Map<'Key,'Value,'ComparerTag> * Map<'Key,'Value,'ComparerTag>
/// Remove an element from the domain of the map. No exception is raised if the element is not present.
member Remove: 'Key -> Map<'Key,'Value,'ComparerTag>
/// Lookup an element in the map, returning a <c>Some</c> value if the element is in the domain
/// of the map and <c>None</c> if not.
/// Lookup an element in the map, returning a Some value if the element is in the domain
/// of the map and None if not.
member TryFind: 'Key -> 'Value option
/// The elements of the set as a list.
member ToList : unit -> ('Key * 'Value) list
/// The elements of the set as an array
/// The elements of the set as an array.
member ToArray: unit -> ('Key * 'Value) array
interface IEnumerable<KeyValuePair<'Key, 'Value>>
......
......@@ -5,24 +5,24 @@ module internal Internal.Utilities.Filename
exception IllegalFileNameChar of string * char
/// "checkSuffix f s" returns true if filename "f" ends in suffix "s",
/// <c>checkSuffix f s</c> returns True if filename "f" ends in suffix "s",
/// e.g. checkSuffix "abc.fs" ".fs" returns true.
val checkSuffix: string -> string -> bool
/// "chopExtension f" removes the extension from the given
/// filename. Raises ArgumentException if no extension is present.
/// <c>chopExtension f</c> removes the extension from the given
/// filename. Raises <c>ArgumentException</c> if no extension is present.
val chopExtension: string -> string
/// "directoryName" " decomposes a filename into a directory name
/// "directoryName" " decomposes a filename into a directory name.
val directoryName: string -> string
/// Return true if the filename has a "." extension
/// Return True if the filename has a "." extension.
val hasExtension: string -> bool
/// Get the filename of the given path
/// Get the filename of the given path.
val fileNameOfPath: string -> string
/// Get the filename without extension of the given path
/// Get the filename without extension of the given path.
val fileNameWithoutExtension: string -> string
......@@ -75,15 +75,15 @@ namespace Internal.Utilities.Text.Lexing
internal LexBuffer<'Char>(filler: LexBufferFiller<'Char>) =
let context = new Dictionary<string,obj>(1)
let mutable buffer=[||];
/// number of valid characters beyond bufferScanStart
/// number of valid characters beyond bufferScanStart.
let mutable bufferMaxScanLength=0;
/// count into the buffer when scanning
/// count into the buffer when scanning.
let mutable bufferScanStart=0;
/// number of characters scanned so far
/// number of characters scanned so far.
let mutable bufferScanLength=0;
/// length of the scan at the last accepting state
/// length of the scan at the last accepting state.
let mutable lexemeLength=0;
/// action related to the last accepting state
/// action related to the last accepting state.
let mutable bufferAcceptAction=0;
let mutable eof = false;
let mutable startPos = Position.Empty ;
......@@ -100,12 +100,12 @@ namespace Internal.Utilities.Text.Lexing
member lexbuf.EndOfScan () : int =
// Printf.eprintf "endOfScan, lexBuffer.lexemeLength = %d\n" lexBuffer.lexemeLength;
//Printf.eprintf "endOfScan, lexBuffer.lexemeLength = %d\n" lexBuffer.lexemeLength;
if bufferAcceptAction < 0 then
failwith "unrecognized input"
// printf "endOfScan %d state %d on unconsumed input '%c' (%d)\n" a s (Char.chr inp) inp;
// Printf.eprintf "accept, lexeme = %s\n" (lexeme lexBuffer);
//printf "endOfScan %d state %d on unconsumed input '%c' (%d)\n" a s (Char.chr inp) inp;
//Printf.eprintf "accept, lexeme = %s\n" (lexeme lexBuffer);
lexbuf.StartPos <- endPos;
lexbuf.EndPos <- endPos.EndOfToken(lexbuf.LexemeLength);
bufferAcceptAction
......@@ -183,7 +183,7 @@ namespace Internal.Utilities.Text.Lexing
else
if lexBuffer.IsPastEndOfStream then failwith "End of file on lexing stream";
lexBuffer.IsPastEndOfStream <- true;
// printf "state %d --> %d on eof\n" state snew;
//printf "state %d --> %d on eof\n" state snew;
scanUntilSentinel(lexBuffer,snew)
else
scanUntilSentinel(lexBuffer, state)
......@@ -257,7 +257,7 @@ namespace Internal.Utilities.Text.Lexing
lexBuffer.EndOfScan()
else
lexBuffer.BufferScanLength <- lexBuffer.BufferScanLength + 1;
// printf "state %d --> %d on '%c' (%d)\n" s snew (char inp) inp;
//printf "state %d --> %d on '%c' (%d)\n" s snew (char inp) inp;
scanUntilSentinel(lexBuffer,snew)
// Each row for the Unicode table has format
......
......@@ -12,66 +12,67 @@ open Microsoft.FSharp.Control
/// Position information stored for lexing tokens
[<Struct>]
type internal Position =
/// The file index for the file associated with the input stream, use fileOfFileIndex in range.fs to decode
/// The file index for the file associated with the input stream, use <c>fileOfFileIndex</c> in range.fs to decode
val FileIndex : int
/// The line number in the input stream, assuming fresh positions have been updated
/// for the new line by modifying the EndPos property of the LexBuffer.
val Line : int
/// The line number for the position in the input stream, assuming fresh positions have been updated
/// using for the new line
/// using for the new line.
val OriginalLine : int
/// The character number in the input stream
/// The character number in the input stream.
val AbsoluteOffset : int
/// Return absolute offset of the start of the line marked by the position
/// Return absolute offset of the start of the line marked by the position.
val StartOfLineAbsoluteOffset : int
/// Return the column number marked by the position, i.e. the difference between the AbsoluteOffset and the StartOfLineAbsoluteOffset
/// Return the column number marked by the position,
/// i.e. the difference between the <c>AbsoluteOffset</c> and the <c>StartOfLineAbsoluteOffset</c>
member Column : int
// Given a position just beyond the end of a line, return a position at the start of the next line
// Given a position just beyond the end of a line, return a position at the start of the next line.
member NextLine : Position
/// Given a position at the start of a token of length n, return a position just beyond the end of the token
/// Given a position at the start of a token of length n, return a position just beyond the end of the token.
member EndOfToken: n:int -> Position
/// Gives a position shifted by specified number of characters
/// Gives a position shifted by specified number of characters.
member ShiftColumnBy: by:int -> Position
// Same line, column -1
// Same line, column -1.
member ColumnMinusOne : Position
/// Apply a #line directive
/// Apply a #line directive.
member ApplyLineDirective : fileIdx:int * line:int -> Position
/// Get an arbitrary position, with the empty string as filename, and
/// Get an arbitrary position, with the empty string as filename.
static member Empty : Position
static member FirstLine : fileIdx:int -> Position
[<Sealed>]
/// Input buffers consumed by lexers generated by <c>fslex.exe </c>
/// Input buffers consumed by lexers generated by <c>fslex.exe</c>.
type internal LexBuffer<'Char> =
/// The start position for the lexeme
/// The start position for the lexeme.
member StartPos: Position with get,set
/// The end position for the lexeme
/// The end position for the lexeme.
member EndPos: Position with get,set
/// The matched string
/// The matched string.
member Lexeme: 'Char []
/// Fast helper to turn the matched characters into a string, avoiding an intermediate array
/// Fast helper to turn the matched characters into a string, avoiding an intermediate array.
static member LexemeString : LexBuffer<char> -> string
/// Dynamically typed, non-lexically scoped parameter table
/// Dynamically typed, non-lexically scoped parameter table.
member BufferLocalStore : IDictionary<string,obj>
/// True if the refill of the buffer ever failed , or if explicitly set to true.
/// True if the refill of the buffer ever failed , or if explicitly set to True.
member IsPastEndOfStream: bool with get,set
/// Create a lex buffer suitable for Unicode lexing that reads characters from the given array
/// Create a lex buffer suitable for Unicode lexing that reads characters from the given array.
static member FromChars: char[] -> LexBuffer<char>
/// Create a lex buffer that reads character or byte inputs by using the given function
/// Create a lex buffer that reads character or byte inputs by using the given function.
static member FromFunction: ('Char[] * int * int -> int) -> LexBuffer<'Char>
/// The type of tables for an unicode lexer generated by fslex.
/// The type of tables for an unicode lexer generated by <c>fslex.exe</c>.
[<Sealed>]
type internal UnicodeTables =
static member Create : uint16[][] * uint16[] -> UnicodeTables
/// Interpret tables for a unicode lexer generated by fslex.
/// Interpret tables for a unicode lexer generated by <c>fslex.exe</c>.
member Interpret: initialState:int * LexBuffer<char> -> int
......@@ -62,8 +62,8 @@ type internal Tables<'tok> =
stateToProdIdxsTableElements: uint16[];
stateToProdIdxsTableRowOffsets: uint16[];
productionToNonTerminalTable: uint16[];
/// For fsyacc.exe, this entry is filled in by context from the generated parser file. If no 'parse_error' function
/// is defined by the user then ParseHelpers.parse_error is used by default (ParseHelpers is opened
/// For <c>fsyacc.exe</c>, this entry is filled in by context from the generated parser file. If no 'parse_error' function
/// is defined by the user then <c>ParseHelpers.parse_error</c> is used by default (ParseHelpers is opened
/// at the top of the generated parser file)
parseError: ParseErrorContext<'tok> -> unit;
numTerminals: int;
......@@ -72,8 +72,8 @@ type internal Tables<'tok> =
//-------------------------------------------------------------------------
// An implementation of stacks.
// This type is in System.dll so for the moment we can't use it in FSharp.Core.dll
//type Stack<'a> = System.Collections.Generic.Stack<'a>
// This type is in <c>System.dll</c> so for the moment we can't use it in <c>FSharp.Core.dll</c>
// type Stack<'a> = System.Collections.Generic.Stack<'a>
type Stack<'a>(n) =
let mutable contents = Array.zeroCreate<'a>(n)
......@@ -150,7 +150,7 @@ module internal Implementation =
// takes up around 10% of of parsing time
// for parsing intensive samples such as the bootstrapped F# compiler.
//
// Note: using a .NET Dictionary for this int -> int table looks like it could be sub-optimal.
// NOTE: using a .NET Dictionary for this int -> int table looks like it could be sub-optimal.
// Some other better sparse lookup table may be better.
assert (rowNumber < 0x10000)
assert (keyToFind < 0x10000)
......@@ -288,7 +288,7 @@ module internal Implementation =
#endif
let nextState = actionValue action
// The "error" non terminal needs position information, though it tends to be unreliable.
// Use the StartPos/EndPos from the lex buffer
// Use the StartPos/EndPos from the lex buffer.
valueStack.Push(ValueInfo(box (), lexbuf.StartPos, lexbuf.EndPos));
stateStack.Push(nextState)
else
......
......@@ -8,87 +8,88 @@ open System.Collections.Generic
[<Sealed>]
type internal IParseState =
/// Get the start and end position for the terminal or non-terminal at a given index matched by the production
/// Get the start and end position for the terminal or non-terminal at a given index matched by the production.
member InputRange: index:int -> Position * Position
/// Get the end position for the terminal or non-terminal at a given index matched by the production
/// Get the end position for the terminal or non-terminal at a given index matched by the production.
member InputEndPosition: int -> Position
/// Get the start position for the terminal or non-terminal at a given index matched by the production
/// Get the start position for the terminal or non-terminal at a given index matched by the production.
member InputStartPosition: int -> Position
/// Get the start of the range of positions matched by the production
/// Get the start of the range of positions matched by the production.
member ResultStartPosition: Position
/// Get the end of the range of positions matched by the production
/// Get the end of the range of positions matched by the production.
member ResultEndPosition: Position
/// Get the full range of positions matched by the production
/// Get the full range of positions matched by the production.
member ResultRange: Position * Position
/// Get the value produced by the terminal or non-terminal at the given position
/// Get the value produced by the terminal or non-terminal at the given position.
member GetInput : int -> obj
/// Raise an error in this parse context
/// Raise an error in this parse context.
member RaiseError<'b> : unit -> 'b
/// Return the LexBuffer for this parser instance
/// Return the LexBuffer for this parser instance.
member LexBuffer : LexBuffer<char>
[<Sealed>]
/// The context provided when a parse error occurs
/// The context provided when a parse error occurs.
type internal ParseErrorContext<'tok> =
/// The stack of state indexes active at the parse error
/// The stack of state indexes active at the parse error .
member StateStack : int list
/// The state active at the parse error
/// The state active at the parse error.
member ParseState : IParseState
/// The tokens that would cause a reduction at the parse error
/// The tokens that would cause a reduction at the parse error.
member ReduceTokens: int list
/// The stack of productions that would be reduced at the parse error
/// The stack of productions that would be reduced at the parse error.
member ReducibleProductions : int list list
/// The token that caused the parse error
/// The token that caused the parse error.
member CurrentToken : 'tok option
/// The token that would cause a shift at the parse error
/// The token that would cause a shift at the parse error.
member ShiftTokens : int list
/// The message associated with the parse error
/// The message associated with the parse error.
member Message : string
/// Tables generated by fsyacc
/// The type of the tables contained in a file produced by the fsyacc.exe parser generator.
/// The type of the tables contained in a file produced by the <c>fsyacc.exe</c> parser generator.
type internal Tables<'tok> =
{ /// The reduction table
{
/// The reduction table.
reductions: (IParseState -> obj) array ;
/// The token number indicating the end of input
/// The token number indicating the end of input.
endOfInputTag: int;
/// A function to compute the tag of a token
/// A function to compute the tag of a token.
tagOfToken: 'tok -> int;
/// A function to compute the data carried by a token
/// A function to compute the data carried by a token.
dataOfToken: 'tok -> obj;
/// The sparse action table elements
/// The sparse action table elements.
actionTableElements: uint16[];
/// The sparse action table row offsets
/// The sparse action table row offsets.
actionTableRowOffsets: uint16[];
/// The number of symbols for each reduction
/// The number of symbols for each reduction.
reductionSymbolCounts: uint16[];
/// The immediate action table
/// The immediate action table.
immediateActions: uint16[];
/// The sparse goto table
/// The sparse goto table.
gotos: uint16[];
/// The sparse goto table row offsets
/// The sparse goto table row offsets.
sparseGotoTableRowOffsets: uint16[];
/// The sparse table for the productions active for each state
/// The sparse table for the productions active for each state.
stateToProdIdxsTableElements: uint16[];
/// The sparse table offsets for the productions active for each state
/// The sparse table offsets for the productions active for each state.
stateToProdIdxsTableRowOffsets: uint16[];
/// This table is logically part of the Goto table
/// This table is logically part of the Goto table.
productionToNonTerminalTable: uint16[];
/// This function is used to hold the user specified "parse_error" or "parse_error_rich" functions
/// This function is used to hold the user specified "parse_error" or "parse_error_rich" functions.
parseError: ParseErrorContext<'tok> -> unit;
/// The total number of terminals
/// The total number of terminals.
numTerminals: int;
/// The tag of the error terminal
/// The tag of the error terminal.
tagOfErrorTerminal: int }
/// Interpret the parser table taking input from the given lexer, using the given lex buffer, and the given start state.
/// Returns an object indicating the final synthesized value for the parse.
member Interpret : lexer:(LexBuffer<char> -> 'tok) * lexbuf:LexBuffer<char> * startState:int -> obj
/// Indicates an accept action has occurred
/// Indicates an accept action has occurred.
exception internal Accept of obj
/// Indicates a parse error has occurred and parse recovery is in progress
/// Indicates a parse error has occurred and parse recovery is in progress.
exception internal RecoverableParseError
#if DEBUG
......@@ -98,8 +99,8 @@ module internal Flags =
/// Helpers used by generated parsers.
module internal ParseHelpers =
/// The default implementation of the parse_error_rich function
/// The default implementation of the parse_error_rich function.
val parse_error_rich: (ParseErrorContext<'tok> -> unit) option
/// The default implementation of the parse_error function
/// The default implementation of the parse_error function.
val parse_error: string -> unit
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册