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

Commitf57b97c

Browse files
authored
Fix attribute references (#3530)
* Fix attribute references* For attributes with type arguments only add reference to Nominal types
1 parent4eba761 commitf57b97c

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

‎src/absil/il.fs‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,8 @@ type ILAttribElem =
838838
typeILAttributeNamedArg=(string* ILType* bool* ILAttribElem)
839839
typeILAttribute=
840840
{ Method:ILMethodSpec;
841-
Data:byte[]}
841+
Data:byte[]
842+
Elements:ILAttribElem list}
842843

843844
[<NoEquality; NoComparison; Sealed>]
844845
typeILAttributes(f: unit->ILAttribute[])=
@@ -3088,12 +3089,12 @@ let rec decodeCustomAttrElemType (ilg: ILGlobals) bytes sigptr x =
30883089
let recencodeCustomAttrPrimValue ilg c=
30893090
match cwith
30903091
| ILAttribElem.Bool b->[|(if bthen0x01uyelse0x00uy)|]
3091-
| ILAttribElem.String None
3092-
| ILAttribElem.Type None
3092+
| ILAttribElem.String None
3093+
| ILAttribElem.Type None
30933094
| ILAttribElem.TypeRef None
30943095
| ILAttribElem.Null->[|0xFFuy|]
30953096
| ILAttribElem.String(Some s)-> encodeCustomAttrString s
3096-
| ILAttribElem.Char x-> u16AsBytes(uint16 x)
3097+
| ILAttribElem.Char x->u16AsBytes(uint16 x)
30973098
| ILAttribElem.SByte x-> i8AsBytes x
30983099
| ILAttribElem.Int16 x-> i16AsBytes x
30993100
| ILAttribElem.Int32 x-> i32AsBytes x
@@ -3135,9 +3136,9 @@ let mkILCustomAttribMethRef (ilg: ILGlobals) (mspec:ILMethodSpec, fixedArgs: lis
31353136
yield! u16AsBytes(uint16 namedArgs.Length)
31363137
for namedArgin namedArgsdo
31373138
yield! encodeCustomAttrNamedArg ilg namedArg|]
3138-
31393139
{ Method= mspec;
3140-
Data= args}
3140+
Data= args;
3141+
Elements= fixedArgs@(namedArgs|> List.map(fun(_,_,_,e)-> e))}
31413142

31423143
letmkILCustomAttribute ilg(tref,argtys,argvs,propvs)=
31433144
mkILCustomAttribMethRef ilg(mkILNonGenericCtorMethSpec(tref,argtys),argvs,propvs)

‎src/absil/il.fsi‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,8 @@ type ILAttributeNamedArg = string * ILType * bool * ILAttribElem
852852
/// to ILAttribElem's as best as possible.
853853
typeILAttribute=
854854
{ Method:ILMethodSpec;
855-
Data:byte[]}
855+
Data:byte[]
856+
Elements:ILAttribElem list}
856857

857858
[<NoEquality; NoComparison; Sealed>]
858859
typeILAttributes=

‎src/absil/ilread.fs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2532,7 +2532,8 @@ and seekReadCustomAttrUncached ctxtH (CustomAttrIdx (cat,idx,valIdx)) =
25322532
Data=
25332533
match readBlobHeapOption ctxt valIdxwith
25342534
| Some bytes-> bytes
2535-
| None-> Bytes.ofInt32Array[||]}
2535+
| None-> Bytes.ofInt32Array[||]
2536+
Elements=[]}
25362537

25372538
andseekReadSecurityDecls ctxt idx=
25382539
mkILLazySecurityDecls

‎src/absil/ilwrite.fs‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,10 +1413,17 @@ let rec GetCustomAttrDataAsBlobIdx cenv (data:byte[]) =
14131413

14141414
andGetCustomAttrRow cenv hca attr=
14151415
letcat= GetMethodRefAsCustomAttribType cenv attr.Method.MethodRef
1416-
UnsharedRow
1417-
[| HasCustomAttribute(fst hca, snd hca)
1418-
CustomAttributeType(fst cat, snd cat)
1419-
Blob(GetCustomAttrDataAsBlobIdx cenv attr.Data)|]
1416+
for elementin attr.Elementsdo
1417+
match elementwith
1418+
| ILAttribElem.Type(Some ty)when ty.IsNominal-> GetTypeRefAsTypeRefIdx cenv ty.TypeRef|> ignore
1419+
| ILAttribElem.TypeRef(Some tref)-> GetTypeRefAsTypeRefIdx cenv tref|> ignore
1420+
|_->()
1421+
1422+
UnsharedRow
1423+
[| HasCustomAttribute(fst hca, snd hca);
1424+
CustomAttributeType(fst cat, snd cat);
1425+
Blob(GetCustomAttrDataAsBlobIdx cenv attr.Data)
1426+
|]
14201427

14211428
andGenCustomAttrPass3Or4 cenv hca attr=
14221429
AddUnsharedRow cenv TableNames.CustomAttribute(GetCustomAttrRow cenv hca attr)|> ignore
@@ -4323,4 +4330,3 @@ let WriteILBinary (outfile, (args: options), modul) =
43234330
args.ilg, args.pdbfile, args.signer, args.portablePDB, args.embeddedPDB, args.embedAllSource,
43244331
args.embedSourceList, args.sourceLink, args.emitTailcalls, args.deterministic, args.showTimes, args.dumpDebugInfo) modul
43254332
|> ignore
4326-

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp