提交 4b9f397e 编写于 作者: D Don Syme

cleaup whitespace and types

上级 98eec39f
......@@ -3263,8 +3263,8 @@ let cdef_cctorCode2CodeOrCreate tag f cd =
let mdefs = cd.Methods
let cctor =
match mdefs.FindByName ".cctor" with
| [ mdef ] -> mdef
| [ ] -> mkILClassCtor (mkMethodBody (false,emptyILLocals,1,nonBranchingInstrsToCode [ ],tag))
| [mdef] -> mdef
| [] -> mkILClassCtor (mkMethodBody (false,emptyILLocals,1,nonBranchingInstrsToCode [ ],tag))
| _ -> failwith "bad method table: more than one .cctor found"
let methods = ILMethodDefs (fun () -> [| yield f cctor; for md in mdefs do if md.Name <> ".cctor" then yield md |])
......@@ -3458,10 +3458,10 @@ let mkILSimpleClass ilg (nm, access, methods, fields, nestedTypes, props, events
let mkILTypeDefForGlobalFunctions ilg (methods,fields) = mkILSimpleClass ilg (typeNameForGlobalFunctions, ILTypeDefAccess.Public, methods, fields, emptyILTypeDefs, emptyILProperties, emptyILEvents, emptyILCustomAttrs,ILTypeInit.BeforeField)
let destTypeDefsWithGlobalFunctionsFirst ilg (tdefs: ILTypeDefs) =
let l = tdefs.AsArray
let top,nontop = l |> Array.partition (fun td -> td.Name = typeNameForGlobalFunctions)
let top2 = if top.Length = 0 then [| mkILTypeDefForGlobalFunctions ilg (emptyILMethods, emptyILFields) |] else top
Array.append top2 nontop
let l = tdefs.AsList
let top,nontop = l |> List.partition (fun td -> td.Name = typeNameForGlobalFunctions)
let top2 = if top.Length = 0 then [ mkILTypeDefForGlobalFunctions ilg (emptyILMethods, emptyILFields) ] else top
top2@nontop
let mkILSimpleModule assname modname dll subsystemVersion useHighEntropyVA tdefs hashalg locale flags exportedTypes metadataVersion =
{ Manifest=
......@@ -5101,8 +5101,8 @@ let resolveILMethodRef td (mref:ILMethodRef) =
(md.Parameters,mref.ArgTypes) ||> ILList.lengthsEqAndForall2 (fun p1 p2 -> p1.Type = p2) &&
// REVIEW: this uses equality on ILType. For CMOD_OPTIONAL this is not going to be correct
md.Return.Type = mref.ReturnType) with
| [ ] -> failwith ("no method named "+nm+" with appropriate argument types found in type "+td.Name);
| [ mdef ] -> mdef
| [] -> failwith ("no method named "+nm+" with appropriate argument types found in type "+td.Name);
| [mdef] -> mdef
| _ -> failwith ("multiple methods named "+nm+" appear with identical argument types in type "+td.Name)
let mkRefToILModule m =
......
......@@ -1421,7 +1421,7 @@ type ILTypeDefs =
member AsList : ILTypeDef list
/// Get some information about the type defs, but do not force the read of the type defs themselves
member AsArrayOfLazyTypeDefs : (string list * string * ILAttributes * Lazy<ILTypeDef>)[]
member AsArrayOfLazyTypeDefs : (string list * string * ILAttributes * Lazy<ILTypeDef>) array
/// Calls to [FindByName] will result in any laziness in the overall
/// set of ILTypeDefs being read in in addition
......@@ -1794,7 +1794,7 @@ val EcmaILGlobals : ILGlobals
/// When writing a binary the fake "toplevel" type definition (called <Module>)
/// must come first. This function puts it first, and creates it in the returned list as an empty typedef if it
/// doesn't already exist.
val destTypeDefsWithGlobalFunctionsFirst: ILGlobals -> ILTypeDefs -> ILTypeDef[]
val destTypeDefsWithGlobalFunctionsFirst: ILGlobals -> ILTypeDefs -> ILTypeDef list
/// Note: not all custom attribute data can be decoded without binding types. In particular
/// enums must be bound in order to discover the size of the underlying integer.
......@@ -2069,7 +2069,7 @@ val emptyILTypeDefs: ILTypeDefs
///
/// Note that individual type definitions may contain further delays
/// in their method, field and other tables.
val mkILTypeDefsComputed: (unit -> (string list * string * ILAttributes * Lazy<ILTypeDef>)[]) -> ILTypeDefs
val mkILTypeDefsComputed: (unit -> (string list * string * ILAttributes * Lazy<ILTypeDef>) array) -> ILTypeDefs
val addILTypeDef: ILTypeDef -> ILTypeDefs -> ILTypeDefs
val mkILNestedExportedTypes: ILNestedExportedType list -> ILNestedExportedTypes
......@@ -2255,22 +2255,6 @@ val getTyOfILEnumInfo: ILEnumInfo -> ILType
val computeILEnumInfo: string * ILFieldDefs -> ILEnumInfo
val runningOnMono: bool
type ILReferences =
{ AssemblyReferences: ILAssemblyRef list;
ModuleReferences: ILModuleRef list; }
/// Find the full set of assemblies referenced by a module
val computeILRefs: ILModuleDef -> ILReferences
val emptyILRefs: ILReferences
// --------------------------------------------------------------------
// The following functions are used to define an extension to the In reality the only extension is ILX
type ILTypeDefKindExtension<'Extension> = TypeDefKindExtension
val RegisterTypeDefKindExtension: ILTypeDefKindExtension<'Extension> -> ('Extension -> IlxExtensionTypeKind) * (IlxExtensionTypeKind -> bool) * (IlxExtensionTypeKind -> 'Extension)
// --------------------------------------------------------------------
// For completeness. These do not occur in metadata but tools that
......@@ -2290,3 +2274,20 @@ type ILPropertyRef =
member EnclosingTypeRef: ILTypeRef
member Name: string
interface System.IComparable
val runningOnMono: bool
type ILReferences =
{ AssemblyReferences: ILAssemblyRef list;
ModuleReferences: ILModuleRef list; }
/// Find the full set of assemblies referenced by a module
val computeILRefs: ILModuleDef -> ILReferences
val emptyILRefs: ILReferences
// --------------------------------------------------------------------
// The following functions are used to define an extension to the In reality the only extension is ILX
type ILTypeDefKindExtension<'Extension> = TypeDefKindExtension
val RegisterTypeDefKindExtension: ILTypeDefKindExtension<'Extension> -> ('Extension -> IlxExtensionTypeKind) * (IlxExtensionTypeKind -> bool) * (IlxExtensionTypeKind -> 'Extension)
......@@ -1008,9 +1008,9 @@ let GetTypeNameAsElemPair cenv n =
let rec GenTypeDefPass1 enc cenv (td:ILTypeDef) =
ignore (cenv.typeDefs.AddUniqueEntry "type index" (fun (TdKey (_,n)) -> n) (TdKey (enc,td.Name)))
GenTypeDefsPass1 (enc@[td.Name]) cenv td.NestedTypes.AsArray
GenTypeDefsPass1 (enc@[td.Name]) cenv td.NestedTypes.AsList
and GenTypeDefsPass1 enc cenv tds = Array.iter (GenTypeDefPass1 enc cenv) tds
and GenTypeDefsPass1 enc cenv tds = List.iter (GenTypeDefPass1 enc cenv) tds
//=====================================================================
// Pass 2 - allocate indexes for methods and fields and write rows for types
......@@ -1545,12 +1545,12 @@ and GenTypeDefPass2 pidx enc cenv (td:ILTypeDef) =
events |> List.iter (GenEventDefPass2 cenv tidx)
td.Fields.AsList |> List.iter (GenFieldDefPass2 cenv tidx)
td.Methods |> Seq.iter (GenMethodDefPass2 cenv tidx)
td.NestedTypes.AsArray |> GenTypeDefsPass2 tidx (enc@[td.Name]) cenv
td.NestedTypes.AsList |> GenTypeDefsPass2 tidx (enc@[td.Name]) cenv
with e ->
failwith ("Error in pass2 for type "+td.Name+", error: "+e.Message)
and GenTypeDefsPass2 pidx enc cenv tds =
Array.iter (GenTypeDefPass2 pidx enc cenv) tds
List.iter (GenTypeDefPass2 pidx enc cenv) tds
//=====================================================================
// Pass 3 - write details of methods, fields, IL code, custom attrs etc.
......@@ -3141,14 +3141,14 @@ let rec GenTypeDefPass3 enc cenv (td:ILTypeDef) =
td.SecurityDecls.AsList |> GenSecurityDeclsPass3 cenv (hds_TypeDef,tidx)
td.CustomAttrs |> GenCustomAttrsPass3Or4 cenv (hca_TypeDef,tidx)
td.GenericParams |> List.iteri (fun n gp -> GenGenericParamPass3 cenv env n (tomd_TypeDef,tidx) gp)
td.NestedTypes.AsArray |> GenTypeDefsPass3 (enc@[td.Name]) cenv
td.NestedTypes.AsList |> GenTypeDefsPass3 (enc@[td.Name]) cenv
with e ->
failwith ("Error in pass3 for type "+td.Name+", error: "+e.Message)
reraise()
raise e
and GenTypeDefsPass3 enc cenv tds =
Array.iter (GenTypeDefPass3 enc cenv) tds
List.iter (GenTypeDefPass3 enc cenv) tds
/// ILTypeDef --> generate generic params on ILMethodDef: ensures
/// GenericParam table is built sorted by owner.
......@@ -3159,14 +3159,14 @@ let rec GenTypeDefPass4 enc cenv (td:ILTypeDef) =
let tidx = GetIdxForTypeDef cenv (TdKey(enc,td.Name))
td.Methods |> Seq.iter (GenMethodDefPass4 cenv env)
List.iteri (fun n gp -> GenGenericParamPass4 cenv env n (tomd_TypeDef,tidx) gp) td.GenericParams
GenTypeDefsPass4 (enc@[td.Name]) cenv td.NestedTypes.AsArray
GenTypeDefsPass4 (enc@[td.Name]) cenv td.NestedTypes.AsList
with e ->
failwith ("Error in pass4 for type "+td.Name+", error: "+e.Message)
reraise()
raise e
and GenTypeDefsPass4 enc cenv tds =
Array.iter (GenTypeDefPass4 enc cenv) tds
List.iter (GenTypeDefPass4 enc cenv) tds
// --------------------------------------------------------------------
// ILExportedTypesAndForwarders --> ILExportedTypeOrForwarder table
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册