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

Commit3273ed0

Browse files
authored
Merge pull requestdotnet#4596 from dsyme/caches4
Hide record representations in Abstract IL
2 parents176d669 +b606cb5 commit3273ed0

File tree

16 files changed

+1190
-1085
lines changed

16 files changed

+1190
-1085
lines changed

‎src/absil/il.fs‎

Lines changed: 418 additions & 352 deletions
Large diffs are not rendered by default.

‎src/absil/il.fsi‎

Lines changed: 241 additions & 209 deletions
Large diffs are not rendered by default.

‎src/absil/ilmorph.fs‎

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ let cattrs_typ2typ ilg f (cs: ILAttributes) =
155155
mkILCustomAttrs(List.map(cattr_typ2typ ilg f) cs.AsList)
156156

157157
letfdef_typ2typ ilg ftype(fd:ILFieldDef)=
158-
{fdwith Type=ftype fd.Type;
159-
CustomAttrs=cattrs_typ2typ ilg ftype fd.CustomAttrs}
158+
fd.With(fieldType=ftype fd.FieldType,
159+
customAttrs=cattrs_typ2typ ilg ftype fd.CustomAttrs)
160160

161161
letlocal_typ2typ f(l:ILLocal)={lwith Type= f l.Type}
162162
letvarargs_typ2typ f(varargs:ILVarArgs)= Option.map(List.map f) varargs
@@ -225,16 +225,15 @@ let morphILMethodBody (filmbody) (x: ILLazyMethodBody) =
225225

226226
letospec_typ2typ f(OverridesSpec(mref,ty))= OverridesSpec(mref_typ2typ f mref, f ty)
227227

