Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3907fcc

Browse files
forkiKevinRansom
authored andcommitted
Don't convert attributes to array and then to list (#3159)
* Don't convert attributes to array and then to list* Don't convert attributes to array and then to list
1 parentc5482ca commit3907fcc

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

‎src/absil/il.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ and [<Sealed>] ILTypeDefs(f : unit -> (string list * string * ILAttributes * Laz
15881588
t)
15891589

15901590
memberx.AsArray=[|for(_,_,_,ltd)in array.Value-> ltd.Force()|]
1591-
memberx.AsList=x.AsArray|> Array.toList
1591+
memberx.AsList=[for(_,_,_,ltd)in array.Value-> ltd.Force()]
15921592

15931593
interface IEnumerablewith
15941594
memberx.GetEnumerator()=((x:> IEnumerable<ILTypeDef>).GetEnumerator():> IEnumerator)

‎src/absil/il.fsi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,7 @@ type ILAttribute =
854854

855855
[<NoEquality; NoComparison; Sealed>]
856856
typeILAttributes=
857+
memberAsArray:ILAttribute[]
857858
memberAsList:ILAttribute list
858859

859860
/// Method parameters and return values.

‎src/fsharp/TastOps.fs‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2718,18 +2718,17 @@ let isILAttrib (tref:ILTypeRef) (attr: ILAttribute) =
27182718
// These linear iterations cost us a fair bit when there are lots of attributes
27192719
// on imported types. However this is fairly rare and can also be solved by caching the
27202720
// results of attribute lookups in the TAST
2721-
letHasILAttribute tref(attrs:ILAttributes)=List.exists(isILAttrib tref) attrs.AsList
2721+
letHasILAttribute tref(attrs:ILAttributes)=Array.exists(isILAttrib tref) attrs.AsArray
27222722

2723-
letHasILAttributeByName tname(attrs:ILAttributes)=List.exists(isILAttribByName([],tname)) attrs.AsList
2723+
letHasILAttributeByName tname(attrs:ILAttributes)=Array.exists(isILAttribByName([],tname)) attrs.AsArray
27242724

27252725
letTryDecodeILAttribute(g:TcGlobals)tref(attrs:ILAttributes)=
2726-
attrs.AsList|>List.tryPick(fun x->if isILAttrib tref xthen Some(decodeILAttribData g.ilg x)else None)
2726+
attrs.AsArray|>Array.tryPick(fun x->if isILAttrib tref xthen Some(decodeILAttribData g.ilg x)else None)
27272727

27282728
// This one is done by name to ensure the compiler doesn't take a dependency on dereferencing a type that only exists in .NET 3.5
27292729
letILThingHasExtensionAttribute(attrs:ILAttributes)=
2730-
attrs.AsList
2731-
|> List.exists(fun attr->
2732-
attr.Method.EnclosingType.TypeSpec.Name="System.Runtime.CompilerServices.ExtensionAttribute")
2730+
attrs.AsArray
2731+
|> Array.exists(fun attr-> attr.Method.EnclosingType.TypeSpec.Name="System.Runtime.CompilerServices.ExtensionAttribute")
27332732

27342733
// F# view of attributes (these get converted to AbsIL attributes in ilxgen)
27352734
letIsMatchingFSharpAttribute g(AttribInfo(_,tcref))(Attrib(tcref2,_,_,_,_,_,_))= tyconRefEq g tcref tcref2

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp