未验证 提交 af841de4 编写于 作者: W Will Smith 提交者: GitHub

Remove IsModuleRef/IsAssemblyRef/ModuleRef/AssemblyRef properties (#8045)

* Remove IsModuleRef/IsAssemblyRef/ModuleRef/AssemblyRef properties on ILScopeRef

* Use m_typ_Object for scope
上级 c66d4dba
......@@ -493,14 +493,6 @@ type ILScopeRef =
member x.IsLocalRef = match x with ILScopeRef.Local -> true | _ -> false
member x.IsModuleRef = match x with ILScopeRef.Module _ -> true | _ -> false
member x.IsAssemblyRef= match x with ILScopeRef.Assembly _ -> true | _ -> false
member x.ModuleRef = match x with ILScopeRef.Module x -> x | _ -> failwith "not a module reference"
member x.AssemblyRef = match x with ILScopeRef.Assembly x -> x | _ -> failwith "not an assembly reference"
member x.QualifiedName =
match x with
| ILScopeRef.Local -> ""
......@@ -2627,7 +2619,10 @@ type ILGlobals(primaryScopeRef) =
let m_typ_UIntPtr = ILType.Value (mkILNonGenericTySpec (m_mkSysILTypeRef tname_UIntPtr))
member x.primaryAssemblyScopeRef = m_typ_Object.TypeRef.Scope
member x.primaryAssemblyName = m_typ_Object.TypeRef.Scope.AssemblyRef.Name
member x.primaryAssemblyName =
match m_typ_Object.TypeRef.Scope with
| ILScopeRef.Assembly aref -> aref.Name
| _ -> failwith "Invalid primary assembly"
member x.typ_Object = m_typ_Object
member x.typ_String = m_typ_String
member x.typ_Array = m_typ_Array
......
......@@ -99,10 +99,6 @@ type ILScopeRef =
/// A reference to a type in another assembly
| Assembly of ILAssemblyRef
member IsLocalRef: bool
member IsModuleRef: bool
member IsAssemblyRef: bool
member ModuleRef: ILModuleRef
member AssemblyRef: ILAssemblyRef
member QualifiedName: string
// Calling conventions.
......
......@@ -2070,9 +2070,7 @@ and OptimizeExprOp cenv env (op, tyargs, args, m) =
// guarantees to optimize.
| TOp.ILCall (_, _, _, _, _, _, _, mref, _enclTypeArgs, _methTypeArgs, _tys), _, [arg]
when (mref.DeclaringTypeRef.Scope.IsAssemblyRef &&
mref.DeclaringTypeRef.Scope.AssemblyRef.Name = cenv.g.ilg.typ_Array.TypeRef.Scope.AssemblyRef.Name &&
mref.DeclaringTypeRef.Name = cenv.g.ilg.typ_Array.TypeRef.Name &&
when (mref.DeclaringTypeRef.Name = cenv.g.ilg.typ_Array.TypeRef.Name &&
mref.Name = "get_Length" &&
isArray1DTy cenv.g (tyOfExpr cenv.g arg)) ->
OptimizeExpr cenv env (Expr.Op (TOp.ILAsm (i_ldlen, [cenv.g.int_ty]), [], [arg], m))
......@@ -2785,7 +2783,10 @@ and TryInlineApplication cenv env finfo (tyargs: TType list, args: Expr list, m)
match vref.ApparentEnclosingEntity with
| Parent tcr when (tyconRefEq cenv.g cenv.g.lazy_tcr_canon tcr) ->
match tcr.CompiledRepresentation with
| CompiledTypeRepr.ILAsmNamed(iltr, _, _) -> iltr.Scope.AssemblyRef.Name = "FSharp.Core"
| CompiledTypeRepr.ILAsmNamed(iltr, _, _) ->
match iltr.Scope with
| ILScopeRef.Assembly aref -> aref.Name = "FSharp.Core"
| _ -> false
| _ -> false
| _ -> false
| _ -> false
......
......@@ -1397,7 +1397,10 @@ module StaticLinker =
// Add all provider-generated assemblies into the static linking set
let FindProviderGeneratedILModules (ctok, tcImports: TcImports, providerGeneratedAssemblies: (ImportedBinary * _) list) =
[ for (importedBinary, provAssemStaticLinkInfo) in providerGeneratedAssemblies do
let ilAssemRef = importedBinary.ILScopeRef.AssemblyRef
let ilAssemRef =
match importedBinary.ILScopeRef with
| ILScopeRef.Assembly aref -> aref
| _ -> failwith "Invalid ILScopeRef, expected ILScopeRef.Assembly"
if debugStaticLinking then printfn "adding provider-generated assembly '%s' into static linking set" ilAssemRef.Name
match tcImports.TryFindDllInfo(ctok, Range.rangeStartup, ilAssemRef.Name, lookupOnly=false) with
| Some dllInfo ->
......
......@@ -5775,10 +5775,7 @@ let NewTycon (cpath, nm, m, access, reprAccess, kind, typars, docOption, usesPre
let NewILTycon nlpath (nm, m) tps (scoref: ILScopeRef, enc, tdef: ILTypeDef) mtyp =
// NOTE: hasSelfReferentialCtor=false is an assumption about mscorlib
let hasSelfReferentialCtor = tdef.IsClass && (not scoref.IsAssemblyRef && scoref.AssemblyRef.Name = "mscorlib")
let tycon = NewTycon(nlpath, nm, m, taccessPublic, taccessPublic, TyparKind.Type, tps, XmlDoc.Empty, true, false, hasSelfReferentialCtor, mtyp)
let tycon = NewTycon(nlpath, nm, m, taccessPublic, taccessPublic, TyparKind.Type, tps, XmlDoc.Empty, true, false, false, mtyp)
tycon.entity_tycon_repr <- TILObjectRepr (TILObjectReprData (scoref, enc, tdef))
tycon.TypeContents.tcaug_closed <- true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册