228-
letmdef_typ2typ_ilmbody2ilmbody ilg fsmd=
228+
letmdef_typ2typ_ilmbody2ilmbody ilg fs(md:ILMethodDef)=
229229
let(ftype,filmbody)= fs
230230
letftype'= ftype(Some md)
231-
letbody'= morphILMethodBody(filmbody(Some md)) md.mdBody
232-
{mdwith
233-
GenericParams=gparams_typ2typ ftype' md.GenericParams;
234-
mdBody= body';
235-
Parameters= List.map(param_typ2typ ilg ftype') md.Parameters;
236-
Return= return_typ2typ ilg ftype' md.Return;
237-
CustomAttrs=cattrs_typ2typ ilg ftype' md.CustomAttrs}
231+
letbody'= morphILMethodBody(filmbody(Some md)) md.Body
232+
md.With(genericParams=gparams_typ2typ ftype' md.GenericParams,
233+
body= body',
234+
parameters= List.map(param_typ2typ ilg ftype') md.Parameters,
235+
ret= return_typ2typ ilg ftype' md.Return,
236+
customAttrs=cattrs_typ2typ ilg ftype' md.CustomAttrs)
238237

239238
letfdefs_typ2typ ilg f x= fdefs_fdef2fdef(fdef_typ2typ ilg f) x
240239

@@ -244,44 +243,41 @@ let mimpl_typ2typ f e =
244243
{ Overrides= ospec_typ2typ f e.Overrides;
245244
OverrideBy= mspec_typ2typ(f,(fun _-> f)) e.OverrideBy;}
246245

247-
letedef_typ2typ ilg f e=
248-
{ ewith
249-
Type= Option.map f e.Type;
250-
AddMethod= mref_typ2typ f e.AddMethod;
251-
RemoveMethod= mref_typ2typ f e.RemoveMethod;
252-
FireMethod= Option.map(mref_typ2typ f) e.FireMethod;
253-
OtherMethods= List.map(mref_typ2typ f) e.OtherMethods;
254-
CustomAttrs= cattrs_typ2typ ilg f e.CustomAttrs}
255-
256-
letpdef_typ2typ ilg f p=
257-
{ pwith
258-
SetMethod= Option.map(mref_typ2typ f) p.SetMethod;
259-
GetMethod= Option.map(mref_typ2typ f) p.GetMethod;
260-
Type= f p.Type;
261-
Args= List.map f p.Args;
262-
CustomAttrs= cattrs_typ2typ ilg f p.CustomAttrs}
246+
letedef_typ2typ ilg f(e:ILEventDef)=
247+
e.With(eventType= Option.map f e.EventType,
248+
addMethod= mref_typ2typ f e.AddMethod,
249+
removeMethod= mref_typ2typ f e.RemoveMethod,
250+
fireMethod= Option.map(mref_typ2typ f) e.FireMethod,
251+
otherMethods= List.map(mref_typ2typ f) e.OtherMethods,
252+
customAttrs= cattrs_typ2typ ilg f e.CustomAttrs)
253+
254+
letpdef_typ2typ ilg f(p:ILPropertyDef)=
255+
p.With(setMethod= Option.map(mref_typ2typ f) p.SetMethod,
256+
getMethod= Option.map(mref_typ2typ f) p.GetMethod,
257+
propertyType= f p.PropertyType,
258+
args= List.map f p.Args,
259+
customAttrs= cattrs_typ2typ ilg f p.CustomAttrs)
263260

264261
letpdefs_typ2typ ilg f(pdefs:ILPropertyDefs)= mkILProperties(List.map(pdef_typ2typ ilg f) pdefs.AsList)
265262
letedefs_typ2typ ilg f(edefs:ILEventDefs)= mkILEvents(List.map(edef_typ2typ ilg f) edefs.AsList)
266263

267264
letmimpls_typ2typ f(mimpls:ILMethodImplDefs)= mkILMethodImpls(List.map(mimpl_typ2typ f) mimpls.AsList)
268265

269-
let rectdef_typ2typ_ilmbody2ilmbody_mdefs2mdefs ilg enc fstd=
266+
let rectdef_typ2typ_ilmbody2ilmbody_mdefs2mdefs ilg enc fs(td:ILTypeDef)=
270267
let(ftype,fmdefs)= fs
271268
letftype'= ftype(Some(enc,td)) None
272269
letmdefs'= fmdefs(enc,td) td.Methods
273270
letfdefs'= fdefs_typ2typ ilg ftype' td.Fields
274-
{tdwith Implements= List.map ftype' td.Implements;
275-
GenericParams= gparams_typ2typ ftype' td.GenericParams;
276-
Extends= Option.map ftype' td.Extends;
277-
Methods=mdefs';
278-
NestedTypes=tdefs_typ2typ_ilmbody2ilmbody_mdefs2mdefs ilg(enc@[td]) fs td.NestedTypes;
279-
Fields=fdefs';
280-
MethodImpls= mimpls_typ2typ ftype' td.MethodImpls;
281-
Events= edefs_typ2typ ilg ftype' td.Events;
282-
Properties= pdefs_typ2typ ilg ftype' td.Properties;
283-
CustomAttrs= cattrs_typ2typ ilg ftype' td.CustomAttrs;
284-
}
271+
td.With(implements= List.map ftype' td.Implements,
272+
genericParams= gparams_typ2typ ftype' td.GenericParams,
273+
extends= Option.map ftype' td.Extends,
274+
methods=mdefs',
275+
nestedTypes=tdefs_typ2typ_ilmbody2ilmbody_mdefs2mdefs ilg(enc@[td]) fs td.NestedTypes,
276+
fields=fdefs',
277+
methodImpls= mimpls_typ2typ ftype' td.MethodImpls,
278+
events= edefs_typ2typ ilg ftype' td.Events,
279+
properties= pdefs_typ2typ ilg ftype' td.Properties,
280+
customAttrs= cattrs_typ2typ ilg ftype' td.CustomAttrs)
285281

286282
andtdefs_typ2typ_ilmbody2ilmbody_mdefs2mdefs ilg enc fs tdefs=
287283
morphILTypeDefs(tdef_typ2typ_ilmbody2ilmbody_mdefs2mdefs ilg enc fs) tdefs

‎src/absil/ilprint.fs‎

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ and goutput_permission _env os p =
270270

271271

272272
match pwith
273-
|PermissionSet(sa,b)->
273+
|ILSecurityDecl(sa,b)->
274274
output_string os" .permissionset"
275275
output_security_action os sa
276276
output_string os" = ("
277277
output_bytes os b
278278
output_string os")"
279279

280-
andgoutput_security_decls env os(ps:ILPermissions)= output_seq""(goutput_permission env) os ps.AsList
280+
andgoutput_security_decls env os(ps:ILSecurityDecls)= output_seq""(goutput_permission env) os ps.AsList
281281

282282
andgoutput_gparam env os(gf:ILGenericParameterDef)=
283283
output_string os(tyvar_generator gf.Name);
@@ -469,30 +469,30 @@ let output_custom_attr_data os data =
469469
output_string os" ="; output_parens output_bytes os data
470470

471471
letgoutput_custom_attr env os attr=
472-
output_string os" .custom";
473-
goutput_mspec env os attr.Method;
472+
output_string os" .custom"
473+
goutput_mspec env os attr.Method
474474
output_custom_attr_data os attr.Data
475475

476476
letgoutput_custom_attrs env os(attrs:ILAttributes)=
477477
List.iter(fun attr-> goutput_custom_attr env os attr; output_string os"\n") attrs.AsList
478478

479-
letgoutput_fdef _tref env osfd=
480-
output_string os" .field";
479+
letgoutput_fdef _tref env os(fd:ILFieldDef)=
480+
output_string os" .field"
481481
match fd.Offsetwith Some i-> output_string os"["; output_i32 os i; output_string os"]"| None->()
482482
match fd.Marshalwith Some_i-> output_string os"// marshal attribute not printed\n";| None->()
483-
output_member_access os fd.Access;
484-
output_string os"";
485-
if fd.IsStaticthen output_string os" static";
486-
if fd.IsLiteralthen output_string os" literal";
487-
if fd.IsSpecialNamethen output_string os" specialname rtspecialname";
488-
if fd.IsInitOnlythen output_string os" initonly";
489-
if fd.NotSerializedthen output_string os" notserialized";
490-
goutput_typ env os fd.Type;
491-
output_string os"";
492-
output_id os fd.Name;
493-
output_option output_at os fd.Data;
494-
output_option output_field_init os fd.LiteralValue;
495-
output_string os"\n";
483+
output_member_access os fd.Access
484+
output_string os""
485+
if fd.IsStaticthen output_string os" static"
486+
if fd.IsLiteralthen output_string os" literal"
487+
if fd.IsSpecialNamethen output_string os" specialname rtspecialname"
488+
if fd.IsInitOnlythen output_string os" initonly"
489+
if fd.NotSerializedthen output_string os" notserialized"
490+
goutput_typ env os fd.FieldType
491+
output_string os""
492+
output_id os fd.Name
493+
output_option output_at os fd.Data
494+
output_option output_field_init os fd.LiteralValue
495+
output_string os"\n"
496496
goutput_custom_attrs env os fd.CustomAttrs
497497

498498

@@ -768,7 +768,7 @@ let goutput_ilmbody env os (il: ILMethodBody) =
768768
output_string os")\n"
769769

770770

771-
letgoutput_mbody is_entrypoint env osmd=
771+
letgoutput_mbody is_entrypoint env os(md:ILMethodDef)=
772772
if md.ImplAttributes&&& MethodImplAttributes.Native<>enum0then output_string os"native"
773773
elif md.ImplAttributes&&& MethodImplAttributes.IL<>enum0then output_string os"cil"
774774
else output_string os"runtime"
@@ -779,7 +779,7 @@ let goutput_mbody is_entrypoint env os md =
779779
output_string os"\n{\n";
780780
goutput_security_decls env os md.SecurityDecls;
781781
goutput_custom_attrs env os md.CustomAttrs;
782-
match md.mdBody.Contentswith
782+
match md.Body.Contentswith
783783
| MethodBody.IL il-> goutput_ilmbody env os il
784784
|_->()
785785
if is_entrypointthen output_string os" .entrypoint";
@@ -799,7 +799,7 @@ let goutput_mdef env os (md:ILMethodDef) =
799799
elif md.IsConstructorthen"rtspecialname"
800800
elif md.IsStaticthen
801801
"static"^
802-
(match md.mdBody.Contentswith
802+
(match md.Body.Contentswith
803803
MethodBody.PInvoke(attr)->
804804
"pinvokeimpl(\""^ attr.Where.Name^"\" as\""^ attr.Name^"\""^
805805
(match attr.CallingConvwith
@@ -852,7 +852,7 @@ let goutput_mdef env os (md:ILMethodDef) =
852852
(goutput_mbody is_entrypoint menv) os md;
853853
output_string os"\n"
854854

855-
letgoutput_pdef env ospd=
855+
letgoutput_pdef env os(pd:ILPropertyDef)=
856856
output_string os"property\n\tgetter:";
857857
(match pd.GetMethodwith None->()| Some mref-> goutput_mref env os mref);
858858
output_string os"\n\tsetter:";
@@ -891,7 +891,7 @@ let goutput_mdefs env os (mdefs: ILMethodDefs) =
891891
letgoutput_pdefs env os(pdefs:ILPropertyDefs)=
892892
List.iter(fun f->(goutput_pdef env) os f; output_string os"\n") pdefs.AsList
893893

894-
let recgoutput_tdef(enc)env contents oscd=
894+
let recgoutput_tdef enc env contents os(cd:ILTypeDef)=
895895
letenv= ppenv_enter_tdef cd.GenericParams env
896896
letlayout_attr,pp_layout_decls= splitTypeLayout cd.Layout
897897
if isTypeNameForGlobalFunctions cd.Namethen
@@ -939,26 +939,26 @@ and output_init_semantics os f =
939939
andgoutput_lambdas env os lambdas=
940940
match lambdaswith
941941
| Lambdas_forall(gf,l)->
942-
output_angled(goutput_gparam env) os gf;
943-
output_string os"";
942+
output_angled(goutput_gparam env) os gf
943+
output_string os""
944944
(goutput_lambdas env) os l
945945
| Lambdas_lambda(ps,l)->
946946
output_parens(goutput_param env) os ps;
947-
output_string os"";
947+
output_string os""
948948
(goutput_lambdas env) os l
949949
| Lambdas_return typ-> output_string os"-->";(goutput_typ env) os typ
950950

951-
andgoutput_tdefs contents(enc)env os(td:ILTypeDefs)=
951+
andgoutput_tdefs contents enc env os(td:ILTypeDefs)=
952952
List.iter(goutput_tdef enc env contents os) td.AsList
953953

954954
letoutput_ver os(a,b,c,d)=
955-
output_string os" .ver";
956-
output_u16 os a;
957-
output_string os" :";
958-
output_u16 os b;
959-
output_string os" :";
960-
output_u16 os c;
961-
output_string os" :";
955+
output_string os" .ver"
956+
output_u16 os a
957+
output_string os" :"
958+
output_u16 os b
959+
output_string os" :"
960+
output_u16 os c
961+
output_string os" :"
962962
output_u16 os d
963963

964964
letoutput_locale os s= output_string os" .Locale"; output_qstring os s

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp